Mvc\Model::findFirst

public static static findFirst ([string | array $parameters])

Allows to query the first record that match the specified conditions

//What's the first robot in robots table?
 $robot = Robots::findFirst();
 echo "The robot name is ", $robot->name;

 //What's the first mechanical robot in robots table?
 $robot = Robots::findFirst("type='mechanical'");
 echo "The first mechanical robot name is ", $robot->name;

 //Get first virtual robot ordered by name
 $robot = Robots::findFirst(array("type='virtual'", "order" => "name"));
 echo "The first virtual robot name is ", $robot->name;
doc_Phalcon
2016-10-16 09:52:49
Comments
Leave a Comment

Please login to continue.