[Form] Reorganized code into "form extensions"

The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.

    new FormFactory(array(
        new CoreExtension($validator, $storage),
        new CsrfExtension($csrfProvider),
        new DoctrineOrmExtension($em),
    ));

Together with a few upcoming commits this mechanism will make

 * extension of the form framework in bundles and
 * usage of the forms outside of Symfony2

much easier.
This commit is contained in:
Bernhard Schussek 2011-04-22 17:41:21 +02:00
parent a97366fbcb
commit 54e66c518f
162 changed files with 997 additions and 815 deletions

View File

@ -14,7 +14,7 @@ namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
use Symfony\Component\Form\Util\PropertyPath;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\ArrayChoiceList;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\NoResultException;

View File

@ -13,8 +13,8 @@ namespace Symfony\Bridge\Doctrine\Form\DataTransformer;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\DataTransformer\TransformationFailedException;
use Symfony\Component\Form\DataTransformer\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\DataTransformerInterface;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;

View File

@ -12,9 +12,9 @@
namespace Symfony\Bridge\Doctrine\Form\DataTransformer;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\DataTransformer\DataTransformerInterface;
use Symfony\Component\Form\DataTransformer\TransformationFailedException;
use Symfony\Component\Form\Exception\TransformationFailedException;
class EntityToIdTransformer implements DataTransformerInterface
{

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form;
use Symfony\Component\Form\AbstractExtension;
use Doctrine\ORM\EntityManager;
class DoctrineOrmExtension extends AbstractExtension
{
/**
* The Doctrine 2 entity manager
* @var Doctrine\ORM\EntityManager
*/
protected $em = null;
public function __construct(EntityManager $em)
{
$this->em = $em;
}
protected function loadTypes()
{
return array(
new Type\EntityType($this->em),
);
}
protected function loadTypeGuesser()
{
return new DoctrineOrmTypeGuesser($this->em);
}
}

View File

@ -3,26 +3,21 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form\Type\Guesser;
namespace Symfony\Bridge\Doctrine\Form;
use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\Type\Guesser\Guess;
use Symfony\Component\Form\Type\Guesser\TypeGuesserInterface;
use Symfony\Component\Form\Type\Guesser\TypeGuess;
use Symfony\Component\Form\Type\Guesser\ValueGuess;
/**
* Guesses form fields from the metadata of Doctrine 2
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
class EntityTypeGuesser implements TypeGuesserInterface
class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
{
/**
* The Doctrine 2 entity manager
@ -30,11 +25,6 @@ class EntityTypeGuesser implements TypeGuesserInterface
*/
protected $em = null;
/**
* Constructor
*
* @param ClassMetadataFactoryInterface $metadataFactory
*/
public function __construct(EntityManager $em)
{
$this->em = $em;
@ -190,4 +180,4 @@ class EntityTypeGuesser implements TypeGuesserInterface
}
}
}
}
}

View File

@ -1,38 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form;
use Symfony\Component\Form\Type\Loader\TypeLoaderInterface;
use Doctrine\ORM\EntityManager;
class DoctrineTypeLoader implements TypeLoaderInterface
{
private $types;
public function __construct(EntityManager $em)
{
$this->types['entity'] = new EntityType($em);
}
public function getType($name)
{
return $this->types[$name];
}
public function hasType($name)
{
return isset($this->types[$name]);
}
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form;
namespace Symfony\Bridge\Doctrine\Form\Type;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactoryInterface;
@ -17,7 +17,7 @@ use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
use Symfony\Bridge\Doctrine\Form\EventListener\MergeCollectionListener;
use Symfony\Bridge\Doctrine\Form\DataTransformer\EntitiesToArrayTransformer;
use Symfony\Bridge\Doctrine\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\Type\AbstractType;
use Symfony\Component\Form\AbstractType;
use Doctrine\ORM\EntityManager;
class EntityType extends AbstractType

View File

@ -38,7 +38,7 @@
<parameter key="doctrine.orm.proxy_cache_warmer.class">Symfony\Bundle\DoctrineBundle\CacheWarmer\ProxyCacheWarmer</parameter>
<!-- form field factory guesser -->
<parameter key="form.guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\Type\Guesser\EntityTypeGuesser</parameter>
<parameter key="form.type_guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser</parameter>
</parameters>
<services>
@ -55,12 +55,12 @@
<argument type="service" id="service_container" />
</service>
<service id="form.guesser.doctrine" class="%form.guesser.doctrine.class%" public="false">
<tag name="form.guesser" />
<service id="form.type_guesser.doctrine" class="%form.type_guesser.doctrine.class%">
<tag name="form.type_guesser" />
<argument type="service" id="doctrine.orm.entity_manager" />
</service>
<service id="form.type.entity" class="Symfony\Bridge\Doctrine\Form\EntityType">
<service id="form.type.entity" class="Symfony\Bridge\Doctrine\Form\Type\EntityType">
<tag name="form.type" alias="entity" />
<argument type="service" id="doctrine.orm.entity_manager" />
</service>

View File

@ -1,40 +0,0 @@
<?php
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
/**
* Adds all services with the tag "form.guesser" as constructor argument of the
* "form.factory" service
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
class AddFormGuessersPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('form.factory')) {
return;
}
$guessers = array();
foreach ($container->findTaggedServiceIds('form.guesser') as $serviceId => $tag) {
$guessers[] = new Reference($serviceId);
}
$container->getDefinition('form.factory')->replaceArgument(1, $guessers);
}
}

View File

@ -15,32 +15,36 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Adds all services with the tag "form.type" as argument
* to the "form.type.loader" service
* Adds all services with the tags "form.type" and "form.type_guesser" as
* arguments of the "form.extension" service
*
* @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
*/
class AddFormTypesPass implements CompilerPassInterface
class FormPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('form.type.loader')) {
if (!$container->hasDefinition('form.extension')) {
return;
}
// Builds an array with service IDs as keys and tag aliases as values
$types = array();
$tags = $container->findTaggedServiceIds('form.type');
foreach ($tags as $serviceId => $arguments) {
$alias = isset($arguments[0]['alias'])
? $arguments[0]['alias']
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
$alias = isset($tag[0]['alias'])
? $tag[0]['alias']
: $serviceId;
// Flip, because we want tag aliases (= type identifiers) as keys
$types[$alias] = $serviceId;
}
$container->getDefinition('form.type.loader')->replaceArgument(1, $types);
$container->getDefinition('form.extension')->replaceArgument(1, $types);
// Find all services annotated with "form.type_guesser"
$guessers = array_keys($container->findTaggedServiceIds('form.type_guesser'));
$container->getDefinition('form.extension')->replaceArgument(2, $guessers);
}
}

View File

@ -11,32 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Form;
use Symfony\Component\Form\Type\Loader\TypeLoaderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ContainerAwareTypeLoader implements TypeLoaderInterface
{
private $container;
private $serviceIds;
public function __construct(ContainerInterface $container, array $serviceIds)
{
$this->container = $container;
$this->serviceIds = $serviceIds;
}
public function getType($identifier)
{
if (!isset($this->serviceIds[$identifier])) {
throw new \InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $identifier));
}
return $this->container->get($this->serviceIds[$identifier]);
}
public function hasType($identifier)
{
return isset($this->serviceIds[$identifier]);
}
}

View File

@ -12,8 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddFormTypesPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddFormGuessersPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass;
@ -78,8 +77,7 @@ class FrameworkBundle extends Bundle
$container->addCompilerPass(new RegisterKernelListenersPass());
$container->addCompilerPass(new TemplatingPass());
$container->addCompilerPass(new AddConstraintValidatorsPass());
$container->addCompilerPass(new AddFormTypesPass());
$container->addCompilerPass(new AddFormGuessersPass());
$container->addCompilerPass(new FormPass());
$container->addCompilerPass(new AddClassesToCachePass());
$container->addCompilerPass(new AddClassesToAutoloadMapPass());
$container->addCompilerPass(new TranslatorPass());

View File

@ -5,10 +5,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="form.extension.class">Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension</parameter>
<parameter key="form.factory.class">Symfony\Component\Form\FormFactory</parameter>
<parameter key="form.type.loader.class">Symfony\Bundle\FrameworkBundle\Form\ContainerAwareTypeLoader</parameter>
<parameter key="form.guesser.validator.class">Symfony\Component\Form\Type\Guesser\ValidatorTypeGuesser</parameter>
<parameter key="form.csrf_provider.class">Symfony\Component\Form\CsrfProvider\SessionCsrfProvider</parameter>
<parameter key="form.type_guesser.validator.class">Symfony\Component\Form\Extension\Core\CoreTypeGuesser</parameter>
<parameter key="form.csrf_provider.class">Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider</parameter>
<parameter key="form.csrf_protection.enabled">true</parameter>
<parameter key="form.csrf_protection.field_name">_token</parameter>
<parameter key="form.csrf_protection.secret">secret</parameter>
@ -23,17 +23,34 @@
<!-- FormFactory -->
<service id="form.factory" class="%form.factory.class%">
<argument type="service" id="form.type.loader" />
<argument type="collection">
<!--
We don't need to be able to add more extensions.
* more types can be registered with the form.type tag
* more type_guessers can be registered with the form.type.type_guesser tag
-->
<argument type="service" id="form.extension" />
</argument>
</service>
<!-- DependencyInjectionExtension -->
<service id="form.extension" class="%form.extension.class%" public="false">
<argument type="service" id="service_container" />
<!--
All services with tag "form.guesser" are inserted here by
AddFormGuessersPass
All services with tag "form.type" are inserted here by
InitFormsPass
-->
<argument type="collection" />
<!--
All services with tag "form.type_guesser" are inserted here by
InitFormsPass
-->
<argument type="collection" />
</service>
<!-- ValidatorTypeGuesser -->
<service id="form.guesser.validator" class="%form.guesser.validator.class%" public="false">
<tag name="form.guesser" />
<service id="form.type_guesser.validator" class="%form.type_guesser.validator.class%">
<tag name="form.type_guesser" />
<argument type="service" id="validator.mapping.class_metadata_factory" />
</service>
@ -50,100 +67,90 @@
<argument>%file.temporary_storage.nesting_levels%</argument>
<argument>%file.temporary_storage.directory%</argument>
</service>
<!-- ContainerAwareTypeLoader -->
<service id="form.type.loader" class="%form.type.loader.class%">
<argument type="service" id="service_container" />
<!--
All services with tag "form.type" are inserted here by
AddFormTypesPass
-->
<argument type="collection" />
</service>
<!-- FieldTypes -->
<service id="form.type.field" class="Symfony\Component\Form\Type\FieldType">
<service id="form.type.field" class="Symfony\Component\Form\Extension\Core\Type\FieldType">
<tag name="form.type" alias="field" />
<argument type="service" id="validator" />
</service>
<service id="form.type.form" class="Symfony\Component\Form\Type\FormType">
<service id="form.type.form" class="Symfony\Component\Form\Extension\Core\Type\FormType">
<tag name="form.type" alias="form" />
</service>
<service id="form.type.birthday" class="Symfony\Component\Form\Type\BirthdayType">
<service id="form.type.birthday" class="Symfony\Component\Form\Extension\Core\Type\BirthdayType">
<tag name="form.type" alias="birthday" />
</service>
<service id="form.type.checkbox" class="Symfony\Component\Form\Type\CheckboxType">
<service id="form.type.checkbox" class="Symfony\Component\Form\Extension\Core\Type\CheckboxType">
<tag name="form.type" alias="checkbox" />
</service>
<service id="form.type.choice" class="Symfony\Component\Form\Type\ChoiceType">
<service id="form.type.choice" class="Symfony\Component\Form\Extension\Core\Type\ChoiceType">
<tag name="form.type" alias="choice" />
</service>
<service id="form.type.collection" class="Symfony\Component\Form\Type\CollectionType">
<service id="form.type.collection" class="Symfony\Component\Form\Extension\Core\Type\CollectionType">
<tag name="form.type" alias="collection" />
</service>
<service id="form.type.country" class="Symfony\Component\Form\Type\CountryType">
<service id="form.type.country" class="Symfony\Component\Form\Extension\Core\Type\CountryType">
<tag name="form.type" alias="country" />
</service>
<service id="form.type.csrf" class="Symfony\Component\Form\Type\CsrfType">
<service id="form.type.csrf" class="Symfony\Component\Form\Extension\Csrf\Type\CsrfType">
<tag name="form.type" alias="csrf" />
<argument type="service" id="form.csrf_provider" />
</service>
<service id="form.type.date" class="Symfony\Component\Form\Type\DateType">
<service id="form.type.date" class="Symfony\Component\Form\Extension\Core\Type\DateType">
<tag name="form.type" alias="date" />
</service>
<service id="form.type.datetime" class="Symfony\Component\Form\Type\DateTimeType">
<service id="form.type.datetime" class="Symfony\Component\Form\Extension\Core\Type\DateTimeType">
<tag name="form.type" alias="datetime" />
</service>
<service id="form.type.email" class="Symfony\Component\Form\Type\EmailType">
<service id="form.type.email" class="Symfony\Component\Form\Extension\Core\Type\EmailType">
<tag name="form.type" alias="email" />
</service>
<service id="form.type.file" class="Symfony\Component\Form\Type\FileType">
<service id="form.type.file" class="Symfony\Component\Form\Extension\Core\Type\FileType">
<tag name="form.type" alias="file" />
<argument type="service" id="file.temporary_storage" />
</service>
<service id="form.type.hidden" class="Symfony\Component\Form\Type\HiddenType">
<service id="form.type.hidden" class="Symfony\Component\Form\Extension\Core\Type\HiddenType">
<tag name="form.type" alias="hidden" />
</service>
<service id="form.type.integer" class="Symfony\Component\Form\Type\IntegerType">
<service id="form.type.integer" class="Symfony\Component\Form\Extension\Core\Type\IntegerType">
<tag name="form.type" alias="integer" />
</service>
<service id="form.type.language" class="Symfony\Component\Form\Type\LanguageType">
<service id="form.type.language" class="Symfony\Component\Form\Extension\Core\Type\LanguageType">
<tag name="form.type" alias="language" />
</service>
<service id="form.type.locale" class="Symfony\Component\Form\Type\LocaleType">
<service id="form.type.locale" class="Symfony\Component\Form\Extension\Core\Type\LocaleType">
<tag name="form.type" alias="locale" />
</service>
<service id="form.type.money" class="Symfony\Component\Form\Type\MoneyType">
<service id="form.type.money" class="Symfony\Component\Form\Extension\Core\Type\MoneyType">
<tag name="form.type" alias="money" />
</service>
<service id="form.type.number" class="Symfony\Component\Form\Type\NumberType">
<service id="form.type.number" class="Symfony\Component\Form\Extension\Core\Type\NumberType">
<tag name="form.type" alias="number" />
</service>
<service id="form.type.password" class="Symfony\Component\Form\Type\PasswordType">
<service id="form.type.password" class="Symfony\Component\Form\Extension\Core\Type\PasswordType">
<tag name="form.type" alias="password" />
</service>
<service id="form.type.percent" class="Symfony\Component\Form\Type\PercentType">
<service id="form.type.percent" class="Symfony\Component\Form\Extension\Core\Type\PercentType">
<tag name="form.type" alias="percent" />
</service>
<service id="form.type.radio" class="Symfony\Component\Form\Type\RadioType">
<service id="form.type.radio" class="Symfony\Component\Form\Extension\Core\Type\RadioType">
<tag name="form.type" alias="radio" />
</service>
<service id="form.type.repeated" class="Symfony\Component\Form\Type\RepeatedType">
<service id="form.type.repeated" class="Symfony\Component\Form\Extension\Core\Type\RepeatedType">
<tag name="form.type" alias="repeated" />
</service>
<service id="form.type.textarea" class="Symfony\Component\Form\Type\TextareaType">
<service id="form.type.textarea" class="Symfony\Component\Form\Extension\Core\Type\TextareaType">
<tag name="form.type" alias="textarea" />
</service>
<service id="form.type.text" class="Symfony\Component\Form\Type\TextType">
<service id="form.type.text" class="Symfony\Component\Form\Extension\Core\Type\TextType">
<tag name="form.type" alias="text" />
</service>
<service id="form.type.time" class="Symfony\Component\Form\Type\TimeType">
<service id="form.type.time" class="Symfony\Component\Form\Extension\Core\Type\TimeType">
<tag name="form.type" alias="time" />
</service>
<service id="form.type.timezone" class="Symfony\Component\Form\Type\TimezoneType">
<service id="form.type.timezone" class="Symfony\Component\Form\Extension\Core\Type\TimezoneType">
<tag name="form.type" alias="timezone" />
</service>
<service id="form.type.url" class="Symfony\Component\Form\Type\UrlType">
<service id="form.type.url" class="Symfony\Component\Form\Extension\Core\Type\UrlType">
<tag name="form.type" alias="url" />
</service>

View File

@ -0,0 +1,107 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
abstract class AbstractExtension implements FormExtensionInterface
{
/**
* @var array
*/
private $types;
/**
* @var Boolean
*/
private $typesLoaded = false;
/**
* @var FormTypeGuesserInterface
*/
private $typeGuesser;
/**
* @var Boolean
*/
private $typeGuesserLoaded = false;
abstract protected function loadTypes();
abstract protected function loadTypeGuesser();
private function initTypes()
{
$this->typesLoaded = true;
$types = $this->loadTypes();
$typesByName = array();
foreach ($types as $type) {
if (!$type instanceof FormTypeInterface) {
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
}
$typesByName[$type->getName()] = $type;
}
$this->types = $typesByName;
}
private function initTypeGuesser()
{
$this->typeGuesserLoaded = true;
$guesser = $this->loadTypeGuesser();
if (!$guesser instanceof FormTypeGuesserInterface) {
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeGuesserInterface');
}
$this->guesser = $guesser;
}
public function getType($name)
{
if (!$this->typesLoaded) {
$this->initTypes();
}
if (!isset($this->types[$name])) {
throw new FormException(sprintf('The type "%s" can not be typesLoaded by this extension', $name));
}
return $this->types[$name];
}
public function hasType($name)
{
if (!$this->typesLoaded) {
$this->initTypes();
}
return isset($this->types[$name]);
}
public function getTypeGuesser()
{
if (!$this->typeGuesserLoaded) {
$this->initTypeGuesser();
}
return $this->typeGuesser;
}
}

View File

@ -9,12 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormView;
namespace Symfony\Component\Form;
abstract class AbstractType implements FormTypeInterface
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form;
class CallbackTransformer implements DataTransformerInterface
{

View File

@ -9,9 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Validator;
use Symfony\Component\Form\FormInterface;
namespace Symfony\Component\Form;
class CallbackValidator implements FormValidatorInterface
{

View File

@ -9,9 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataMapper;
use Symfony\Component\Form\FormInterface;
namespace Symfony\Component\Form;
interface DataMapperInterface
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form;
/**
* Transforms a value between different representations.

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Exception;
/**
* Indicates a value transformation error.

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
@ -38,7 +38,7 @@ class ArrayChoiceList implements ChoiceListInterface
}
/**
* @see Symfony\Component\Form\ChoiceList\ChoiceListInterface::getChoices
* @see Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface::getChoices
*/
protected function load()
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
interface ChoiceListInterface
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
class MonthChoiceList extends PaddedChoiceList
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
class PaddedChoiceList extends ArrayChoiceList
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
/**
* Represents a choice list where each timezone is broken down by continent.

View File

@ -9,21 +9,31 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Loader;
namespace Symfony\Component\Form\Extension\Core;
use Symfony\Component\Form\Type;
use Symfony\Component\Form\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Validator\ValidatorInterface;
use Symfony\Component\HttpFoundation\File\TemporaryStorage;
class DefaultTypeLoader extends ArrayTypeLoader
class CoreExtension extends AbstractExtension
{
public function __construct(
ValidatorInterface $validator = null,
CsrfProviderInterface $csrfProvider = null, TemporaryStorage $storage = null)
private $validator;
private $storage;
private $typeGuesser;
public function __construct(ValidatorInterface $validator, TemporaryStorage $storage)
{
$types = array(
new Type\FieldType($validator),
$this->validator = $validator;
$this->storage = $storage;
}
protected function loadTypes()
{
return array(
new Type\FieldType($this->validator),
new Type\FormType(),
new Type\BirthdayType(),
new Type\CheckboxType(),
@ -48,17 +58,12 @@ class DefaultTypeLoader extends ArrayTypeLoader
new Type\TimeType(),
new Type\TimezoneType(),
new Type\UrlType(),
new Type\FileType($this->storage),
);
}
if ($csrfProvider) {
// TODO Move to a Symfony\Bridge\FormSecurity
$types[] = new Type\CsrfType($csrfProvider);
}
if ($storage) {
$types[] = new Type\FileType($storage);
}
parent::__construct($types);
public function loadTypeGuesser()
{
return new CoreTypeGuesser($this->validator->getMetadataFactory());
}
}

View File

@ -3,29 +3,24 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Guesser;
namespace Symfony\Component\Form\Extension\Core;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface;
/**
* Guesses form fields from the metadata of the a Validator class
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
class ValidatorTypeGuesser implements TypeGuesserInterface
class CoreTypeGuesser implements FormTypeGuesserInterface
{
/**
* Constructor
*
* @param ClassMetadataFactoryInterface $metadataFactory
*/
private $metadataFactory;
public function __construct(ClassMetadataFactoryInterface $metadataFactory)
{
$this->metadataFactory = $metadataFactory;
@ -301,4 +296,4 @@ class ValidatorTypeGuesser implements TypeGuesserInterface
);
}
}
}
}

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataMapper;
namespace Symfony\Component\Form\Extension\Core\DataMapper;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Util\VirtualFormAwareIterator;
use Symfony\Component\Form\Exception\FormException;

View File

@ -9,9 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
class ArrayToBooleanChoicesTransformer implements DataTransformerInterface

View File

@ -9,9 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Util\FormUtil;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
class ArrayToChoicesTransformer implements DataTransformerInterface

View File

@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
abstract class BaseDateTimeTransformer implements DataTransformerInterface
{

View File

@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
/**
* Passes a value through multiple value transformers

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformer\TransformationFailedException;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\HttpFoundation\File\File;

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformer\TransformationFailedException;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\HttpFoundation\File\File;

View File

@ -9,9 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
/**
* Transforms between an integer and a localized number with grouping

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\UnexpectedTypeException;

View File

@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,9 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
class ScalarToBooleanChoicesTransformer implements DataTransformerInterface

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Util\FormUtil;
use Symfony\Component\Form\DataTransformerInterface;
class ScalarToChoiceTransformer implements DataTransformerInterface
{

View File

@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\EventListener;
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Events;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\EventListener;
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Events;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\EventListener;
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Events;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\EventListener;
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\Form\Events;
use Symfony\Component\Form\Event\DataEvent;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\EventListener;
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\Form\Events;
use Symfony\Component\Form\Event\FilterDataEvent;

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class BirthdayType extends AbstractType

View File

@ -9,11 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\DataTransformer\BooleanToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
use Symfony\Component\Form\FormView;
class CheckboxType extends AbstractType

View File

@ -9,19 +9,20 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\EventListener\FixRadioInputListener;
use Symfony\Component\Form\Extension\Core\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\DataTransformer\ScalarToChoiceTransformer;
use Symfony\Component\Form\DataTransformer\ScalarToBooleanChoicesTransformer;
use Symfony\Component\Form\DataTransformer\ArrayToChoicesTransformer;
use Symfony\Component\Form\DataTransformer\ArrayToBooleanChoicesTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ScalarToChoiceTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ScalarToBooleanChoicesTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToChoicesTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToBooleanChoicesTransformer;
class ChoiceType extends AbstractType
{
@ -32,7 +33,7 @@ class ChoiceType extends AbstractType
}
if ($options['choice_list'] && !$options['choice_list'] instanceof ChoiceListInterface) {
throw new FormException('The "choice_list" must be an instance of "Symfony\Component\Form\ChoiceList\ChoiceListInterface".');
throw new FormException('The "choice_list" must be an instance of "Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface".');
}
if (!$options['choice_list']) {

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\EventListener\ResizeFormListener;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
class CollectionType extends AbstractType
{

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Locale\Locale;

View File

@ -9,15 +9,16 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\ReversedTransformer;
use Symfony\Component\Form\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\DataTransformer\ArrayToPartsTransformer;
use Symfony\Component\Form\ReversedTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
class DateTimeType extends AbstractType
{

View File

@ -9,18 +9,19 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\ChoiceList\PaddedChoiceList;
use Symfony\Component\Form\ChoiceList\MonthChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\PaddedChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\MonthChoiceList;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\DataTransformer\ReversedTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\ReversedTransformer;
class DateType extends AbstractType
{

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;

View File

@ -9,16 +9,17 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Util\PropertyPath;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\EventListener\TrimListener;
use Symfony\Component\Form\Validator\DefaultValidator;
use Symfony\Component\Form\Validator\DelegatingValidator;
use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
use Symfony\Component\Form\Extension\Core\Validator\DefaultValidator;
use Symfony\Component\Form\Extension\Core\Validator\DelegatingValidator;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Validator\ValidatorInterface;

View File

@ -9,16 +9,17 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\EventListener\FixFileUploadListener;
use Symfony\Component\Form\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\DataTransformer\ReversedTransformer;
use Symfony\Component\Form\DataTransformer\FileToStringTransformer;
use Symfony\Component\Form\DataTransformer\FileToArrayTransformer;
use Symfony\Component\Form\Extension\Core\EventListener\FixFileUploadListener;
use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\ReversedTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\FileToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\FileToArrayTransformer;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\File\TemporaryStorage;

View File

@ -9,13 +9,14 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\EventDispatcher\EventDispatcher;
class FormType extends AbstractType

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class HiddenType extends AbstractType

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\IntegerToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
class IntegerType extends AbstractType
{

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Locale\Locale;
class LanguageType extends AbstractType

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Locale\Locale;
class LocaleType extends AbstractType

View File

@ -9,11 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\MoneyToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
use Symfony\Component\Form\FormView;
class MoneyType extends AbstractType

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\NumberToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer;
class NumberType extends AbstractType
{

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormView;

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\PercentToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer;
class PercentType extends AbstractType
{

View File

@ -9,11 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\BooleanToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
use Symfony\Component\Form\FormView;
class RadioType extends AbstractType

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\DataTransformer\ValueToDuplicatesTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
class RepeatedType extends AbstractType
{

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;

View File

@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class TextareaType extends AbstractType

View File

@ -9,15 +9,16 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\ChoiceList\PaddedChoiceList;
use Symfony\Component\Form\DataTransformer\ReversedTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\ChoiceList\PaddedChoiceList;
use Symfony\Component\Form\ReversedTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\FormView;
class TimeType extends AbstractType

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\ChoiceList\TimezoneChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\TimezoneChoiceList;
class TimezoneType extends AbstractType
{

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\EventListener\FixUrlProtocolListener;
use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
class UrlType extends AbstractType
{

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Validator;
namespace Symfony\Component\Form\Extension\Core\Validator;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormValidatorInterface;
use Symfony\Component\Form\FormError;
class DefaultValidator implements FormValidatorInterface

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Validator;
namespace Symfony\Component\Form\Extension\Core\Validator;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormValidatorInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\Util\VirtualFormAwareIterator;
use Symfony\Component\Form\Exception\FormException;

View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Csrf;
use Symfony\Component\Form\Extension\Csrf\Type;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\AbstractExtension;
class CsrfExtension extends AbstractExtension
{
private $csrfProvider;
public function __construct(CsrfProviderInterface $csrfProvider)
{
$this->csrfProvider = $csrfProvider;
}
protected function loadTypes()
{
return array(
new Type\CsrfType($this->csrfProvider),
);
}
protected function loadTypeGuesser()
{
}
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\CsrfProvider;
namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
/**
* Marks classes able to provide CSRF protection

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\CsrfProvider;
namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
/**
* Default implementation of CsrfProviderInterface

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\CsrfProvider;
namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
use Symfony\Component\HttpFoundation\Session;

View File

@ -9,13 +9,14 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
namespace Symfony\Component\Form\Extension\Csrf\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\Validator\CallbackValidator;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\CallbackValidator;
class CsrfType extends AbstractType
{
@ -32,16 +33,16 @@ class CsrfType extends AbstractType
$pageId = $options['page_id'];
$builder
->setData($csrfProvider->generateCsrfToken($pageId))
->addValidator(new CallbackValidator(
function (FormInterface $form) use ($csrfProvider, $pageId) {
if ((!$form->hasParent() || $form->getParent()->isRoot())
&& !$csrfProvider->isCsrfTokenValid($pageId, $form->getData())) {
$form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form'));
$form->setData($csrfProvider->generateCsrfToken($pageId));
}
}
));
->setData($csrfProvider->generateCsrfToken($pageId))
->addValidator(new CallbackValidator(
function (FormInterface $form) use ($csrfProvider, $pageId) {
if ((!$form->hasParent() || $form->getParent()->isRoot())
&& !$csrfProvider->isCsrfTokenValid($pageId, $form->getData())) {
$form->addError(new FormError('The CSRF token is invalid. Please try to resubmit the form'));
$form->setData($csrfProvider->generateCsrfToken($pageId));
}
}
));
}
public function getDefaultOptions(array $options)

View File

@ -0,0 +1,69 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\DependencyInjection;
use Symfony\Component\Form\FormExtensionInterface;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DependencyInjectionExtension implements FormExtensionInterface
{
private $container;
private $typeServiceIds;
private $guesserServiceIds;
private $guesser;
private $guesserLoaded = false;
public function __construct(ContainerInterface $container,
array $typeServiceIds, array $guesserServiceIds)
{
$this->container = $container;
$this->typeServiceIds = $typeServiceIds;
$this->guesserServiceIds = $guesserServiceIds;
}
public function getType($identifier)
{
if (!isset($this->typeServiceIds[$identifier])) {
throw new \InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $identifier));
}
return $this->container->get($this->typeServiceIds[$identifier]);
}
public function hasType($identifier)
{
return isset($this->typeServiceIds[$identifier]);
}
public function getTypeGuesser()
{
if (!$this->guesserLoaded) {
$this->guesserLoaded = true;
$guessers = array();
foreach ($this->guesserServiceIds as $serviceId) {
$guessers[] = $this->container->get($serviceId);
}
if (count($guessers) > 0) {
$this->guesser = new FormTypeGuesserChain($guessers);
}
}
return $this->guesser;
}
}

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\FileBag;
use Symfony\Component\Form\Event\DataEvent;
use Symfony\Component\Form\Event\FilterDataEvent;
use Symfony\Component\Form\Exception\FormException;
@ -21,12 +19,9 @@ use Symfony\Component\Form\Exception\AlreadyBoundException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Exception\DanglingFieldException;
use Symfony\Component\Form\Exception\FieldDefinitionException;
use Symfony\Component\Form\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\DataTransformer\DataTransformerInterface;
use Symfony\Component\Form\DataTransformer\TransformationFailedException;
use Symfony\Component\Form\DataMapper\DataMapperInterface;
use Symfony\Component\Form\Validator\FormValidatorInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\FileBag;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@ -213,19 +208,19 @@ class Form implements \IteratorAggregate, FormInterface
{
foreach ($clientTransformers as $transformer) {
if (!$transformer instanceof DataTransformerInterface) {
throw new UnexpectedTypeException($transformer, 'Symfony\Component\Form\DataTransformer\DataTransformerInterface');
throw new UnexpectedTypeException($transformer, 'Symfony\Component\Form\DataTransformerInterface');
}
}
foreach ($normTransformers as $transformer) {
if (!$transformer instanceof DataTransformerInterface) {
throw new UnexpectedTypeException($transformer, 'Symfony\Component\Form\DataTransformer\DataTransformerInterface');
throw new UnexpectedTypeException($transformer, 'Symfony\Component\Form\DataTransformerInterface');
}
}
foreach ($validators as $validator) {
if (!$validator instanceof FormValidatorInterface) {
throw new UnexpectedTypeException($validator, 'Symfony\Component\Form\Validator\FormValidatorInterface');
throw new UnexpectedTypeException($validator, 'Symfony\Component\Form\FormValidatorInterface');
}
}

View File

@ -11,12 +11,8 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\DataMapper\DataMapperInterface;
use Symfony\Component\Form\DataTransformer\DataTransformerInterface;
use Symfony\Component\Form\Validator\FormValidatorInterface;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Type\FormTypeInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@ -350,7 +346,7 @@ class FormBuilder
}
if (null !== $type && !is_string($type) && !$type instanceof FormTypeInterface) {
throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\Type\FormTypeInterface');
throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface');
}
$this->children[$name] = array(

View File

@ -3,17 +3,19 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Loader;
namespace Symfony\Component\Form;
interface TypeLoaderInterface
interface FormExtensionInterface
{
function getType($name);
function hasType($name);
}
function getTypeGuesser();
}

View File

@ -11,28 +11,41 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\Type\FormTypeInterface;
use Symfony\Component\Form\Type\Loader\TypeLoaderInterface;
use Symfony\Component\Form\Type\Guesser\TypeGuesserInterface;
use Symfony\Component\Form\Type\Guesser\Guess;
use Symfony\Component\Form\Guess\TypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
class FormFactory implements FormFactoryInterface
{
private $typeLoader;
private $extensions = array();
private $guessers = array();
private $guesser;
public function __construct(TypeLoaderInterface $typeLoader, array $guessers = array())
public function __construct(array $extensions)
{
foreach ($guessers as $guesser) {
if (!$guesser instanceof TypeGuesserInterface) {
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\Type\Guesser\TypeGuesserInterface');
foreach ($extensions as $extension) {
if (!$extension instanceof FormExtensionInterface) {
throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface');
}
}
$this->typeLoader = $typeLoader;
$this->guessers = $guessers;
$this->extensions = $extensions;
}
private function loadGuesser()
{
$guessers = array();
foreach ($this->extensions as $extension) {
$guesser = $extension->getTypeGuesser();
if ($guesser) {
$guessers[] = $guesser;
}
}
$this->guesser = new FormTypeGuesserChain($guessers);
}
public function create($type, $data = null, array $options = array())
@ -68,9 +81,17 @@ class FormFactory implements FormFactoryInterface
$passedOptions = array_keys($options);
while (null !== $type) {
// TODO check if type exists
if (!$type instanceof FormTypeInterface) {
$type = $this->typeLoader->getType($type);
foreach ($this->extensions as $extension) {
if ($extension->hasType($type)) {
$type = $extension->getType($type);
break;
}
}
if (!$type) {
throw new FormException(sprintf('Could not load type "%s"', $type));
}
}
array_unshift($types, $type);
@ -107,22 +128,14 @@ class FormFactory implements FormFactoryInterface
public function createBuilderForProperty($class, $property, $data = null, array $options = array())
{
// guess field class and options
$typeGuess = $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessType($class, $property);
});
if (!$this->guesser) {
$this->loadGuesser();
}
// guess maximum length
$maxLengthGuess = $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessMaxLength($class, $property);
});
$typeGuess = $this->guesser->guessType($class, $property);
$maxLengthGuess = $this->guesser->guessMaxLength($class, $property);
$requiredGuess = $this->guesser->guessRequired($class, $property);
// guess whether field is required
$requiredGuess = $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessRequired($class, $property);
});
// construct field
$type = $typeGuess ? $typeGuess->getType() : 'text';
if ($maxLengthGuess) {
@ -140,26 +153,4 @@ class FormFactory implements FormFactoryInterface
return $this->createNamedBuilder($type, $property, $data, $options);
}
/**
* Executes a closure for each guesser and returns the best guess from the
* return values
*
* @param \Closure $closure The closure to execute. Accepts a guesser as
* argument and should return a FieldFactoryGuess
* instance
* @return FieldFactoryGuess The guess with the highest confidence
*/
protected function guess(\Closure $closure)
{
$guesses = array();
foreach ($this->guessers as $guesser) {
if ($guess = $closure($guesser)) {
$guesses[] = $guess;
}
}
return Guess::getBestGuess($guesses);
}
}

View File

@ -0,0 +1,76 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
use Symfony\Component\Form\Guess\Guess;
class FormTypeGuesserChain implements FormTypeGuesserInterface
{
private $guessers = array();
public function __construct(array $guessers)
{
foreach ($guessers as $guesser) {
if (!$guesser instanceof FormTypeGuesserInterface) {
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
}
if ($guesser instanceof self) {
$this->guessers = array_merge($this->guessers, $guesser->guessers);
} else {
$this->guessers[] = $guesser;
}
}
}
public function guessType($class, $property)
{
return $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessType($class, $property);
});
}
public function guessRequired($class, $property)
{
return $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessRequired($class, $property);
});
}
public function guessMaxLength($class, $property)
{
return $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessMaxLength($class, $property);
});
}
/**
* Executes a closure for each guesser and returns the best guess from the
* return values
*
* @param \Closure $closure The closure to execute. Accepts a guesser
* as argument and should return a Guess instance
* @return FieldFactoryGuess The guess with the highest confidence
*/
private function guess(\Closure $closure)
{
$guesses = array();
foreach ($this->guessers as $guesser) {
if ($guess = $closure($guesser)) {
$guesses[] = $guess;
}
}
return Guess::getBestGuess($guesses);
}
}

View File

@ -3,20 +3,15 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Guesser;
namespace Symfony\Component\Form;
/**
* Guesses field classes and options for the properties of a class
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
interface TypeGuesserInterface
interface FormTypeGuesserInterface
{
/**
* Returns a field guess for a property name of a class
@ -44,4 +39,4 @@ interface TypeGuesserInterface
* @return Guess A guess for the field's maximum length
*/
function guessMaxLength($class, $property);
}
}

View File

@ -9,12 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormView;
namespace Symfony\Component\Form;
interface FormTypeInterface
{

View File

@ -9,9 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Validator;
use Symfony\Component\Form\FormInterface;
namespace Symfony\Component\Form;
interface FormValidatorInterface
{

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Util\FormUtil;
class FormView implements \ArrayAccess, \IteratorAggregate, \Countable

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Guesser;
namespace Symfony\Component\Form\Guess;
/**
* Base class for guesses made by TypeGuesserInterface implementation

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Guesser;
namespace Symfony\Component\Form\Guess;
/**
* Contains a guessed class name and a list of options for creating an instance

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Type\Guesser;
namespace Symfony\Component\Form\Guess;
/**
* Contains a guessed value

View File

@ -7,7 +7,7 @@
<class name="Symfony\Component\Form\Form">
<constraint name="Callback">
<value>
<value>Symfony\Component\Form\Validator\DelegatingValidator</value>
<value>Symfony\Component\Form\Extension\Core\Validator\DelegatingValidator</value>
<value>validateFormData</value>
</value>
</constraint>

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\DataTransformer;
namespace Symfony\Component\Form;
/**
* Reverses a transformer

Some files were not shown because too many files have changed in this diff Show More