Пример #1
0
 /**
  * Creates a form to delete a Serial entity.
  *
  * @param Serial $serial The Serial entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Serial $serial)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('admin_serial_delete', array('id' => $serial->getId())))->setMethod('DELETE')->getForm();
 }
Пример #2
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $date = new \DateTime();
     $serial = new Serial();
     $builder->add('title')->add('description')->add('image', 'comur_image', ['required' => true, 'uploadConfig' => array('uploadRoute' => 'comur_api_upload', 'uploadUrl' => $serial->getUploadRootDir(), 'webDir' => $serial->getUploadDir(), 'fileExt' => '*.jpg;*.gif;*.png;*.jpeg', 'libraryDir' => null, 'libraryRoute' => 'comur_api_image_library', 'showLibrary' => true, 'saveOriginal' => 'originalImage'), 'cropConfig' => array('minWidth' => 400, 'minHeight' => 500, 'aspectRatio' => true, 'cropRoute' => 'comur_api_crop', 'forceResize' => false, 'thumbs' => array(array('maxWidth' => 100, 'maxHeight' => 100, 'useAsFieldImage' => true)))])->add('country')->add('producer')->add('cast')->add('dateStart', null, ['data' => $date->format("Y"), 'attr' => ['min' => 1900]])->add('dateEnd', null, ['required' => false, 'attr' => ['min' => 1900]])->add('seasons', 'collection', ['allow_add' => true, 'allow_delete' => true, 'type' => new SeasonType(), 'by_reference' => false, 'prototype' => true, 'prototype_name' => '__name__', 'attr' => ['help-block' => 'Add new season']]);
 }