Doctrine\ODM\PHPCR\Mapping\ClassMetadata::getAssociation PHP Method

getAssociation() public method

public getAssociation ( $fieldName ) : array
return array the association mapping with the field of this name
    public function getAssociation($fieldName)
    {
        if (!$this->hasAssociation($fieldName)) {
            throw MappingException::associationNotFound($this->name, $fieldName);
        }
        return $this->mappings[$fieldName];
    }

Usage Example

 /**
  * @depends testClassName
  *
  * @expectedException \Doctrine\ODM\PHPCR\Mapping\MappingException
  */
 public function testGetAssociationNonexisting(ClassMetadata $cm)
 {
     $cm->getAssociation('nonexisting');
 }
ClassMetadata