Hi everyone!
I have two tables:
AuctionPackage
$this->belongsTo('id', 'AuctionPackageTranslation', 'auction_package_id', NULL);
and another one
AuctionPackageTranslation
$this->belongsTo('auction_package_id', 'AuctionPackage', 'id', NULL);
Now, when I do
$auction_order = AuctionOrder::findFirstByid($id);
I get all the correct data and in Volt I have access to the translation. But, I want to use findFirst instead of findFirstByid and do a condition, if one of the field in the joined language table has a ceratain value.
Like so:
$auction_package = AuctionPackage::findFirst(array(
"auction_package_translation.lang_id = '{$lang}'",
"id = {$id}"
));
And I get error:
Unknown model or alias 'auction_package_translation' (1), when preparing: SELECT [AuctionPackage]. FROM [AuctionPackage] WHERE auction_package_translation.lang_id = 'de' LIMIT ?1*
Does findFirst not join the tables and findFirstByid ? How can I condition something to joined table?