Q:

Symfony2 Doctrine

I try to do a database query using
$position = $repository->findBy(
    array('id' => $profileId,'datum' => '10.07.2011'),
    array('timestamp', 'DESC')
);

the database looks like
id  haveInCircles   inOtherCircles  datum   timestamp
1   24  14  11.07.2011  1310403840
1   20  10  10.07.2011  1310317440
1   10  5   09.07.2011  1310317440
1   25  17  12.07.2011  1310468838

The result I get is always the data of the last day into the database. In this case '12.07.2011'.

A:

Using varchar for dates is probably the worst approach possible. Change the datum field to date or datetime, change your models accordingly so the doctine field is date and then do something like:
$position = $repository->findBy(
    array('id' => $profileId,'datum' => new Datetime('2011-07-10')),
    array('timestamp' => 'DESC')
);

http://www.php.net/manual/en/datetime.construct.php
Brief on schema practises which i would advice to review:
http://brixican.blogspot.ca/2011/04/5-mysql-best-practices-when-designing.html

