Reputation: 2557
I try to get row from DB but this code:
$company = $this->getDoctrine()->getRepository('AcmeCompanyBundle:Company')->find($company_id);
returns this error:
Notice: Undefined index: company in /var/www/ontheway/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 2714
Here is my Company entity on github: github
Upvotes: 0
Views: 812
Reputation: 20193
/**
* @ORM\OneToOne(targetEntity="\Vputi\UserBundle\Entity\User", inversedBy="company", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="Certificate", mappedBy="company", cascade={"persist"})
*/
private $certificates;
You have both these:
targetEntity="\Vputi\UserBundle\Entity\User", inversedBy="company"
targetEntity="Certificate", mappedBy="company"
I would suspect that either User
or Certificate
entities do not have the company
field. Do they?
Upvotes: 2