コード例 #1
0
ファイル: loadCategoryData.php プロジェクト: hakim95/storeApi
 public function load(ObjectManager $manager)
 {
     $category = new Category();
     $category->setCategoryName('Television');
     $manager->persist($category);
     $category2 = new Category();
     $category2->setCategoryName('Ordinateur');
     $manager->persist($category2);
     $category3 = new Category();
     $category3->setCategoryName('Appareil Photo');
     $manager->persist($category3);
     $category4 = new Category();
     $category4->setCategoryName('Imprimante');
     $manager->persist($category4);
     $category5 = new Category();
     $category5->setCategoryName('Console');
     $manager->persist($category5);
     $category6 = new Category();
     $category6->setCategoryName('Telephone');
     $manager->persist($category6);
     $manager->flush();
 }
コード例 #2
0
 /**
  * Creates a form to delete a Category entity.
  *
  * @param Category $category The Category entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Category $category)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('category_delete', array('id' => $category->getId())))->setMethod('DELETE')->getForm();
 }