If you ever need a table less model with only some manual schema information (mainly for validation and form helper to work), you might find the documentation a little bit incomplete. There are more than just those types available. Here…
Tag: Model
Working with virtual fields in Cake1.3
In earlier versions of CakePHP we had to use Behaviors like "MultipleDisplayFields" or whatever. With $Model->virtualFields it is now possible to natively use find() methods combined with virtual fields. The nice thing about it is, that the pagination can work…
Working with models
Since there is so much to talk about it here, I will cut right to the chase. We all know about "Fat Models, Slim Controllers". So basically, as much as possible of the code should be in the model. For…
Validating multiple models at once
There are forms where you want to add/edit not only fields of the current model, but also of a related one (usually hasMany or belongsTo). Example: User and Post $this->Post->set($this->data); $this->Post->User->set($this->data); $val1 = $this->Post->validates(); $val2 = $this->Post->User->validates(); if ($val1 &&…