protected function createSelector($innerKey): RecordSelector
    {
        $selector = $this->orm->selector($this->class)->where(
            $this->key(Record::OUTER_KEY),
            $innerKey
        );

        $decorator = new AliasDecorator($selector, 'where', $selector->getAlias());
        if (!empty($this->schema[Record::WHERE])) {
            //Configuring where conditions with alias resolution
            $decorator->where($this->schema[Record::WHERE]);
        }

        if (!empty($this->key(Record::MORPH_KEY))) {
            //Morph key
            $decorator->where(
                '{@}.' . $this->key(Record::MORPH_KEY),
                $this->orm->define(get_class($this->parent), ORMInterface::R_ROLE_NAME)
            );
        }

        if (!empty($this->schema[Record::ORDER_BY])) {
            //Sorting
            $decorator->orderBy((array)$this->schema[Record::ORDER_BY]);
        }

        return $selector;
    }