loadModel needs more than just a backend table to work. You'll need
to create the model to go along with it. I might suggest defining a
function in your Book model that changes the table on the fly before a
save.
Example:
function adminSave($data = array(), $options = array()){
$this->useTable = 'book_admins';
parent::save($data, $options);
}
Then in your controller you wouldn't need to create or load a new
model, instead you'd just call $this->Book->adminSave($this->data);
Hope that helps,
Nick
On Mar 3, 3:02 am, Chrriss <[email protected]> wrote:
> Hi!
>
> When a user modify something, the admin has to check before. so I'd
> like to save the changes in a temporary table until the admin check
> the changes.
>
> I have a table "book" for the model Book and I ve created a table
> "book_admins" to store when a user modify datas. So datas in the table
> "book" will not change until the admin check.
>
> I tried by using Controller::loadModel() but it doesn't work:
>
> if (empty($this->data) == false) {
> $this->loadModel('BookAdmin');
> $result = $this->BookAdmin->save($this->data);
>
> }
>
> but cakephp show me that the request it makes is a describe on the
> table "book_admins"
>
> I don't know how to do for this problem!
>
> Why it doesn't work?
>
> What could I use to do that?
>
> Thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en