Phalcon default model



  • hiall!

    Tell me, Plze, is there any way in the falcon to sort the default?

    At the moment, two models have been set up, the tasks and the comments to be made, after which they have been linked to the task-id.

    I want the task force of the mainframe to return the DESC-date-class area with a limit of 10. Thank you!



  • I've got a relationship with my comments:

    $this->hasMany('id', __NAMESPACE__ . '\TaskComments', 'task_id', array(
        'alias' => 'comments'
    ));
    

    As a result, there is a new function in the mission model.

    public function getSortedComments()
    {
        return $this->getComments(array(
            'order' => 'date DESC'
        ));
    }
    

    And then I'm referring to adversarial comments as

    task->sortedcomments
    

    Crude?


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2