Wednesday, September 5, 2012

Re: Create database table using controller.

yes, deleting/refreshing/updating the listsources should solve the problem but I haven't managed to do that.
I tried doing something like this:
$dataSource = $this->MyModel->getDataSource(); 
$dataSource->listSources($updatedSourceList);
It doesn't cause ant error but listSources does not get updated.

My code is in a shell class so redirecting isn't really a good option for me.

On Wednesday, September 5, 2012 8:05:11 AM UTC+2, Dr. Tarique Sani wrote:
On Sun, Feb 28, 2010 at 3:04 PM, veepee <vpc...@gmail.com> wrote:
> I've found the problem.
> It is caused by the listsources() method in cakephp has cached the

Right! and listsources() reads the list from a cache file similar to
myapp_cake_model_default_pathname_list

This cache file is updated/created when a page reloads by a call to
listsources()

> sources array which holds the array of tables available in database.
> My question now is, is it possible to reset the sources to null in my
> controller?

You have 2 options
- figure out how to delete the cache file and call listsources() again
- *redirect* to a new action after creating the table and use the new
model there

HTH
Tarique


--
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: