csanquer / custom-base-behavior
Propel Behavior to customize generated parent Base classes
Requires
- propel/propel1: 1.6.*
Requires (Dev)
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-11-23 13:57:50 UTC
README
License
MIT License
copyright (c) 2012 Charles Sanquer
Functionality
Propel Behavior to customize generated Parent Base classes
The normal propel inheritance with generated base classes follow this schema :
With CustomBaseBehavior you can change the parent classes of the base generated classes and share common methods between model objects
Requirements
This behavior requires Propel >=1.6.0
Installation
You can use composer and packagist.org package csanquer/custom-base-behavior
Or just download and copy the behavior to a specific path.
Then register the behavior class by adding the following to the bottom of the build.properties
file in you project folder:
# check that you have behaviors enabled propel.builder.addBehaviors = true # and add the custom behavior propel.behavior.custom_base.class = path.to.CustomBehavior
Enable the behavior in your schema.xml:
<table name="book"> <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" /> <column name="title" type="VARCHAR" required="true" /> <behavior name="custom_base"> <parameter name="base_object" value="MyCustomBaseObject" /> <!-- default = "BaseObject" --> <parameter name="base_peer" value="MyCustomBasePeer" /> <!-- default = "" --> <parameter name="base_query" value="MyCustomBaseQuery" /> <!-- default = "ModelCriteria" --> </behavior> </table>
Base classes can use namespaces ( with , / or dot character).
Your custom Base Object class should extend Propel BaseObject and your custom Base Query class should extend Propel ModelCriteria.
Tests
To run tests
curl -s http://getcomposer.org/installer | php
php composer.phar --dev install
phpunit