Hello.
Is there a way to use table name of relational model, defined in model class, in joinWith?
For example, from documentation:
$orders = Order::find()->innerJoinWith([
'books',
'customer' => function ($query) {
$query->where('customer.created_at > ' . (time() - 24 * 3600));
}
])->all();
Here customer is relational table name, but if Customer model has redefined tableName:
class Customer extends ActiveRecord
{
public static function tableName()
{
return 'cstmr';
}
}
we need to write where condition like this:
$query->where('cstmr.created_at > ' . (time() - 24 * 3600));
Maybe there is some special macros, which is automatically replacing with table name? Something like this:
$query->where('%tableName%.created_at > ' . (time() - 24 * 3600));