Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[Concrete Inheritance][Aggregate Column] Mixing this two behaviors gives an error on buildtime #623

Open
jlorente opened this Issue · 0 comments

1 participant

@jlorente

When you put an aggregate column on a parent class, the following Error appears when calling propel-gen.

[phingcall] You must define a foreign key to the 'child_objects_a' table in the 'parent_relation' table to enable the 'aggregate_column' behavior

This is my schema.

<?xml version="1.0" encoding="UTF-8"?>
<database package= "Schema" name="default_schema" defaultIdMethod="native">
    <table name="package" phpName="Package">
        <column name= "package_id" phpName= "PackageId" primaryKey= "true" required= "true" type= "INTEGER" sqlType= "INTEGER unsigned" autoIncrement= "true"></column>
    </table>
    <table name="parent_objects" phpName="ParentObject">
        <column name= "parent_object_id" phpName= "ParentObjectId" primaryKey= "true" required= "true" type= "INTEGER" sqlType= "INTEGER unsigned" autoIncrement= "true"></column>
        <column name= "package_id" phpName= "PackageId" required= "true" type= "INTEGER" sqlType= "INTEGER unsigned"></column>
        <column name= "parent_relation_count" phpName= "ParentRelationCount" required= "true" type= "INTEGER" defaultValue="0" sqlType="unsigned"></column>
        <foreign-key foreignTable="package" name="ID_ParentObject_PackageId" onDelete="CASCADE" onUpdate="CASCADE"  >
            <reference local="package_id" foreign="package_id"/>
        </foreign-key>
        <behavior name="aggregate_column">
            <parameter name="name" value="parent_relation_count" />
            <parameter name="foreign_table" value="parent_relation" />
            <parameter name="expression" value="COUNT(model_object_id)" />
        </behavior>
        <index name="ID_ParentObject_PackageId">
               <index-column name="package_id"/>
        </index>
    </table>
    <table name="child_objects_a" phpName="ChildObjectA">
        <behavior name="concrete_inheritance">
            <parameter name="extends" value="parent_objects" />
        </behavior> 
        <column name= "child_a_property" phpName= "ChildAProperty" required= "false" type="BOOLEAN" size= "1" defaultValue= "0"></column>
    </table>
    <table name="child_objects_b" phpName="ChildObjectB">
        <behavior name="concrete_inheritance">
            <parameter name="extends" value="parent_objects" />
        </behavior> 
        <column name= "child_b_property" phpName= "ChildBProperty" required= "false" type="BOOLEAN" size= "1" defaultValue= "0"></column>
    </table>
    <table name="parent_relation" phpName="ParentRelation">
        <column name= "parent_relation_id" phpName= "ParentRelationId" required= "true" type= "INTEGER" sqlType= "INTEGER unsigned" primaryKey= "true"></column>
        <column name= "parent_object_id" phpName= "ParentObjectId" required= "true" type= "INTEGER" sqlType= "INTEGER unsigned" primaryKey= "true"></column>
        <foreign-key foreignTable="parent_objects" name="RT_ParentRelation_ParentObjectId" onDelete="CASCADE" onUpdate="CASCADE"  >
        <reference local="parent_object_id" foreign="parent_object_id"/>
        </foreign-key>
        <index name="RT_ParentRelation_ParentObjectId">
               <index-column name="parent_object_id"/>
        </index>
    </table>
</database>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.