Propelを例に
<?php
// 並び順を与えられた通りに整える
$ids = array(1,3,2);
$_hoges = HogePeer::retrieveByPKs($ids);
# array(3) { [0]=> object(Hoge){["id":protected]=>1} [1]=> object(Hoge){["id":protected]=>2} [2]=> object(Hoge){["id":protected]=>3} }
$hoges = array_flip($ids);
foreach ($_hoges as $_hoge) {
$hoges[$_hoge->getId()] = $_hoge;
}
$hoges;
# array(3) { [1]=> object(Hoge){["id":protected]=>1} [3]=> object(Hoge){["id":protected]=>3} [2]=> object(Hoge){["id":protected]=>2} }