I have two classes, the User class and the Functionality class, that relate to manytomany in symfony but when I run doctrine: schema: update --force does not generate the data base of the relationship here my code
User Entity:
namespace SIPACBundle \ Entity;
use Doctrine \ ORM \ Mapping as ORM; use Symfony \ Component \ Security \ Core \ User \ UserInterface; use Doctrine \ Common \ Collections \ ArrayCollection;
/ ** * User * / class User implements UserInterface { // ...
/**
* Many Usuarios have Many Funcionalidades.
* @ORM\ManyToMany(targetEntity="Funcionalidad", inversedBy="usuarios")
* @ORM\JoinTable(name="usuarios_funcionalidades")
*/
private $funcionalidades;
public function __construct() {
$this->funcionalidades = new \Doctrine\Common\Collections\ArrayCollection();
}
// ...
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $username;
/**
* @var string
*/
private $password;
/**
* @var bool
*/
private $email;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set username
*
* @param string $username
* @return Usuario
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
/**
* Set password
*
* @param string $password
* @return Usuario
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Set email
*
* @param boolean $email
* @return Usuario
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return boolean
*/
public function getEmail()
{
return $this->email;
}
//Implementacion de la interfaz de roles
public function equals(UserInterface $users){
return $this->getEmail()==$users->getUsername();
}
public function eraseCredentials() {
return false;
}
public function getRoles() {
//return array("ROLE_USUARIO");
return array(
'ROLE_USER',
// ...
new UserDependentRole($this) // ROLE dinámico
);
}
public function getUsername() {
return $this->getEmail();
}
public function getSalt() {
return false;
}
}
Entity Functionality:
namespace SIPACBundle \ Entity;
use Doctrine \ ORM \ Mapping as ORM; use Doctrine \ Common \ Collections \ ArrayCollection; / ** * Functionality * / class Functionality { // ... / ** * Many Functions have Many Users. * @ORM \ ManyToMany (targetEntity="User", mappedBy="functionalities") * /
private $usuarios;
public function __construct() {
$this->usarios = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $nombre;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nombre
*
* @param string $nombre
* @return Funcionalidad
*/
public function setNombre($nombre)
{
$this->nombre = $nombre;
return $this;
}
/**
* Get nombre
*
* @return string
*/
public function getNombre()
{
return $this->nombre;
}
} I hope you help me