I have a new problem with the CakePHP project in Chapter 4. Configured routes.php as you said but using the url http://localhost/cake/the-book
didn't work. I could get the index page by using the url http://localhost/cake/index.php/the-book
. However then when I click the link to get to the add page I get in my browser http://localhost/cake/index.php/addresses/add
If I add the following additional line to routes.php: Router::connect('the-book/:action',array('controller'=>'addresses')
my result is http://localhost/cake/index.php/the-book/add
This would be great except when I submit the form on the add page it goes to:
If I use the original routes.php submitting the form gives me:
Neither of these gets the form values processed.
Since the form action appears to be generated by the framework, I am stuck as to how to fix this. Have i missed a step somewhere?
There are some problems with the Zend Framework part of Chapter 4:
In the book you refer to the models as AddressBook and AddressBookMapper while in the source code they are Addresses and AddressesMapper.
In the sql for setting up the table you use fields first_name, last_name but in the models you use firstName and lastName. This results in an error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'firstName' in 'field list
Changing the column names in the table to firstName and lastName will fix this.
The AddressEdit form after extending the Address form needs to have two hidden elements: id and created.
Without id it creates a NEW entry, and without created it loses the created time and sets it to 0;
As of yet I haven't got the Cake thing to work properly. I was able to fix the Zend Framework example as I am familiar with the Zend Framework.
By the way, I do appreciate this book, as it exposes me to the two other frameworks which I hadn't tried up to now.