Thursday, September 18, 2008

Using Views in database over a legacy database

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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: