Mvc\Collection::getConnectionService

public getConnectionService () Returns DependencyInjection connection service

Mvc\Collection::getMessages

public getMessages () Returns all the validation messages $robot = new Robots(); $robot->type = 'mechanical'; $robot->name = 'Astro Boy'; $robot->year = 1952; if ($robot->save() == false) { echo "Umh, We can't store robots right now "; foreach ($robot->getMessages() as message) { echo message; } } else { echo "Great, a new robot was saved successfully!"; }

Mvc\Collection::getConnection

public MongoDb getConnection () Retrieves a database connection

Mvc\Collection::getId

public MongoId getId () Returns the value of the _id property

Mvc\Collection::fireEventCancel

public fireEventCancel (mixed $eventName) Fires an internal event that cancels the operation

Mvc\Collection::getDI

public getDI () Returns the dependency injection container

Mvc\Collection::getCollectionManager

public getCollectionManager () Returns the models manager related to the entity instance

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::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::fireEvent

public fireEvent (mixed $eventName) Fires an internal event