コード例 #1
0
 public function load(ObjectManager $manager)
 {
     $districts = array('Центр', 'Казбет', 'Днепровский', 'Хим. посолек', 'ЮЗР', 'Громова', 'Луна', 'Сосновка', 'Дахновка', 'Школьная');
     for ($i = 0; $i < count($districts); $i++) {
         $district = new District();
         $district->setTitle($districts[$i]);
         $manager->persist($district);
     }
     $manager->flush();
 }
コード例 #2
0
 public function testSubmitValidData()
 {
     $formData = array('title' => 'Test title');
     $form = $this->factory->create(DistrictType::class);
     $object = new District();
     $object->setTitle('Test title');
     $form->submit($formData);
     $this->assertTrue($form->isSynchronized());
     $this->assertEquals($object, $form->getData());
     $view = $form->createView();
     $children = $view->children;
     foreach (array_keys($formData) as $key) {
         $this->assertArrayHasKey($key, $children);
     }
 }
コード例 #3
0
 private function createDeleteForm(District $district)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('admin_district_delete', array('slug' => $district->getSlug())))->setMethod('DELETE')->getForm();
 }