本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::prependClientTransformer方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::prependClientTransformer方法的具体用法?PHP FormBuilderInterface::prependClientTransformer怎么用?PHP FormBuilderInterface::prependClientTransformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::prependClientTransformer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['multiple']) {
$builder->addEventSubscriber(new MergeCollectionListener($options['model_manager']))->prependClientTransformer(new ModelsToArrayTransformer($options['choice_list']));
} else {
$builder->prependClientTransformer(new ModelToIdTransformer($options['model_manager'], $options['class']));
}
}
示例2: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->prependClientTransformer(new CategoriesCollectionTransformer($options['entityCategoryClass']))->addEventSubscriber(new CategoriesMergeCollectionListener());
$registries = \CategoryRegistryUtil::getRegisteredModuleCategories($options['module'], $options['entity'], 'id');
foreach ($registries as $registryId => $categoryId) {
$builder->add('registry_' . $registryId, 'entity', array('class' => 'ZikulaCategoriesModule:CategoryEntity', 'property' => 'name', 'query_builder' => function (EntityRepository $repo) use($categoryId) {
//TODO: (move to)/use own entity repository after CategoryUtil migration
return $repo->createQueryBuilder('e')->where('e.parent = :parentId')->setParameter('parentId', (int) $categoryId);
}));
}
}
示例3: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$entities = $this->container->getParameter('shtumi.dependent_filtered_entities');
$options['class'] = $entities[$options['entity_alias']]['class'];
$options['property'] = $entities[$options['entity_alias']]['property'];
$options['no_result_msg'] = $entities[$options['entity_alias']]['no_result_msg'];
$builder->prependClientTransformer(new EntityToIdTransformer($this->container->get('doctrine')->getEntityManager(), $options['class']));
$builder->setAttribute("parent_field", $options['parent_field']);
$builder->setAttribute("entity_alias", $options['entity_alias']);
$builder->setAttribute("no_result_msg", $options['no_result_msg']);
$builder->setAttribute("empty_value", $options['empty_value']);
}
示例4: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$entities = $this->container->getParameter('shtumi.autocomplete_entities');
if (null === $options['entity_alias']) {
throw new FormException('You must provide a entity alias "entity_alias" and tune it in config file');
}
if (!isset($entities[$options['entity_alias']])) {
throw new FormException('There are no entity alias "' . $options['entity_alias'] . '" in your config file');
}
$options['class'] = $entities[$options['entity_alias']]['class'];
$options['property'] = $entities[$options['entity_alias']]['property'];
$builder->prependClientTransformer(new EntityToPropertyTransformer($this->container->get('doctrine')->getEntityManager(), $options['class'], $options['property']));
$builder->setAttribute('entity_alias', $options['entity_alias']);
}
示例5: buildForm
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->prependClientTransformer(new ModelToIdTransformer($options['model_manager'], $options['class']));
}
示例6: buildForm
/**
* Builds the form.
*
* @param FormBuilderInterface $builder The form builder
* @param array $options The options
*
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->prependClientTransformer(new EntitiesToStringTransformer($this->registry->getEntityManager()));
}
示例7: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['multiple']) {
$builder->prependClientTransformer(new CollectionToArrayTransformer());
}
}
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(Form\FormBuilderInterface $builder, array $options)
{
$builder->prependClientTransformer($this->dataTransformer)->add('id', 'hidden')->add('name', 'text', array('property_path' => null, 'cascade_validation' => false));
}