Re: Using Views in database over a legacy database

2008-09-19 Thread RichardAtHome

You can set up your models to use any non-cake table structures and
naming styles.

See http://book.cakephp.org/view/71/Model-Attributes for more details.

On Sep 18, 9:31 am, Laurent Bois [EMAIL PROTECTED] wrote:
 Hi

 We currently have a data model with table names that don't follow
 CakePHP conventions.
 As we do with Rails, one technique to use (when application is read-
 only, and that's our case) is to create views in database over this
 legacy tables.
 First i did this.
 Then i wanted to unit test my new renamed data model.
 - i've recreated my models using renamed keys in my views.
 - i've recreated my test cases.

 After first test launched, what i see for the first model, is that the
 Testing framework create my test tables with the keys of the table,
 mapped by my view.
 And fixtures couldn't be loaded, and test is not run.

 here my legacy table :
 SL01 :
  N_NUME_CLIE varchar(6)
  L_CONN_NOM  varchar(40)
  L_CONN_PASS varchar(40)

 Here my view Users
 Create view Users as select n_nume_clie id, l_conn_nom, l_conn_pass
 from sl01;

 Here the trace in my test case (creation of the table for testing):
 CREATE TABLE `test_utilisateur_tests` ( `N_NUME_CLIE` varchar(6) NOT
 NULL, `L_CONN_NOM` varchar(40) NOT NULL, `L_CONN_PASS` varchar(40) NOT
 NULL );

 It seems to be a problem with the SimpleTest framework

 Does CakePHP support Models mapping database Views?
 Thanks

 Laurent
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using Views in database over a legacy database

2008-09-18 Thread Laurent Bois

Hi

We currently have a data model with table names that don't follow
CakePHP conventions.
As we do with Rails, one technique to use (when application is read-
only, and that's our case) is to create views in database over this
legacy tables.
First i did this.
Then i wanted to unit test my new renamed data model.
- i've recreated my models using renamed keys in my views.
- i've recreated my test cases.

After first test launched, what i see for the first model, is that the
Testing framework create my test tables with the keys of the table,
mapped by my view.
And fixtures couldn't be loaded, and test is not run.

here my legacy table :
SL01 :
 N_NUME_CLIE varchar(6)
 L_CONN_NOM  varchar(40)
 L_CONN_PASS varchar(40)

Here my view Users
Create view Users as select n_nume_clie id, l_conn_nom, l_conn_pass
from sl01;

Here the trace in my test case (creation of the table for testing):
CREATE TABLE `test_utilisateur_tests` ( `N_NUME_CLIE` varchar(6) NOT
NULL, `L_CONN_NOM` varchar(40) NOT NULL, `L_CONN_PASS` varchar(40) NOT
NULL );

It seems to be a problem with the SimpleTest framework

Does CakePHP support Models mapping database Views?
Thanks

Laurent

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---