Hi,
I would like to be able to set an alias on a Model::query() object. How can I do it? Please see the example below:
static::query()
->innerJoin('\Models\ModelName2', '\Models\ModelName1.id=model2.id', 'model2')
->execute();
I can only set the alias for the joined model and I'm unable to set one to the current model. When using namespaces queries like these become harder to read/write because of the long model names.
It would be nice to be able to do something like:
static::query()
->alias('model1')
->innerJoin('\Models\ModelName2', '\Models\ModelName1.id=model2.id', 'model2')
->execute();
What do you think of this approach? Meanwhile I'll be using QueryBuilder to achieve the same results.