chq81/query-inheritance-base-behavior
最新稳定版本:1.0.1
Composer 安装命令:
composer require chq81/query-inheritance-base-behavior
包简介
Propel 2 Query Inheritance Behavior to provide generic base query class for query inheritance objects
README 文档
README
Propel 2 Behavior to customize the inheritance for query objects in a single inheritance setup
License
MIT License
copyright (c) 2015 Christoph Quadt
Functionality
If there is a single inheritance set on a propel class, the current way of inheriting is:
FantasyBookQuery
=> BaseFantasyBookQuery
=> BaseBookQuery
=> ModelCriteria
This Builder provides the following setup:
FantasyBookQuery
=> BaseFantasyBookQuery
=> **BookQuery**
or
=> **MyCustomQuery**
=> BaseBookQuery
=> ModelCriteria
Requirements
This behavior requires
- Propel2 >= 2.0@dev
- QueryInheritanceBehaviorBuilder >= 1.0.0
Installation
To enable the builder, you need to
- reference the QueryInheritanceBehaviorBuilder as a custom builder in the propel settings:
propel.generator.objectModel.builders.queryinheritance = chq81\\CustomQueryInheritance\\Builder\\CustomQuerySingleInheritanceBuilder
2a. enable the behavior in the schema.xml for inheriting from the default query class (BookQuery):
<table name="book"> <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" /> <column name="title" type="VARCHAR" required="true" /> <column name="genre" phpName="Genre" type="INTEGER" size="11" required="true" defaultValue="0" inheritance="single"> <inheritance key="1" class="FantasyBook" extends="Book" /> <inheritance key="2" class="HorrorBook" extends="Book" /> </column> <behavior name="custom-query-inheritance" /> </table>
2b. enable the behavior in the schema.xml for inheriting from the custom query class (MyCustomQuery):
<table name="book"> <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" /> <column name="title" type="VARCHAR" required="true" /> <column name="genre" phpName="Genre" type="INTEGER" size="11" required="true" defaultValue="0" inheritance="single"> <inheritance key="1" class="FantasyBook" extends="Book" /> <inheritance key="2" class="HorrorBook" extends="Book" /> </column> <behavior name="custom-query-inheritance"> <parameter name="base" value="[NAMESPACE]\\MyCustomQuery" /> </behavior> </table>
统计信息
- 总下载量: 3.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-17