Created
April 14, 2015 18:17
-
-
Save gmarquet/2079d7790bf6f5f2fe10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Formation | |
{ | |
... | |
/** | |
* @Serializer\Exclude | |
* @ORM\OneToMany(targetEntity="FormationRequired", mappedBy="receiver" , cascade={"persist", "remove"} , orphanRemoval=true) | |
*/ | |
private $formationRequireds; | |
/** | |
* Add formationRequireds | |
* | |
* @param \CIV\ApiBundle\Entity\FormationRequired $formationRequireds | |
* @return Formation | |
*/ | |
public function addFormationRequired(\CIV\ApiBundle\Entity\FormationRequired $formationRequireds) | |
{ | |
$this->formationRequireds[] = $formationRequireds; | |
$formationRequireds->setReceiver($this); | |
var_dump('addFormationRequired'); | |
return $this; | |
} | |
} | |
class FormationType extends AbstractType | |
{ | |
/** | |
* @param FormBuilderInterface $builder | |
* @param array $options | |
*/ | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
$builder | |
->add('formationRequireds', 'entity', array( | |
'class' => 'Bundle:FormationRequired', | |
'property' => 'id', | |
'multiple' => true, | |
'query_builder' => function(EntityRepository $er) { | |
return $er->createQueryBuilder('u')->orderBy('u.id', 'ASC'); | |
} | |
)) | |
; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment