Mvc\Collection::find

public static find ([array $parameters]) Allows to query a set of records that match the specified conditions //How many robots are there? $robots = Robots::find(); echo "There are ", count($robots), "\n"; //How many mechanical robots are there? $robots = Robots::find(array( array("type" => "mechanical") )); echo "There are ", count(robots), "\n"; //Get and print virtual robots ordered by name $robots = Robots::findFirst(array( array("type" => "virtual"), "order"

Mvc\Collection::delete

public delete () Deletes a model instance. Returning true on success or false otherwise. $robot = Robots::findFirst(); $robot->delete(); foreach (Robots::find() as $robot) { $robot->delete(); }

Mvc\Collection::createIfNotExist

public createIfNotExist (array $criteria) Creates a document based on the values in the attributes, if not found by criteria Preferred way to avoid duplication is to create index on attribute $robot = new Robot(); $robot->name = “MyRobot”; $robot->type = “Droid”; //create only if robot with same name and type does not exist $robot->createIfNotExist( array( “name”, “type” ) );

Mvc\Collection::create

public create () Creates a collection based on the values in the attributes

Mvc\Collection::count

public static count ([array $parameters]) Perform a count over a collection echo 'There are ', Robots::count(), ' robots';

Mvc\Collection::cloneResult

public static cloneResult (Phalcon\Mvc\CollectionInterface $collection, array $document) Returns a cloned collection

Mvc\Collection::appendMessage

public appendMessage (Phalcon\Mvc\Model\MessageInterface $message) Appends a customized message on the validation process use \Phalcon\Mvc\Model\Message as Message; class Robots extends \Phalcon\Mvc\Model { public function beforeSave() { if ($this->name == 'Peter') { message = new Message("Sorry, but a robot cannot be named Peter"); $this->appendMessage(message); } } }

Mvc\Collection::aggregate

public static aggregate ([array $parameters]) Perform an aggregation using the Mongo aggregation framework

Mvc\Collection

implements Phalcon\Mvc\EntityInterface, Phalcon\Mvc\CollectionInterface, Phalcon\Di\InjectionAwareInterface, Serializable Source on GitHub This component implements a high level abstraction for NoSQL databases which works with documents Constants integer OP_NONE integer OP_CREATE integer OP_UPDATE integer OP_DELETE Methods final public __construct ([Phalcon\DiInterface $dependencyInjector], [Phalcon\Mvc\Collection\ManagerInterface $modelsManager]) Phalcon\Mvc\Collection constructor publ

Mvc\Application\Exception

extends class Phalcon\Application\Exception implements Throwable Source on GitHub Methods final private Exception __clone () inherited from Exception Clone the exception public __construct ([string $message], [int $code], [Exception $previous]) inherited from Exception Exception constructor public __wakeup () inherited from Exception ... final public string getMessage () inherited from Exception Gets the Exception message final public int getCode () inherited from Exception Gets the Except