Symfony2 from beta1 to beta2

Today I had to migrate existing project from Symfony2 Beta 1 version to Beta2.
First I looked at the difference between my config files and new one provided with Beta2.After some minor changes to config files, when I tried to start project in browser to see possible errors, I see not so happy surprise:
Annotation syntax in controllers and models are no longer working for me this way.
After some digging into code and official Symfony2 documentation here is what I found:
1. In controllers, instead of:
/**
* @extra:Route("/admin/applications", name="_admin_applications")
* @extra:Template()
*/
It has to be written like that:
/**
* @Route("/admin/applications", name="_admin_applications")
* @Template()
*/
2. Don’t forget to add these two lines on the top of each controller:
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
3. In entities, instead of:
/**
* @orm:Entity(repositoryClass="Surgeworks\AdminBundle\Entity\AttributeTypeRepository")
* @orm:Table(name="attribute_types")
*/
class AttributeType {
/**
* @orm:Id
* @orm:Column(type="integer")
* @orm:GeneratedValue(strategy="AUTO")
*/
protected $id;
It should be like:
/**
* @ORM\Entity(repositoryClass="Surgeworks\AdminBundle\Entity\AttributeTypeRepository")
* @ORM\Table(name="attribute_types")
*/
class AttributeType {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
4. Don’t forget to add this line on the top of each entity:
use Doctrine\ORM\Mapping as ORM;
Also I used some annotations like this in my entity:
* @assert:Type(type="Surgeworks\AdminBundle\Entity\Status")
protected $item_status;
but, this also is not working anymore, and instead of this it shoul be like this:
* @Assert\Type(type="Surgeworks\AdminBundle\Entity\Status")
Of course, we should add one more line on the top to get all the thing work:
use Symfony\Component\Validator\Constraints as Assert;
That was just short tutorial for fast migration from Symfony2 beta1 version to Symfony2 Beta 2 version.
I hope in the future they will not add so many changes in the core framework, because every time new version is out, I have to loose few hours to upgrade. 🙂
PS. Don’t forget to clear all cache before testing.
2 comments
Personally I am programming in NetBeans 7.0 for Php, and I am very satisfied with that.
Hi guy,which IDE do you program with Symfony 2?