-3

This is my ERD

I need help with how to associate the foreign keys with my entities from what i know is that it has to something with this kind of code:

/**
     * @ORM\ManyToOne(targetEntity="Category", inversedBy="products")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */

TL;DR I made entities but now i need to associate the foreign keys (image) but i don't know how.

/**
     * @ORM\ManyToOne(targetEntity="klant", mappedBy="Bestellingorder")
     */
    private $klanten;



/**
 * @ORM\OneToMany(targetEntity="Bestellingorder", inversedBy="klanten")
 * @ORM\JoinColumn(name="Bestellingorder_id", referencedColumnName="id")
 */
private $Bestellingorder;

[Creation Error] The annotation @ORM\ManyToOne declared on property TuinBundle\ Entity\Bestellingorder::$klanten does not have a property named "mappedBy". Ava ilable properties: targetEntity, cascade, fetch, inversedBy

stuck here.

Azhar
  • 1
  • 1
  • 1
    Please read [how do I ask a good question?](http://stackoverflow.com/help/how-to-ask) and update your question accordingly. – gp_sflover Jun 28 '17 at 11:32
  • Yes indeed, it is "something like this kind of code" . What issue did you encountered while using it? – Jakub Matczak Jun 28 '17 at 11:33
  • I can't figure out what to fill in. – Azhar Jun 28 '17 at 11:42
  • Read that document please, you'll see what you need.[Association Mapping](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#many-to-one-unidirectional) . After update schema. – Mert Öksüz Jun 28 '17 at 11:46

1 Answers1

0

Try with that :

/**
 * @ORM\ManyToOne(targetEntity="klant", inversedBy="Bestellingorder")
 * @ORM\JoinColumn(name="klant_id", referencedColumnName="id")
 */
private $klanten;



/**
* @ORM\OneToMany(targetEntity="Bestellingorder", mappedBy="klanten")
*/
private $Bestellingorder;

But i don't understand why you have sometimes "klant" or "klanten", didn't make sense for me. What is the name of your entity ? klant or klanten ?

jpp28
  • 61
  • 1
  • 18
  • Don't worry i fixed it the same day. what i did wrong was that i used the code for the opposite files which made that error. I just had to swap and edit them a bit. But appriciate it. – Azhar Jun 30 '17 at 06:53
  • Ok, fine so ! Put your answer or accept an answer as the best/good one so the subject is registered as solved and can help the other person who will have the same issue – jpp28 Jun 30 '17 at 10:03