Single inheritance and Archivable behavior usage causes some BaseQuery files to be overwritten #776

noofaq opened this Issue Oct 16, 2013 · 0 comments


None yet
1 participant

noofaq commented Oct 16, 2013


  • table which uses inheritance & archivable


  • it seems that BaseQuery classes for subclasses (from inheritance) are being overwritten by those which are generated for "*_archive" tables
  • it can be seen in logs (and for example in the phpdoc which seems to come from "*_archive" table

Schema of table to reproduce:

<table name="likes" phpName="Like">
    <column name="like_id" type="INTEGER" primaryKey="true" required="true" autoIncrement="true" />
    <column name="like_us_id" type="INTEGER" required="true"  />
    <column name="like_context_id" type="INTEGER" required="true"/>
    <column name="like_context" type="VARCHAR" size="64" required="true" inheritance="single">
        <inheritance key="Product" class="ProductLike" extends="Like" />
        <inheritance key="Wall" class="WallLike" extends="Like" />
    <behavior name="timestampable" />
    <behavior name="archivable" />
    <foreign-key foreignTable="users" name="likes_users_fk_1">
        <reference local="like_us_id" foreign="us_id" />
    <vendor type="mysql">
        <parameter name="Engine" value="InnoDB"/>

Some parts from log of php app/console propel:build:model -v task (from Symfony2 PropelBundle):

[propel-om]   + Table: likes
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLikePeer.php
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLike.php
[propel-om]     -> (unchanged) src/MyBundle/Model/map/LikeTableMap.php
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLikeQuery.php
[propel-om]     -> (exists) src/MyBundle/Model/LikePeer.php
[propel-om]     -> (exists) src/MyBundle/Model/Like.php
[propel-om]     -> (exists) src/MyBundle/Model/LikeQuery.php
[propel-om]     -> Updating src/MyBundle/Model/om/BaseProductLikeQuery.php (table: likes, builder: QueryInheritanceBuilder)
[propel-om]     -> (exists) src/MyBundle/Model/ProductLike.php
[propel-om]     -> (exists) src/MyBundle/Model/ProductLikeQuery.php
[propel-om]     -> Updating src/MyBundle/Model/om/BaseWallLikeQuery.php (table: likes, builder: QueryInheritanceBuilder)
[propel-om]     -> (exists) src/MyBundle/Model/WallLike.php
[propel-om]     -> (exists) src/MyBundle/Model/WallLikeQuery.php
[propel-om]   + Table: likes_archive
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLikesArchivePeer.php
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLikesArchive.php
[propel-om]     -> (unchanged) src/MyBundle/Model/map/LikesArchiveTableMap.php
[propel-om]     -> (unchanged) src/MyBundle/Model/om/BaseLikesArchiveQuery.php
[propel-om]     -> (exists) src/MyBundle/Model/LikesArchivePeer.php
[propel-om]     -> (exists) src/MyBundle/Model/LikesArchive.php
[propel-om]     -> (exists) src/MyBundle/Model/LikesArchiveQuery.php
[propel-om]     -> Updating src/MyBundle/Model/om/BaseProductLikeQuery.php (table: likes_archive, builder: QueryInheritanceBuilder)
[propel-om]     -> (exists) src/MyBundle/Model/ProductLike.php
[propel-om]     -> (exists) src/MyBundle/Model/ProductLikeQuery.php
[propel-om]     -> Updating src/MyBundle/Model/om/BaseWallLikeQuery.php (table: likes_archive, builder: QueryInheritanceBuilder)
[propel-om]     -> (exists) src/MyBundle/Model/WallLike.php
[propel-om]     -> (exists) src/MyBundle/Model/WallLikeQuery.php

PHPDoc for BaseWallLikeQuery.php class:

 * Skeleton subclass for representing a query for one of the subclasses of the 'likes_archive' table.
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 * @package
class BaseWallLikeQuery extends LikeQuery {

Unfortunately I don't have enough time to propose a fix for this, so I have simply removed the archivable behavior temporarily what solves the issue (but with reduced functionality). I guess deprecated soft-delete should also work fine (it seems to work in my olded projects) but it is last option I would prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment