Note that there are some explanatory texts on larger screens.

plurals
  1. POzend framework 2 - ServiceManager error while saving data in database
    primarykey
    data
    text
    <p>I am trying to create a saveAction in zend2 framework using doctrine.</p> <p>in my PromotionsController i have this action:</p> <pre><code>public function saveLinkAction() { $view = new ViewModel(); $salonId = (int) $this-&gt;params()-&gt;fromPost('salon_id', null); $addLink = $this-&gt;getServiceLocator()-&gt;get('Promotions\Model\Link'); $linkData['salon_id'] = $salonId; $linkData['link'] = '/link/example'; $addLink-&gt;setData($linkData); return $view; } </code></pre> <p>This is just for learning how to write data in database.</p> <pre><code>$addLink = $this-&gt;getServiceLocator()-&gt;get('Promotions\Model\Link'); </code></pre> <p>This line of code is showing an error and i don't know what is the cause?</p> <pre><code>Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Promotions\Model\Link </code></pre> <p>I have created a Link.php in Model directory.</p> <pre><code>&lt;?php namespace Link\Model; use Application\Model\Entity; use Zend\Form\Annotation; /** * @Entity * @Table(name="promo_link") */ class Link extends Entity { /********** PROPERTIES **********/ /** * @Id @GeneratedValue(strategy="AUTO") @Column(name="id", type="integer") * @var int * * @Annotation\Exclude() */ protected $id; /** * @Column(name="salon", type="integer") * @var int * * @Annotation\Options({"label":"Salon"}) * @Annotation\Validator({"name": "Digits"}) */ protected $salon; /** * @Column(name="link", type="string") * @var string */ protected $link; /** * @Column(name="start_date", type="string") * @var string */ protected $start_date; /** * @Column(name="end_date", type="string") * @var string */ protected $end_date; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload