Example #1
0
 /**
  * Returns the whole definition in array form
  *
  * @return array Definition
  */
 public function getDefAsArray()
 {
     return ['length' => $this->definition->getLength(), 'title' => $this->definition->getTitle(), 'description' => $this->definition->getDescription(), 'readOnly' => $this->definition->getReadOnly(), 'required' => $this->definition->getRequired(), 'translatable' => $this->definition->getTranslatable(), 'collection' => $this->definition->getCollection(), 'name' => $this->getName(), 'type' => $this->getType(), 'exposedName' => $this->getExposedName(), 'doctrineType' => $this->getTypeDoctrine(), 'serializerType' => $this->getTypeSerializer(), 'xDynamicKey' => $this->getXDynamicKey(), 'relType' => null, 'isClassType' => false, 'constraints' => array_map(function (Schema\Constraint $constraint) {
         return ['name' => $constraint->getName(), 'options' => array_map(function (Schema\ConstraintOption $option) {
             return ['name' => $option->getName(), 'value' => $option->getValue()];
         }, $constraint->getOptions())];
     }, $this->definition->getConstraints())];
 }
 /**
  * @param Schema\Field $field
  * @return array
  */
 protected function getBaseDefAsArray(Schema\Field $field)
 {
     return ['length' => $field->getLength(), 'title' => $field->getTitle(), 'description' => $field->getDescription(), 'readOnly' => $field->getReadOnly(), 'required' => $field->getRequired(), 'translatable' => $field->getTranslatable(), 'collection' => $field->getCollection(), 'xDynamicKey' => null, 'constraints' => array_map(function (Schema\Constraint $constraint) {
         return ['name' => $constraint->getName(), 'options' => array_map(function (Schema\ConstraintOption $option) {
             return ['name' => $option->getName(), 'value' => $option->getValue()];
         }, $constraint->getOptions())];
     }, $field->getConstraints())];
 }