Add tablename to ar-single-table-inheritance
dhoomm opened this issue · comments
This prevents duplicate column names in joins.
class SportCar/HeavyCar extends Car
the find
function should also pass the table name to CarQuery
return new CarQuery(get_called_class(), ['type' => self::TYPE,'tableName'=> self::tableName()]);
.
Then add a property $tableName
to class CarQuery
.
Then use it in function prepare
as
$this->andWhere(["$this->tableName.type" => $this->type]);
When creating a join with a table having column name 'type' wont create conflict..
Would you please make a pull request?