O'Reilly logo

Symfony2 Essentials by Wojciech Bancer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a list of tasks

After we are set, we should create a table with a list of our unfinished tasks. In the previous chapter, when we created a database model we didn't add a column to flag the finished task, so we will do this now to demonstrate how the database model should be amended while the project is growing.

Modify the src/AppBundle/Entity/Task.php file and add the following:

    // ... 
    /**
     * @ORM\Column(type="datetime")
     */
    private $created_at;

    // add the code below, to recognize finished tasks:
    /**
     * @ORM\Column(type="boolean")
     */
    private $finished = false;

Update the database and generate the following new methods:

$ php app/console doctrine:schema:update --force
$ php app/console doctrine:generate:entities --no-backup AppBundle

Now we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required