GeocodableBehavior icon indicating copy to clipboard operation
GeocodableBehavior copied to clipboard

geocodable conflicts with concrete_inheritance

Open miklcct opened this issue 9 years ago • 0 comments

When a table with concrete_inheritance inherits from a table with geocodable, the resulting class cannot be used:

<table name="ContactItem">
    <behavior name="geocodable" />
    <column name="public" type="BOOLEAN" required="true"
            defaultValue="false"/>
    <column name="phone" size="15"/>
    <column name="email" size="254">
        <vendor type="mysql">
            <parameter name="Charset" value="utf8"/>
            <parameter name="Collate" value="utf8_unicode_ci"/>
        </vendor>
    </column>
    <column name="website" size="2048"/>
    <column name="address" type="LONGVARCHAR"/>
    <column name="district_id" type="VARCHAR" size="32"/>
    <foreign-key foreignTable="District" onDelete="restrict"
                 onUpdate="restrict">
        <reference local="district_id" foreign="id"/>
    </foreign-key>
</table>
<table name="Person">
    <behavior name="concrete_inheritance">
        <parameter name="extends" value="ContactItem"/>
    </behavior>
    <column name="first_name" required="true" size="35"/>
    <column name="last_name" required="true" size="35"/>
    <column name="password"/>
    <column name="remember_token"/>
    <column name="gender" type="BOOLEAN"/>
    <column name="birthday" type="DATE"/>
</table>

The getDistanceTo() method generated as a result of inheriting from the base class is not compatible to the base class:

   [ErrorException]                                                                                                                                                                                                               
  Declaration of App\Models\Base\Person::getDistanceTo() should be compatible with App\Models\Base\Contactitem::getDistanceTo(App\Models\Contactitem $contactitem, $unit = App\Models\Map\ContactitemTableMap::KILOMETERS_UNIT)  

The generated method should refer to the base object instead of this object.

miklcct avatar Jul 15 '15 02:07 miklcct