src/Service/Search.php
private function getAssociationByField(string $field) : ?Association
    {
        list($name) = explode('.', $this->table->aliasField($field), 2);

        if ($name === $this->table->getAlias()) {
            return null;
        }

        if (! $this->table->hasAssociation($name)) {
            throw new \RuntimeException(sprintf('Table "%s" does not have association "%s"', $this->table->getAlias(), $name));
        }

        return $this->table->getAssociation($name);
    }
private function getAssociationByField(string $field) : ?Association
    {
        list($name) = explode('.', $this->table->aliasField($field), 2);

        if ($name === $this->table->getAlias()) {
            return null;
        }

        if (! $this->table->hasAssociation($name)) {
            throw new \RuntimeException(sprintf('Table "%s" does not have association "%s"', $this->table->getAlias(), $name));
        }

        return $this->table->getAssociation($name);
    }
private function getAssociationByField ( string $ field ) : ? Association { list ( $ name ) = explode ( '.' , $ this -> table -> aliasField ( $ field ) , 2 ) ; if ( $ name === $ this -> table -> getAlias ( ) ) { return null ; } if ( ! $ this -> table -> hasAssociation ( $ name ) ) { throw new \ RuntimeException ( sprintf ( 'Table "%s" does not have association "%s"' , $ this -> table -> getAlias ( ) , $ name ) ) ; } return $ this -> table -> getAssociation ( $ name ) ; }
Retrieves table association by aliased field name.

Example: 'Author.name'

@param string $field Field name
@return \Cake\ORM\Association|null
@throws \RuntimeException When invalid association is found
Retrieves table association by aliased field name .