Agavi was the first framework to feature autoloading support for Propel. This does not only include your model classes, but also Propel itself - Propel will be loaded and initialized on demand, and only if you access your data model. This JIT loading mechanism guarantees maximum performance because it eliminates any overhead. You can then simply use any of your model classes in the code, without having to require or init Propel first or anything.
This requires at least Propel 1.2.0!
To set up the advanced Propel support, you have to follow one or two simple steps:
Go to databases.xml and insert a new
database configuration for your Propel model:
<database name="propel" class="AgaviPropelDatabase">
<parameters>
<parameter name="config">%core.app_dir%/config/bookstore-conf.php</parameter>
</parameters>
</database>bookstore-conf.php is the name of the
runtime configuration file Propel generated for you.
This step is not necessary for Propel 1.3
For each Object and Peer, you now have to create an entry in
autoload.xml:
<autoload name="Book">bookstore/Book.php</autoload> <autoload name="BookPeer">bookstore/BookPeer.php</autoload>
You
do not have to add the om/*.php files or the
map/*.php files!
It is a good idea to add the Criteria class to the list of autoloads, too:
<autoload name="Criteria">propel/util/Criteria.php</autoload>