I have an entity that contains a OneToOne relationship with another entity:
/**
* @ORM\Entity
* @ORM\Table(name="tb_promocao")
*/
class Promocao {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $codigo;
/**
* @ORM\OneToOne(targetEntity="Application\Model\Produto\Produto")
* @ORM\JoinColumn(name="cod_produto", referencedColumnName="codigo")
*/
private $produto;
}
/**
* @ORM\Entity
* @ORM\Table(name="tb_produto")
*/
class Produto {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $codigo;
(...)
}
The problem is that when I try to give a fetch entity in Promocao the property $produto is not correctly populated with the Produto entity.
The Produto entity is not properly mapped on the property that receives the relationship.
Object of: EntityProxy__CG__\Application\Model\Produto\Produto
./vendor/bin/doctrine-module orm:validate-schema