SeUserProgress and SeUser. The SeUserProgress table holds multiple entries per user. This is expressed via the two following mappings.
class: SeUserProgress
/**
* @ORM\ManyToOne(targetEntity="SeUser", inversedBy="progress")
* @ORM\Column(name="user_id", type="integer", nullable=true)
*/
private $user;
class: SeUser
/**
* @ORM\OneToMany(targetEntity="SeUserProgress", mappedBy="user")
*/
private $progress;
However I keep getting an error message saying
The association PROJECT\ThisBundle\Entity\SeUser#progress refers to the owning side field PROJECT\ThisBundle\Entity\SeUserProgress#user which is not defined as association.
The association PROJECT\ThisBundle\Entity\SeUser#progress refers to the owning side field PROJECT\ThisBundle\Entity\SeUserProgress#user which does not exist.
I can even call the progress property via the code below( though it returns all progress for all users ).
$user->getProgress()
Any suggestions as to why Doctrine is not recognising the mapped property would be appreciated.
Change your code from @ORM\Column to @ORM\JoinColumn:
/**
* @ORM\ManyToOne(targetEntity="SeUser", inversedBy="progress")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With