In First Basic App, we added the application prefix to the front-controller config so that the front-controller could find our pages by name.
Model-based applications alst use a "model catalog" to find models by name. The catalog lets us find models by name. So, before we create a model-based app, we need to tell the catalog where to find our models. In
config/Solar.config.php, find the Solar_Sql_Model_Catalog config entry and
change the it to read like this:
<?php
$config['Solar_Sql_Model_Catalog'] = array(
'classes' => array('Example_Model'),
);
?>
To build an application that uses a model and implements BREAD-S (browse, read,
edit, add, delete, and search) functions, use the make-app command and specify a model
name to use.
$ ./script/solar make-app Example_App_Foo \
--model-name=foo
This will create files like the following:
source/
example/
Example/
App/
Foo.php # page controller
Foo/
Layout/
Locale/
en_US.php # app-specific locale strings
View/
It looks pretty empty, but it works. This is because it extends the Example_Controller_Model class, which has all the views and code necessary for BREAD-S operations.
You can now browse to http://example.com/index.php/foo and start working with records.
You can override the various view scripts to change the look of the application. For example, if you add a Foo/View/_item.php file, that will be used instead of the Example/Controller/Model/View/_item.php file.
Similarly, you can overrige the various action and support methods to change behavior, or add new action methods and related view scripts.