Open paulhagen opened 3 years ago
which attribute are you talking about ?
/** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer", name="id") */ private int $id; /** * @ORM\ManyToOne(targetEntity="Druckerei") * @ORM\JoinColumn(name="druckerei_id", referencedColumnName="id") */ private Druckerei $druckerei; /** * @ORM\ManyToMany(targetEntity="Sujet") * @ORM\JoinTable(name="druckauftraege_sujets", * joinColumns={@ORM\JoinColumn(name="druckauftrag_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="sujet_id", referencedColumnName="id", unique=true)} * ) */ private Collection $sujets; /** * @ORM\ManyToOne(targetEntity="Kontakt") * @JoinColumn(name="kontakt_id", referencedColumnName="id") */ private Kontakt $kontakt; /** * @Column(type="string", nullable=true) */ private ?string $bemerkung;
The attribute $kontakt
is causing the issue.
I'm sorry about there isn't anything in your post which would indicate this would be a problem in doctrine-bundle. Moving to ORM.
@paulhagen it looks like you're using the cached annotation reader. Which cache driver you have configured? Have you tried to clean it up?
Also, you sometimes use the ORM
namespace on the annotation and sometimes don't. I suggest you to make it consistent:
/**
* @ORM\ManyToOne(targetEntity="Kontakt")
- * @JoinColumn(name="kontakt_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="kontakt_id", referencedColumnName="id")
*/
private Kontakt $kontakt;
I ran into this issue while trying to create a migration from an entity. The attribute causing the error (a Many-To-One, Unidirectional) on doctrine:schema:validate
The error
The exception
The mapping for itself is correctly. If I remove the attribute with the annotation and run do:sc:va doctrine say
[OK] The mapping files are correct.
If I undo the deletion and then invoke the command again the same message comes up. If I repeat this procedure again, the above error occurs again.
I can now reproduce the error as often as I want in this way.