I have an issue with my IF-statement, apparently.
Inside a symfony2 controller I have the following PHP:
57 foreach($all as $t) {
58 if ( ($end == null) || ($t->getDate()->format('Y-m-d') <= $end->format("Y-m-d")) ) {
59 if ( ($start == null) || ($t->getDate()->format('Y-m-d') >= $start->format("Y-m-d")) ) {
60 $subset[] = $t;
61 }
62 }
63 }
I get this for an error message:
FatalErrorException: Error: Call to undefined function App\Bundle\Controller\ () in
www/App/src/App/Bundle/Controller/TransactionController.php line 59
If I comment the second IF-statement out like this, it runs without errors.
foreach($all as $t) {
if ( ($end == null) || ($t->getDate()->format('Y-m-d') <= $end->format("Y-m-d")) ) {
/*
if ( ($start == null) || ($t->getDate()->format('Y-m-d') >= $start->format("Y-m-d")) ) {
$subset[] = $t;
}
*/
}
}
So somewhere in my if statement it tries to run a sym2 controller? I am lost...
Both $start
and $end
are valid DateTime
objects, so are each $date
on the $t
objects.
If I var_dump the variables just before the second if-condition they print:
start: object(DateTime)#1149 (3) { ["date"]=> string(19) "2014-12-20 16:39:06" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
end: object(DateTime)#1150 (3) { ["date"]=> string(19) "2015-01-19 16:39:06" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
t->getDate(): object(DateTime)#1046 (3) { ["date"]=> string(19) "2012-12-11 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }