Idiorm/Paris を使用するアプリケーションに Join を追加したところ、Model::factory() で検索すると、返されたオブジェクトが「親」オブジェクトではなく、結合されたオブジェクトから ID を取得していることがわかります。
モデルを形成するテーブル エイリアスをパリスに伝えるにはどうすればよいですか?
私はこれを検索コンテキストで行っているので、has_many() を使用できるとは思いませんが、間違っていれば幸いです!
サンプルコード:
// Find a booking with a join
$query = Model::factory('Booking');
$query->where('booking.id', '2282');
$query->join(
'customer',
array('booking.id', '=', 'customer.booking_id'),
'customer'
);
$bookingWithJoin = $query->find_one();
// Find the same booking, without a join
$query = Model::factory('Booking');
$query->where('id', '2282');
$bookingWithoutJoin = $query->find_one();
// The booking with a join gets the ID of the customer it's joined with
echo $bookingWithJoin->id .' != '. $bookingWithoutJoin->id;