Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Symfony2 Essentials

You're reading from   Symfony2 Essentials

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781784398767
Length 158 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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 need to modify our data fixtures. In the previous chapter, we created an example tag fixture, now we need to add an example task. Add the following code to the file:

<?php

//...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image