예제 #1
0
 public function getFormOptions()
 {
     $options = parent::getFormOptions();
     if (0) {
         $writer = new \Symforce\AdminBundle\Compiler\Generator\PhpWriter();
         $writer->writeln('new \\Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword(array(')->indent()->outdent()->writeln('))');
         $options['constraints'][] = $this->compilePhpCode($writer->getContent());
         if (null !== $this->repeat) {
             $options['type'] = 'password';
             //$options['invalid_message']    =  'The password fields must match.',
             $options['first_options'] = array('label' => $_options['label'], 'required' => $_options['required']);
             $options['second_options'] = array('label_render' => false, 'required' => $_options['required']);
         }
     }
     if (!property_exists($this->admin_object->class_name, $this->salt)) {
         $this->throwError("salt property(%s), not exist in class(%s)", $this->salt, $this->admin_object->class_name);
     }
     if (!property_exists($this->admin_object->class_name, $this->real_password)) {
         $this->throwError("real_password property(%s), not exist in class(%s)", $this->real_password, $this->admin_object->class_name);
     }
     if ($this->class_property === $this->real_password) {
         $this->throwError("real_password property(%s) can not be it self, class(%s)", $this->real_password, $this->admin_object->class_name);
     }
     if ($this->class_property === $this->salt) {
         $this->throwError("salt property(%s) can not be it self, class(%s)", $this->salt, $this->admin_object->class_name);
     }
     $options['salt_property'] = $this->salt;
     $options['password_property'] = $this->real_password;
     $options['required'] = $this->compilePhpCode('$action->isCreateAction()');
     return $options;
 }
예제 #2
0
 public function getFormOptions()
 {
     $options = parent::getFormOptions();
     $writer = new \Symforce\AdminBundle\Compiler\Generator\PhpWriter();
     $writer->writeln('new \\Symfony\\Component\\Validator\\Constraints\\Email(array(')->indent()->writeln('"checkMX" => false , ')->outdent()->writeln('))');
     $options['constraints'][] = $this->compilePhpCode($writer->getContent());
     return $options;
 }
예제 #3
0
 public function getFormOptions()
 {
     $options = parent::getFormOptions();
     if (null !== $this->max_length || null !== $this->max_length) {
         $max = $this->max_length ?: 0xff;
         $min = $this->min_length ?: 0;
         $writer = new \Symforce\AdminBundle\Compiler\Generator\PhpWriter();
         $writer->writeln('new \\Symfony\\Component\\Validator\\Constraints\\Url(array(')->indent()->outdent()->writeln('))');
         $options['constraints'][] = $this->compilePhpCode($writer->getContent());
     }
     return $options;
 }
예제 #4
0
 public function getFormOptions()
 {
     $_option = $this->admin_object->orm_metadata->fieldMappings[$this->class_property];
     if (isset($_option['length'])) {
         if ($this->max_length > $_option['length']) {
             $this->max_length = $_option['length'];
         }
     }
     $options = parent::getFormOptions();
     $options['attr']['rows'] = $this->hetigh;
     return $options;
 }