Is there any way in Kohana 3 ORM to run a piece of code in a model, but only after this model has been loaded from the database? A simple example is the required has_one relation.
ORM::factory('user')->where('name', '=', 'Bob')->find();
Now, if all users should have some other property, so if Bob doesn't exist, will he need to be created? Right now, where this line works, I check the zero primary key and instruct the model to add this connection, if so. But is there a way to do this with a model? The problem with the constructor is that the models can be constructed empty just before filling out the database, as this example shows, so I don't want this.
source
share