public function beforeSelect(Select $event)
    {
        if ($this->isLazyLoaded()) {
            return;
        }

        $fields = $this->getFieldsPrefixed();
        $table = $this->entityDescriptor->getTableName();
        $relateTable = $this->getParentTableName();
        $pmk = $this->getParentPrimaryKey();

        $onClause = "{$table}.{$this->getForeignKey()} = ".
            "{$relateTable}.{$pmk}";

        $query = $event->getQuery();
        $query->join($relateTable, $onClause, $fields, $relateTable);
    }