I should have tried the IRC channel first, I guess but didn't think
folks would be on it.
Regardless, the problem was that I was getting a cached version of a
previous findall(). The issue was resolved by setting var
$cacheQueries = false; in my model. This way the findall() fetches the
most recent addition to the database.
On Jan 24, 2:13 pm, "mk" wrote:
> My problem is pretty simple. I add a new item to the database via the
> model->save() method. I then try to retrieve the full list of items
> including the one that I just saved via model->findall() so I can make
> an ajax update.
>
> The first time I add something, the add is made in the database, but
> the find all doesn't find what I just added. If I add a second thing,
> the update will have the thing that I just added but not the most
> recent thing.
>
> Is there some kind of lag in the model that will not immediately
> retrieve something that was recently added?
>
> Here's the cod in my controller in case that helps explain what is
> going on:
>
> function add()
> {
> if (!empty($this->data))
> {
> $this->cleanUpFields();
>
> $this->data['Attribute']['attribute_type_id'] =
> $this->RetrieveTypeID($this->data['Attribute']['attribute_type_id']);
> $this->Attribute->save($this->data); // <----- data gets saved
> here
> }
>
> $this->AttributeType->recursive = 1;
> $this->set('types', $this->AttributeType->findAll()); // <------
> attempt to retrieve the full list including the thing that was just
> saved here
> $this->render('list', 'ajax');
> }
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---