Have you looked into redbeanphp?
On Wed, Jul 10, 2013 at 7:36 PM, Aaron Luman <[email protected]> wrote: > I posted this on stack overflow but figure some of you php pros might have > some good insights on my mystery error: > > > http://stackoverflow.com/questions/17583237/doctrine-onetomany-relationship-error > > I am trying to set up some ManyToOne/OneToMany relationships on objects in > my database using Doctrine (2.2.3+) via Symfony2 (2.3.0) and am getting a > strange error. Here are the relevant parts of the objects (many attributes > to one product): > > /** > * 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; > } > > When I run the > > php app/console doctrine:generate:entities BundleName > command I get the following 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? > > I have looked through the Doctrine docs and don't see any reference to a > "use" statement for the ManyToOne/OneToMany pairings. What is going on? > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > -- -- -- Matthew Frederico _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
