Esempio n. 1
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('template', 'delete');
     $resolver->setDefault('pattern', function (Options $options) {
         return $options['rest_route'] ? '.{_format}' : '/list.{_format}';
     });
     $resolver->setDefault('defaults', function (Options $options) {
         $format = $options['rest_route'] ? 'json' : 'html';
         return ['_format' => $format];
     });
     $resolver->setDefault('methods', function (Options $options, array $previousValue) {
         return $options['rest_route'] ? ['GET'] : $previousValue;
     });
 }
Esempio n. 2
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('template', 'delete');
     $resolver->setDefault('requirements', ['id' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         return $options['rest_route'] ? '/{id}.{_format}' : '/delete/{id}.{_format}';
     });
     $resolver->setDefault('defaults', function (Options $options) {
         $format = $options['rest_route'] ? 'json' : 'html';
         return ['_format' => $format];
     });
     $resolver->setDefault('methods', function (Options $options, array $previousValue) {
         return $options['rest_route'] ? ['DELETE'] : $previousValue;
     });
 }
Esempio n. 3
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('requirements', ['id' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         if ($options['rest_route']) {
             return '/{id}';
         }
         return '/delete/{id}';
     });
     $resolver->setDefault('methods', function (Options $options, $previousValue) {
         if ($options['rest_route']) {
             return ['DELETE'];
         }
         return $previousValue;
     });
 }
Esempio n. 4
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('template', 'show');
     $resolver->setDefault('requirements', ['id' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         return $options['rest_route'] ? '/{id}.{_format}' : '/show/{id}.{_format}';
     });
     $resolver->setDefault('defaults', function (Options $options) {
         $format = $options['rest_route'] ? 'json' : 'html';
         return ['_format' => $format];
     });
     $resolver->setDefault('methods', function (Options $options, array $previousValue) {
         return $options['rest_route'] ? ['GET'] : $previousValue;
     });
     $resolver->setDefault('toArray', false);
     $resolver->addAllowedTypes('toArray', 'bool');
 }
Esempio n. 5
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('defaults', ['page' => 1, 'limit' => 1, 'column' => null, 'sort' => null]);
     $resolver->setDefault('requirements', ['page' => '\\d+', 'limit' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         if ($options['rest_route']) {
             return '/';
         }
         return '/list/{page}/{limit}/{column}/{sort}';
     });
     $resolver->setDefault('methods', function (Options $options, $previousValue) {
         if ($options['rest_route']) {
             return ['GET'];
         }
         return $previousValue;
     });
 }
Esempio n. 6
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->remove('template');
     $resolver->setDefault('allow', []);
     $resolver->setAllowedTypes('allow', 'array');
     $resolver->setDefault('requirements', ['id' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         return $options['rest_route'] ? '/{id}.{_format}' : '/update/{id}.{_format}';
     });
     $resolver->setDefault('defaults', function (Options $options) {
         $format = $options['rest_route'] ? 'json' : 'html';
         return ['_format' => $format];
     });
     $resolver->setDefault('methods', function (Options $options, array $previousValue) {
         return $options['rest_route'] ? ['PATCH'] : $previousValue;
     });
     $resolver->setDefault('parameters', [['name' => 'data', 'dataType' => 'json', "required" => true, 'description' => 'Array of properties to change']]);
 }
Esempio n. 7
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('requirements', ['id' => '\\d+']);
     $resolver->setDefault('pattern', function (Options $options) {
         if ($options['rest_route']) {
             return '/{id}';
         }
         return '/show/{id}';
     });
     $resolver->setDefault('methods', function (Options $options, $previousValue) {
         if ($options['rest_route']) {
             return ['GET'];
         }
         return $previousValue;
     });
     $resolver->setDefault('toArray', false);
     $resolver->addAllowedTypes(['toArray' => 'bool']);
 }
Esempio n. 8
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->remove('template');
     $resolver->setDefault('pattern', '/export/{type}/{id}');
     $resolver->setDefault('methods', function (Options $options, array $previousValue) {
         if ($options['rest_route']) {
             return ['GET'];
         }
         return $previousValue;
     });
     $resolver->setDefault('requirements', ['type' => 'pdf|csv', 'id' => '\\d+']);
     $resolver->setDefault('defaults', ["type" => 'pdf', "id" => null]);
 }
Esempio n. 9
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('template', 'edit');
 }
Esempio n. 10
0
 /**
  * @inheritDoc
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('pattern', '/export/{type}/{id}');
     $resolver->setDefault('requirements', ['type' => 'pdf|csv']);
     $resolver->setDefault('defaults', ["type" => 'pdf', "id" => null]);
 }