help with Query builder, order by datetime descending

so I have this line here:

Posts::query()->order('posts.postTime DESC')->limit(10)->execute();

which should be the same as this from mySQL?

SELECT * FROM posts ORDER BY posts.postTime DESC LIMIT 0 , 10

But it doesn't seem to order it by the timestamp at all



1.3k

found the solution:

$parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $parameters["order"] = "postTime DESC";// added DESC to this line here

    $posts = Posts::find($parameters);

    $paginator = new Paginator(array(
        "data" => $posts,
        "limit"=> 10,
        "page" => $numberPage