Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Usuario implements UserInterface, \Serializable
- {
- /**
- * @ORM\Column(nullable=true)
- * @ORM\OneToMany(targetEntity="xxx\UsuarioBundle\Entity\LogroUsuario", mappedBy="usuario")
- */
- private $logros;
- public function __construct()
- {
- $this->logros = new \Doctrine\Common\Collections\ArrayCollection();
- }
- }
- class LogroUsuario
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="fecha_conseguido", type="datetime")
- */
- private $fecha_conseguido;
- /**
- *
- * @ORM\ManyToOne(targetEntity="xxx\UsuarioBundle\Entity\Usuario", inversedBy="logros")
- * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id")
- *
- */
- private $usuario;
- /**
- *
- * @ORM\ManyToOne(targetEntity="Logro")
- * @ORM\JoinColumn(name="logro_id", referencedColumnName="id")
- */
- private $logro;
- }
- class UsuarioAdmin extends Admin
- {
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->add('logros', 'entity', array(
- 'class' => 'UsuarioBundle:Logro',
- 'property' => 'nombre',
- 'multiple' => true,
- 'required' => false,))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement