Symfony2 beta 2 disponible

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

La beta 2 est désormais disponible sur le site de Symfony2.

Décidemment, Symfony2 a du mal à rester dans la voie de la simplicité, avec des problématiques d’utilisation du système d’annotations par différents bundles, la core team tente de solutionner au travers l’utilisation du use, ce qui nous impose, en tant que développeur, de bien connaître les composants du framework, le développement en devient quelque peu inconfortable, un bon en arrière dans le processus de simplification ? (Symfony2: Annotations get better)

Alors quoi de neuf depuis la beta 1 ?

Changements beta1->beta2 :

  1. The annotation parsing process has been changed (it now uses Doctrine Common 3.0). All annotations which are used in a class must now be imported (just like you import PHP namespaces with the « use » statement):

    Before:

    /**
     * @orm:Entity
     */
    class AcmeUser
    {
        /**
         * @orm:Id
         * @orm:GeneratedValue(strategy = "AUTO")
         * @orm:Column(type="integer")
         * @var integer
         */
        private $id;
    
        /**
         * @orm:Column(type="string", nullable=false)
         * @assert:NotBlank
         * @var string
         */
        private $name;
    }
    

    After:

    use Doctrine\ORM\Mapping as ORM;
    use Symfony\Component\Validator\Constraints as Assert;
    
    /**
     * @ORM\Entity
     */
    class AcmeUser
    {
        /**
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="AUTO")
         * @ORM\Column(type="integer")
         *
         * @var integer
         */
        private $id;
    
        /**
         * @ORM\Column(type="string", nullable=false)
         * @Assert\NotBlank
         *
         * @var string
         */
        private $name;
    }
    

  2. The Set constraint has been removed as it is not required anymore.

    Before:

    
    /**
     * @orm:Entity
     */
    class AcmeEntity
    {
        /**
         * @assert:Set({@assert:Callback(...), @assert:Callback(...)})
         */
        private $foo;
    }
    

    After:

    
    use Doctrine\ORM\Mapping as ORM;
    use Symfony\Component\Validator\Constraints\Callback;
    
    /**
     * @ORM\Entity
     */
    class AcmeEntity
    {
        /**
         * @Callback(...)
         * @Callback(...)
         */
        private $foo;
    }
    
    

  3. The config under framework.validation.annotations has been removed and was replaced with a boolean flag framework.validation.enable_annotations which defaults to false.

  4. Forms must now be explicitly enabled (automatically done in Symfony SE):

    framework:
        form: ~
    

    Which is equivalent to:

    framework:
        form:
            enabled: true
    

  5. The Routing Exceptions have been moved:

    Before:

    Symfony\Component\Routing\Matcher\Exception\Exception
    Symfony\Component\Routing\Matcher\Exception\NotFoundException
    Symfony\Component\Routing\Matcher\Exception\MethodNotAllowedException
    

    After:

    Symfony\Component\Routing\Exception\Exception
    Symfony\Component\Routing\Exception\NotFoundException
    Symfony\Component\Routing\Exception\MethodNotAllowedException
    

  6. The form component’s csrf_page_id option has been renamed to intention.

  7. The error_handler setting has been removed. The ErrorHandler class is now managed directly by Symfony SE in AppKernel.

  8. The Doctrine metadata files has moved from Resources/config/doctrine/metadata/orm/ to Resources/config/doctrine, the extension from .dcm.yml to .orm.yml, and the file name has been changed to the short class name.

    Before:

    Resources/config/doctrine/metadata/orm/Bundle.Entity.dcm.xml
    Resources/config/doctrine/metadata/orm/Bundle.Entity.dcm.yml
    

    After:

    Resources/config/doctrine/Entity.orm.xml
    Resources/config/doctrine/Entity.orm.yml
    

  9. Your ads will be inserted here by

    Easy Plugin for AdSense.

    Please go to the plugin admin page to
    Paste your ad code OR
    Suppress this ad slot.

    With the introduction of a new Doctrine Registry class, the following parameters have been removed (replaced by methods on the doctrine service):

    1. doctrine.orm.entity_managers
    2. doctrine.orm.default_entity_manager
    3. doctrine.dbal.default_connection

    Before:

    $container->getParameter('doctrine.orm.entity_managers')
    $container->getParameter('doctrine.orm.default_entity_manager')
    $container->getParameter('doctrine.orm.default_connection')
    

    After:

    $container->get('doctrine')->getEntityManagerNames()
    $container->get('doctrine')->getDefaultEntityManagerName()
    $container->get('doctrine')->getDefaultConnectionName()
    

    But you don’t really need to use these methods anymore, as to get an entity manager, you can now use the registry directly:

    Before:

    $em = $this->get('doctrine.orm.entity_manager');
    $em = $this->get('doctrine.orm.foobar_entity_manager');
    

    After:

    $em = $this->get('doctrine')->getEntityManager();
    $em = $this->get('doctrine')->getEntityManager('foobar');
    

  10. The doctrine:generate:entities arguments and options changed. Run ./app/console doctrine:generate:entities –help for more information about the new syntax.

  11. The doctrine:generate:repositories command has been removed. The functionality has been moved to the doctrine:generate:entities.

  12. Doctrine event subscribers now use a unique « doctrine.event_subscriber » tag. Doctrine event listeners also use a unique « doctrine.event_listener » tag. To specify a connection, use the optional « connection » attribute.

    Before:

    listener:
        class: MyEventListener
        tags:
            - { name: doctrine.common.event_listener, event: name }
            - { name: doctrine.dbal.default_event_listener, event: name }
    subscriber:
        class: MyEventSubscriber
        tags:
            - { name: doctrine.common.event_subscriber }
            - { name: doctrine.dbal.default_event_subscriber }
    

    After:

    listener:
        class: MyEventListener
        tags:
            - { name: doctrine.event_listener, event: name }                      # register for all connections
            - { name: doctrine.event_listener, event: name, connection: default } # only for the default connection
    subscriber:
        class: MyEventSubscriber
        tags:
            - { name: doctrine.event_subscriber }                      # register for all connections
            - { name: doctrine.event_subscriber, connection: default } # only for the default connection
    

  13. Application translations are now stored in the Resources directory:

    Before:

    app/translations/catalogue.fr.xml
    

    After:

    app/Resources/translations/catalogue.fr.xml
    /pre>
    

  14. The option modifiable of the collection form type was split into two options allow_add and allow_delete. Before:

    $builder->add('tags', 'collection', array(
        'type' => 'text',
        'modifiable' => true,
    ));
    

    After:

    $builder->add('tags', 'collection', array(
        'type' => 'text',
        'allow_add' => true,
        'allow_delete' => true,
    ));
    

  15. Request::hasSession() has been renamed to Request::hasPreviousSession(). The method hasSession() still exists, but only checks if the request contains a session object, not if the session was started in a previous request.

  16. Serializer: The NormalizerInterface's supports() method has been split in two methods: supportsNormalization() and supportsDenormalization().

  17. ParameterBag::getDeep() has been removed, and is replaced with a boolean flag on the ParameterBag::get() method.

  18. Serializer: AbstractEncoder & AbstractNormalizer were renamed to SerializerAwareEncoder & SerializerAwareNormalizer.

  19. Serializer: The $properties argument has been dropped from all interfaces.

  20. Form: Renamed option value text of widget option of the date type was renamed to single-text. text indicates to use separate text boxes now (like for the time type).

  21. Form: Renamed view variable name to full_name. The variable name now contains the local, short name (equivalent to $form->getName()).

  22. tuto : Comment migrer votre projet de la beta 1 vers la beta 2

Tags: , ,


Laissez un commentaire :

*


created By ooyes.net