Undocumented method
See ext/mvc/model.c, line 158: method "initialize" is not documented. Please, consider adding another PHP_METHOD(Phalcon_Mvc_Model, initialize) method and update API doc.
There is another call to undocumented "initialize" in ext/mvc/collection.c, line 119
in phalcon, use initialize repleace __construct, The beginning of time, I also don't find initilaze in doc
Some more undocumented methods:
Phalcon\Mvc\Model:
- beforeSave()
- beforeUpdate()
- beforeCreate()
- afterSave()
- afterCreate()
- afterUpdate()
- beforeValidation()
- beforeValidationOnCreate()
- beforeValidationOnUpdate()
- onValidationFails()
- afterValidationOnCreate()
- afterValidationOnUpdate()
- afterValidation()
Those methods don't exist in the extension for that reason they aren't documented
Could they be added? If there references to them in documentation, it should be the same in API.
Those need to be implemented in a user-level, if we add them to the docs a user will try to do:
<?php
class Robots extends Phalcon\Mvc\Model
{
public function someMethod()
{
$this->beforeCreate();
}
}
And they will get a: this method doesn't exist...
Make those methods to accept a closure as a parameter :-) Even if they are not documented, there is nothing to prevent from calling those methods. They can have empty bodies.
If we add them with empty bodies, the ORM will try to call them every time a record is saved/deleted, actually we're doing an internal method_exists directly over the class definition, checking that is much faster than literally call a method, check if a method exists is practically ultra-fast compared with calling a method, call a method requires a lot of checks, grown the virtual machine stack, etc.
@phalcon does that really make that much of a difference? If that's so, that's a valid reason not to have them defined with empty bodies. (For a project of my own I also have this kind of functionality, but I tend to DO add them to the class (with an empty body).)
So the issue is, when omitted, they can't be documented internally, so the methods don't show up in the API ref. So currently one has to know that they exist, either from the guide, or experience (or examining the source ;-))
Any other way they can be documented so they end up in the API docs? Thanks!