/** * Mount additional (not related to parent key) conditions, extended by child loaders * (HAS_MANY, BELONGS_TO). * * @param RecordSelector $selector * @return RecordSelector */ protected function mountConditions(RecordSelector $selector) { //We only going to mount morph key as additional condition if (!empty($morphKey = $this->getKey(RecordEntity::MORPH_KEY))) { if ($this->isJoinable()) { $selector->onWhere($morphKey, $this->parent->schema[ORM::M_ROLE_NAME]); } else { $selector->where($morphKey, $this->parent->schema[ORM::M_ROLE_NAME]); } } return $selector; }