I have a View
entity that references an associated entity called ViewVersion
. But if I name the variable anything other than viewVersion
, e.g. just simple version
, then I get an error:
Neither the property "viewVersion" nor one of the methods "getViewVersion()", "isViewVersion()", "hasViewVersion()", "__get()" exist and have public access in class "Gutensite\CmsBundle\Entity\View\View".
All the getters and setters are created through php app/console doctrine:generate:entities
but they are for getVersion()
and not getViewVersion()
.
Question: So, is there some unspoken rule that associated entities MUST be named the same as their class name?
Entity Definition
/**
* @ORM\Entity
* @ORM\Table(name="view")
* @ORM\Entity(repositoryClass="Gutensite\CmsBundle\Entity\View\ViewRepository")
*/
class View extends Entity\Base {
/**
* @ORM\OneToOne(targetEntity="\Gutensite\CmsBundle\Entity\View\ViewVersion", inversedBy="view", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\JoinColumn(name="versionId", referencedColumnName="id")
*/
protected $version;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $versionId = NULL;
}