dev-master
9999999-devPropel integration for PhpAlchemy.
MIT
The Requires
service php provider propel phpalchemy
Propel integration for PhpAlchemy.
The PropelServiceProvider provides integration with Propel2., (*1)
propel.path (optional): The path in which Propel.php will be found. Usually, for
PEAR installation, it is propel
while for Git installation it is
vendor/propel/runtime/lib
.
Default is /full/project/path/vendor/propel/propel1/runtime/lib
., (*2)
propel.config_file (optional): The name of Propel configuration file with full path.
Default is /full/project/path/build/conf/projectname-conf.php
, (*3)
propel.model_path (optional): Path to where model classes are located.
Default is /full/project/path/build/classes
, (*4)
It's strongly recommanded to use absolute paths for previous options., (*5)
No service is provided., (*6)
Propel configures and manages itself by using static methods, so no service is registered into Application. Actually, the PropelServiceProvider class initializes Propel in a more "PhpAlchemy-ian" way., (*7)
Make sure you place a copy of Propel in vendor/propel
or install it through PEAR, or Composer., (*8)
For more informations consult the Propel documentation:, (*9)
``` php <?php, (*10)
$app['propel.config_file'] = DIR.'/path/to/myproject-conf.php'; $app['propel.model_path'] = DIR.'/path/to/model/classes'; $app->register(new Propel\Silex\PropelServiceProvider());, (*11)
Alternatively, if you 've installed Propel by Git in `vendor/propel` and you built your model with default Propel generator options: ``` php <?php $app->register(new Propel\Silex\PropelServiceProvider());
We can consider "default" Propel generator options:, (*12)
Put build.properties
and schema.xml
files into the main directory project,
usually where file index.php
is located., (*13)
In build.properties
file, define only propel.database
, propel.project
and propel.namespace.autopackage
properties., (*14)
You'll have to build the model by yourself. According to Propel documentation, you'll need three files:, (*15)
schema.xml
which contains your database schema;, (*16)
build.properties
more information below;, (*17)
runtime-conf.xml
which contains the database configuration., (*18)
Use the propel-gen
script to create all files (SQL, configuration, Model classes)., (*19)
By default, the PropelServiceProvider relies on the PhpAlchemy autoloader you have to configure to load
model classes. Of course, the Silex autoloader needs the model to be built with namespaces,
so be sure to set this property into the build.properties
file:, (*20)
``` yaml propel.namespace.autopackage = true, (*21)
The recommended configuration for your build.properties
file is:, (*22)
propel.project =
propel.namespace.autoPackage = true propel.packageObjectModel = true, (*24)
propel.useDateTimeClass = true, (*25)
propel.dateTimeClass = DateTime, (*26)
propel.defaultTimeStampFormat = propel.defaultTimeFormat = propel.defaultDateFormat = ```, (*27)
If you plan to build your model without using namespaces, you need to force Propel to use
its internal autoloader. Do this by setting the option propel.internal_autoload
to true
., (*28)
For more information, consult the Propel documentation., (*29)
Propel integration for PhpAlchemy.
MIT
service php provider propel phpalchemy