Answer the question
In order to leave comments, you need to log in
Why does doctrine refer to a non-existent column?
I have essence
class ProxyExchange
{
/**
* @ORM\Id()
* @ORM\Column(name="id", type="guid")
* @ORM\GeneratedValue(strategy="UUID")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\ProxyServer", inversedBy="ip")
*/
private $proxy;
class ProxyServer
{
/**
* @ORM\Id()
* @ORM\Column(type="string", length=15, options={"comment":"IPv4 proxy servers"})
*/
private $ip;
/**
* @ORM\Column(type="integer", options={"comment":"Server port"})
*/
private $port;
/**
* @ORM\Column(type="boolean", options={"default" : 1, "comment":"Status 1-on 0-off"})
*/
private $active;
@ORM\ManyToMany(targetEntity="App\Entity\ProxyServer", inversedBy="ip")
Column name `id` referenced for relation from App\Entity\ProxyExchange towards App\Entity\ProxyServer does not exist.
Answer the question
In order to leave comments, you need to log in
Because ManyToMany must be accompanied by the JoinTable annotation.
If you do not specify it, then doctrine will add it for you with default values, and these are the id fields in one and the other entity. So he doesn't find them.
PS And inversedBy="ip" should refer to ManyToMany field with mappedBy property. In this case, you need to remove it, because. you have a unidirectional connection.
docs .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question