Search code examples
phpsymfony1

Weird database item arragment in a Symfony app


I'm following the Jobeet Tutorial Day 7 for Symfony.

After finishing The Category Link step of day 7, the Sensio lab Web developer Item goes to the back (as you can see in the picture from the tutorial is at the top of the Programming category).

The item has id 1 so I don't really understand why it goes to the back (it becomes approximately number 20 of the list (in the tutorial the item doesn't move its position).

Any suggestions to fix this arrangement issue?

alt text
(source: symfony-project.org)


Solution

  • I spent around 3 hours comparing the files and I discovered this:

    The SVN has this:

    $q->andWhere($alias . '.expires_at > ?', date('Y-m-d h:i:s', time()))
      ->addOrderBy($alias . '.expires_at DESC');
    

    The tutorial file has this:

    $q->andWhere($alias . '.expires_at > ?', date('Y-m-d H:i:s', time()))
      ->addOrderBy($alias . '.created_at DESC');
    

    Is this an error from the tutorial?