Listing Condition date


Hey there,

I´ve got a list of objects “$someObjectsList”, and need the number of objects created last week. The condition is following:

$lastWeek = Carbon::now()->subWeek();
… get the Listing of the class …
$weeklyListOfObjects->setCondition(“objectName LIKE ? AND objectDate > ?”,["%$name%", $lastWeek]);
$this->weeklyListOfObjects = §weeklyListOfObjects

weeklyListOfObjects = §weeklyListOfObjects

I get the number of all objects, but I not the number of objects from lastWeek

Does somebody has any idea?



If you want to get all from last week, you have to filter the dates between of last week. So from monday to sunday. Otherwise you will get all that have been changed since start of last week.

You can also use the creationDate pimcore already persists. I guess that is available like:

$list->setCondition('o_creationDate > CURRENT_TIMESTAMP());

You also have to use the Timestamp of the date.




Thank you for the quick answer!
Following works, it gives me the last 7 days, thats ok for me.

$list->setCondition(“name LIKE ? AND objectDate > $lastSevenDays”,["%$name%"]);

Thanks a lot!