Esempio n. 1
0
 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('data_class' => 'Gestion\\ArticlesBundle\\Entity\\Taxes', 'empty_data' => function (FormInterface $form) {
         //$nom
         $taxe = new Taxes($form->get('nom')->getData(), $form->get('taux')->getData());
         $taxe->setDefault(false);
         return $taxe;
     }));
 }
Esempio n. 2
0
 public function load(ObjectManager $manager)
 {
     $topersist = array();
     $t1 = new Taxes("Taxe20", 20);
     $t1->setDefault(true);
     array_push($topersist, $t1);
     //creation categorie produits
     $catHomme = new Categories("Homme");
     $catFemme = new Categories("Femme");
     $catEnfant = new Categories("Enfant et Ado");
     $catProduit = new Categories("Produit");
     array_push($topersist, $catHomme, $catFemme, $catEnfant, $catProduit);
     //creation moyens paiement
     $espece = new MoyensPaiement("Espece");
     $espece->setNom("Espece");
     $cb = new MoyensPaiement("CarteBleue");
     $cheque = new MoyensPaiement("Cheque");
     array_push($topersist, $espece, $cheque, $cb);
     foreach ($topersist as $value) {
         $manager->persist($value);
         $this->addReference($value->getNom(), $value);
     }
     $manager->flush();
 }