The association ProjectBundle\Entity\Contact#departments refers to the inverse side field ProjectBundle\Entity\Departments#Contact which does not exist.
The association ProjectBundle\Entity\Departments#contact refers to the owning side field ProjectBundle\Entity\Contact#Departments which does not exist.
Подскажите пожалуйста в чем может быть проблема.
Вот код:
namespace ProjectBundle\Entity;
/**
* Contact
*/
class Contact
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $phone;
/**
* @var string
*/
private $lastname;
/**
* @var string
*/
private $email;
/**
* @var int
*/
private $departmentId;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set phone
*
* @param string $phone
*
* @return Contact
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set lastname
*
* @param string $lastname
*
* @return Contact
*/
public function setLastname($lastname)
{
$this->lastname = $lastname;
return $this;
}
/**
* Get lastname
*
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* Set email
*
* @param string $email
*
* @return Contact
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set departmentId
*
* @param integer $departmentId
*
* @return Contact
*/
public function setDepartmentId($departmentId)
{
$this->departmentId = $departmentId;
return $this;
}
/**
* Get departmentId
*
* @return integer
*/
public function getDepartmentId()
{
return $this->departmentId;
}
/**
* @var \ProjectBundle\Entity\Departments
*/
/**
* @var \ProjectBundle\Entity\Departments
*/
private $departments;
/**
* Set departments
*
* @param \ProjectBundle\Entity\Departments $departments
*
* @return Contact
*/
public function setDepartments(\ProjectBundle\Entity\Departments $departments = null)
{
$this->departments = $departments;
return $this;
}
/**
* Get departments
*
* @return \ProjectBundle\Entity\Departments
*/
public function getDepartments()
{
return $this->departments;
}
}
ProjectBundle\Entity\Contact:
type: entity
table: null
repositoryClass: ProjectBundle\Repository\ContactRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
phone:
type: string
length: 255
lastname:
type: string
length: 255
email:
type: string
length: 255
manyToOne:
departments:
targetEntity: Departments
inversedBy: Contact
joinColumn:
name: department_id
referencedColumnName: id
lifecycleCallbacks: { }
namespace ProjectBundle\Entity;
/**
* Departments
*/
class Departments
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $name;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Departments
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @var \Doctrine\Common\Collections\Collection
*/
private $products;
/**
* Constructor
*/
public function __construct()
{
$this->products = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add product
*
* @param \ProjectBundle\Entity\Contact $product
*
* @return Departments
*/
public function addProduct(\ProjectBundle\Entity\Contact $product)
{
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \ProjectBundle\Entity\Contact $product
*/
public function removeProduct(\ProjectBundle\Entity\Contact $product)
{
$this->products->removeElement($product);
}
/**
* Get products
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProducts()
{
return $this->products;
}
/**
* @var \Doctrine\Common\Collections\Collection
*/
private $contact;
/**
* Add contact
*
* @param \ProjectBundle\Entity\Contact $contact
*
* @return Departments
*/
public function addContact(\ProjectBundle\Entity\Contact $contact)
{
$this->contact[] = $contact;
return $this;
}
/**
* Remove contact
*
* @param \ProjectBundle\Entity\Contact $contact
*/
public function removeContact(\ProjectBundle\Entity\Contact $contact)
{
$this->contact->removeElement($contact);
}
/**
* Get contact
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getContact()
{
return $this->contact;
}
}
ProjectBundle\Entity\Departments:
type: entity
table: null
repositoryClass: ProjectBundle\Repository\DepartmentsRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
oneToMany:
contact:
targetEntity: Contact
mappedBy: Departments
lifecycleCallbacks: { }