Doctrine OneToMany error de relación
Estoy tratando de configurar algunas relaciones ManyToOne / OneToMany en objetos en mi base de datos utilizando Doctrine (2.2.3+) a través de Symfony2 (2.3.0) y me está dando un error extraño. Aquí están las partes relevantes de los objetos (muchos atributos para un producto):
/**
* Product
*
* @ORM\Table(name="product")
* @ORM\Entity
*/
class Product
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
...
/**
*
* @OneToMany(targetEntity="ProductAttributes", mappedBy="product")
*/
protected $product_attributes;
public function __construct() {
$this->product_attributes = new \Doctrine\Common\Collections\ArrayCollection();
}
}
/**
* ProductAttributes
*
* @ORM\Table(name="product_attributes")
* @ORM\Entity
*/
class ProductAttributes
{
/**
* @var integer
*
* @ORM\Column(name="pa_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $pa_id;
/**
* @var integer
*
* @ORM\Column(name="product_id", type="integer")
*/
protected $product_id;
...
/**
*
* @ManyToOne(targetEntity="Product", inversedBy="product_attributes")
* @JoinColumn(name="product_id", referencedColumnName="id")
*/
protected $product;
}
Cuando corro el
php app/console doctrine:generate:entities BundleName
comando me sale el siguiente error:
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@OneToMany" in property LVMount\LVMBundle\Entity\Product::$product_attributes was never imported. Did you maybe forget to add a "use" statement for this annotation?
He revisado los documentos de Doctrine y no veo ninguna referencia a una declaración de "uso" para los emparejamientos ManyToOne / OneToMany. Que esta pasando?