src/Listener/RelatedModelsListener.php
public function getAssociatedByName($names)
    {
        $return = [];

        $table = $this->_table();
        foreach ($names as $association) {
            $associationClass = $table->associations()->get($association);
            if (!$associationClass) {
                throw new RuntimeException(sprintf(
                    'Table "%s" is not associated with "%s"',
                    get_class($table),
                    $association
                ));
            }
            $return[$associationClass->getName()] = $associationClass;
        }

        return $return;
    }
public function getAssociatedByName($names)
    {
        $return = [];

        $table = $this->_table();
        foreach ($names as $association) {
            $associationClass = $table->associations()->get($association);
            if (!$associationClass) {
                throw new RuntimeException(sprintf(
                    'Table "%s" is not associated with "%s"',
                    get_class($table),
                    $association
                ));
            }
            $return[$associationClass->getName()] = $associationClass;
        }

        return $return;
    }
public function getAssociatedByName ( $ names ) { $ return = [ ] ; $ table = $ this -> _table ( ) ; foreach ( $ names as $ association ) { $ associationClass = $ table -> associations ( ) -> get ( $ association ) ; if ( ! $ associationClass ) { throw new RuntimeException ( sprintf ( 'Table "%s" is not associated with "%s"' , get_class ( $ table ) , $ association ) ) ; } $ return [ $ associationClass -> getName ( ) ] = $ associationClass ; } return $ return ; }
Get associated tables based on the current table instance based on their
association name

@param array $names Association names
@return array
@throws \RuntimeException when association not found.
Get associated tables based on the current table instance based on their association name