private function addPropertyMetadatas(FormBuilderInterface $builder, array $propertyMetadatas)
 {
     foreach ($propertyMetadatas as $propertyMetadata) {
         $field = $this->fieldRegistry->get($propertyMetadata->getType());
         $builder->add($propertyMetadata->getName(), $field->getFormType(), $this->getFormOptions($field, $propertyMetadata));
     }
 }
Beispiel #2
0
 private function loadPsiContentType()
 {
     $this['psi_content_type.metadata.driver.array'] = function ($container) {
         return new ArrayDriver($container['config']['mapping']);
     };
     $this['psi_content_type.metadata.driver.annotation'] = function ($container) {
         return new CTAnnotationDriver($container['annotation_reader']);
     };
     $this['psi_content_type.metadata.driver.chain'] = function ($container) {
         return new DriverChain([$container['psi_content_type.metadata.driver.array'], $container['psi_content_type.metadata.driver.annotation']]);
     };
     $this['psi_content_type.metadata.factory'] = function ($container) {
         return new MetadataFactory($container['psi_content_type.metadata.driver.chain']);
     };
     $this['psi_content_type.registry.field'] = function ($container) {
         $registry = new FieldRegistry();
         $registry->register('birthday', new Field\BirthdayField());
         $registry->register('checkbox', new Field\CheckboxField());
         $registry->register('currency', new Field\CurrencyField());
         $registry->register('language', new Field\LanguageField());
         $registry->register('locale', new Field\LocaleField());
         $registry->register('money', new Field\MoneyField());
         $registry->register('number', new Field\NumberField());
         $registry->register('percent', new Field\PercentField());
         $registry->register('range', new Field\RangeField());
         $registry->register('textarea', new Field\TextareaField());
         $registry->register('time', new Field\TimeField());
         $registry->register('timezone', new Field\TimezoneField());
         $registry->register('url', new Field\UrlField());
         $registry->register('email', new Field\EmailField());
         $registry->register('date', new Field\DateField());
         $registry->register('country', new Field\CountryField());
         $registry->register('text', new Field\TextField());
         $registry->register('integer', new Field\IntegerField());
         $registry->register('datetime', new Field\DateTimeField());
         $registry->register('image', new ImageField());
         $registry->register('object_reference', new ObjectReferenceField());
         $registry->register('collection', new Field\CollectionField($registry));
         $registry->register('choice', new Field\ChoiceField($registry));
         return $registry;
     };
     $this['psi_content_type.registry.type'] = function ($container) {
         $registry = new Storage\TypeRegistry();
         $registry->register(StdStorage\StringType::class, new StdStorage\StringType());
         $registry->register(StdStorage\IntegerType::class, new StdStorage\IntegerType());
         $registry->register(StdStorage\DateTimeType::class, new StdStorage\DateTimeType());
         $registry->register(StdStorage\ReferenceType::class, new StdStorage\ReferenceType());
         $registry->register(StdStorage\ObjectType::class, new StdStorage\ObjectType());
         $registry->register(StdStorage\BooleanType::class, new StdStorage\BooleanType());
         $registry->register(StdStorage\DoubleType::class, new StdStorage\DoubleType());
         $registry->register(StdStorage\CollectionType::class, new StdStorage\CollectionType());
         return $registry;
     };
     $this['psi_content_type.field_loader'] = function ($container) {
         return new FieldLoader($container->get('psi_content_type.registry.field'));
     };
     $this['psi_content_type.storage.type_factory'] = function ($container) {
         return new Storage\TypeFactory($container->get('psi_content_type.registry.type'));
     };
 }