Skip to content


Subversion checkout URL

You can clone with
Download ZIP


wrong hydration on right join #606

johnarevalo opened this Issue · 4 comments

2 participants


with these tables:

    <table name="product_type">
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
        <column name="name" type="varchar" required="true" primaryString="true"/>
        <column name="unit" type="varchar" required="true"/>
        <column name="logo" type="varchar"/>
        <behavior name="timestampable" />

    <table name="product">
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
        <column name="last_price" type="double" required="true"/>
        <column name="station_id" type="integer" required="true" />
        <column name="type_id" type="integer" required="true" />
        <foreign-key foreignTable="product_type" phpName="Type">
            <reference local="type_id" foreign="id"/>
        <behavior name="timestampable" />

And this PropelCriteria

$products = ProductQuery::create()
        ->addJoinCondition('Type', ProductPeer::STATION_ID . ' = ?', $station->getId())

generate this query

SELECT, product.last_price, product.station_id, product.type_id, product.created_at, product.updated_at,,, product_type.unit, product_type.logo, product_type.created_at, product_type.updated_at 
FROM `product` 
RIGHT JOIN `product_type` ON ( AND product.station_id = 2)

Which it is just as I expected, I run this query directly in MySQL and works like a charm.
However, when Propel hydrates objects, only does it right for "Products" which are registered, remainder "ProductTypes" are cloned with the last row in the resultset.

I would like to know if this is the right way to build this query.



could you provide a unit test?

@johnarevalo johnarevalo referenced this issue from a commit in johnarevalo/Propel
@johnarevalo johnarevalo Issue #606 supporting with test unit 53990e7

I've created a simple test class to confirm this issue.



thanks,.. I will have a look at it on the weekend.

@staabm staabm referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.

moved unit test into separte PR #619 ... discussion continues there.

@staabm staabm closed this
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.