I have these entities
/** @ORM\Entity */
class Produto {
/* Other attributes */
/**
* @ORM\ManyToOne(targetEntity="Produto\Entity\Categoria")
* @ORM\JoinColumn(name="categoria_id", referencedColumnName="id")
*/
private $categoria;
public function getCategoria() {
return $this->categoria;
}
public function setCategoria(Categoria $categoria) {
$this->categoria = $categoria;
}
}
and
/** @ORM\Entity */
class Categoria {
/* Other attributes */
/** @ORM\Column(type="string") */
private $nome;
}
but when I call the method findAll
the $categoria
attribute category is always null
, what am I doing wrong?
I tried adding the OneToMany annotation on the entity categoria, but it did not work well, there is somewhere that explains why this happens? I found nothing in the documentation