* echo $robot->readAttribute('name'); * * * @param string $attribute * @return mixed */ public function readAttribute($attribute){ } /** * Writes an attribute value by its name * * * $robot->writeAttribute('name', 'Rosey'); * * * @param string $attribute * @param mixed $value */ public function writeAttribute($attribute, $value){ } /** * Returns a cloned collection * * @param \Phalcon\Mvc\Collection $collection * @param array $document * @return \Phalcon\Mvc\Collection */ public static function cloneResult($collection, $document){ } /** * Returns a collection resultset * * @param array $params * @param \Phalcon\Mvc\Collection $collection * @param \MongoDb $connection * @param boolean $unique * @return array */ protected static function _getResultset(){ } /** * Perform a count over a resultset * * @param array $params * @param \Phalcon\Mvc\Collection $collection * @param \MongoDb $connection * @return int */ protected static function _getGroupResultset(){ } /** * Executes internal hooks before save a document * * @param \Phalcon\DiInterface $dependencyInjector * @param boolean $disableEvents * @param boolean $exists * @return boolean */ protected function _preSave(){ } /** * Executes internal events after save a document * * @param boolean $disableEvents * @param boolean $success * @param boolean $exists * @return boolean */ protected function _postSave(){ } /** * Executes validators on every validation call * * *use \Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; * *class Subscriptors extends \Phalcon\Mvc\Collection *{ * * public function validation() * { * $this->validate(new ExclusionIn(array( * 'field' => 'status', * 'domain' => array('A', 'I') * ))); * if ($this->validationHasFailed() == true) { * return false; * } * } * *} * * * @param object $validator */ protected function validate(){ } /** * Check whether validation process has generated any messages * * *use \Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; * *class Subscriptors extends \Phalcon\Mvc\Collection *{ * * public function validation() * { * $this->validate(new ExclusionIn(array( * 'field' => 'status', * 'domain' => array('A', 'I') * ))); * if ($this->validationHasFailed() == true) { * return false; * } * } * *} * * * @return boolean */ public function validationHasFailed(){ } /** * Fires an internal event * * @param string $eventName * @return boolean */ public function fireEvent($eventName){ } /** * Fires an internal event that cancels the operation * * @param string $eventName * @return boolean */ public function fireEventCancel($eventName){ } /** * Cancel the current operation * * @return boolean */ protected function _cancelOperation(){ } /** * Checks if the document exists in the collection * * @param \MongoCollection $collection */ protected function _exists(){ } /** * 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!"; *} * * * @return \Phalcon\Mvc\Model\MessageInterface[] */ public function getMessages(){ } /** * 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); * } * } * } * * * @param \Phalcon\Mvc\Model\MessageInterface $message */ public function appendMessage($message){ } /** * Creates/Updates a collection based on the values in the atributes * * @return boolean */ public function save(){ } /** * Find a document by its id (_id) * * @param string|\MongoId $id * @return \Phalcon\Mvc\Collection */ public static function findById($id){ } /** * Allows to query the first record that match the specified conditions * * * * //What's the first robot in the robots table? * $robot = Robots::findFirst(); * echo "The robot name is ", $robot->name, "\n"; * * //What's the first mechanical robot in robots table? * $robot = Robots::findFirst(array( * array("type" => "mechanical") * )); * echo "The first mechanical robot name is ", $robot->name, "\n"; * * //Get first virtual robot ordered by name * $robot = Robots::findFirst(array( * array("type" => "mechanical"), * "order" => array("name" => 1) * )); * echo "The first virtual robot name is ", $robot->name, "\n"; * * * * @param array $parameters * @return array */ public static function findFirst($parameters=null){ } /** * 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" => array("name" => 1) * )); * foreach ($robots as $robot) { * echo $robot->name, "\n"; * } * * //Get first 100 virtual robots ordered by name * $robots = Robots::find(array( * array("type" => "virtual"), * "order" => array("name" => 1), * "limit" => 100 * )); * foreach ($robots as $robot) { * echo $robot->name, "\n"; * } * * * @param array $parameters * @return array */ public static function find($parameters=null){ } /** * Perform a count over a collection * * * echo 'There are ', Robots::count(), ' robots'; * * * @param array $parameters * @return array */ public static function count($parameters=null){ } /** * Perform an aggregation using the Mongo aggregation framework * * @param array $parameters * @return array */ public static function aggregate($parameters){ } /** * Allows to perform a summatory group for a column in the collection * * @param string $field * @param array $conditions * @param string $finalize * @return array */ public static function summatory($field, $conditions=null, $finalize=null){ } /** * Deletes a model instance. Returning true on success or false otherwise. * * * * $robot = Robots::findFirst(); * $robot->delete(); * * foreach (Robots::find() as $robot) { * $robot->delete(); * } * * * @return boolean */ public function delete(){ } /** * Returns the instance as an array representation * * * print_r($robot->toArray()); * * * @return array */ public function toArray(){ } /** * Serializes the object ignoring connections or protected properties * * @return string */ public function serialize(){ } /** * Unserializes the object from a serialized string * * @param string $data */ public function unserialize($data){ } } }