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 javascript: 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Create database table using controller.
Hi veepee, I am having the exact same problem. have you ever found a solution? On Saturday, February 27, 2010 4:46:12 PM UTC+2, veepee wrote: Hi All, I am new to cakePHP and I've tried googling for this topic but to no avail. I need to create a database table from controller. May i know is it possible to insert into the newly created table, i.e. in this example, the customer table using model? $this-Q-query(CREATE TABLE customer (First_Name char(50), Last_Name char(50), Address char(50) default 'Unknown', City char(50) default 'Mumbai', Country char(25), Birth_Date date)); } $this-loadModel('Customer'); $this-Customers-saveAll(data); I've tried it but this does not work. May I know if there are any alternatives besides creating another insert statement using $this-Q-query(INSERT INTO customer...); -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.