propelorm/Propel — Issue #206: findPkSimple() uses wrong key for InstancePool (QueryBuilder)
Author: chetzel
Created: 2011-11-30 11:32:00+00:00
State: open

The new Propel-Generator feature findPkSimple() uses the wrong key to put the new object into the instance pool:

try
{
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
}
catch (Exception $e)
{
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM))
{
$obj = new MyClass();
$obj->hydrate($row);
MyClassPeer::addInstanceToPool($obj, (string) $row[0]);
}

The `addInstanceToPool()` call should be `MyClassPeer::addInstanceToPool($obj, (string) $key);`!

This is in `Propel/generator/lib/builder/om/QueryBuilder.php`.

Regards, Carsten