public function getField($fieldName, $biDirectional = false, $contentTypeName = null, $contentTypeId = null)
    {
        if ($biDirectional) {
            $filter = function ($el) use ($fieldName, $contentTypeName, $contentTypeId) {
                /** @var Entity\Relations $el */
                if ($el->getFromContenttype() === $fieldName && $el->getFromContenttype() === $el->getToContenttype() && $el->getToId() == $contentTypeId) {
                    $el->actAsInverse();

                    return true;
                }
                if ($el->getToContenttype() === $fieldName && $el->getFromContenttype() === $contentTypeName) {
                    return true;
                }
                if ($el->getFromContenttype() === $fieldName && $el->getToContenttype() === $contentTypeName) {
                    $el->actAsInverse();

                    return true;
                }

                return false;
            };

            return $this->filter($filter);
        }

        return $this->filter(function ($el) use ($fieldName) {
            /** @var Entity\Relations $el */
            return $el->getToContenttype() === $fieldName;
        });
    }
public function getField($fieldName, $biDirectional = false, $contentTypeName = null, $contentTypeId = null)
    {
        if ($biDirectional) {
            $filter = function ($el) use ($fieldName, $contentTypeName, $contentTypeId) {
                /** @var Entity\Relations $el */
                if ($el->getFromContenttype() === $fieldName && $el->getFromContenttype() === $el->getToContenttype() && $el->getToId() == $contentTypeId) {
                    $el->actAsInverse();

                    return true;
                }
                if ($el->getToContenttype() === $fieldName && $el->getFromContenttype() === $contentTypeName) {
                    return true;
                }
                if ($el->getFromContenttype() === $fieldName && $el->getToContenttype() === $contentTypeName) {
                    $el->actAsInverse();

                    return true;
                }

                return false;
            };

            return $this->filter($filter);
        }

        return $this->filter(function ($el) use ($fieldName) {
            /** @var Entity\Relations $el */
            return $el->getToContenttype() === $fieldName;
        });
    }
public function getField ( $ fieldName , $ biDirectional = false , $ contentTypeName = null , $ contentTypeId = null ) { if ( $ biDirectional ) { $ filter = function ( $ el ) use ( $ fieldName , $ contentTypeName , $ contentTypeId ) { /** @var Entity\Relations $el */ if ( $ el -> getFromContenttype ( ) === $ fieldName && $ el -> getFromContenttype ( ) === $ el -> getToContenttype ( ) && $ el -> getToId ( ) == $ contentTypeId ) { $ el -> actAsInverse ( ) ; return true ; } if ( $ el -> getToContenttype ( ) === $ fieldName && $ el -> getFromContenttype ( ) === $ contentTypeName ) { return true ; } if ( $ el -> getFromContenttype ( ) === $ fieldName && $ el -> getToContenttype ( ) === $ contentTypeName ) { $ el -> actAsInverse ( ) ; return true ; } return false ; } ; return $ this -> filter ( $ filter ) ; } return $ this -> filter ( function ( $ el ) use ( $ fieldName ) { /** @var Entity\Relations $el */ return $ el -> getToContenttype ( ) === $ fieldName ; } ) ; }
Gets a specific relation type name from the overall collection.

@param string $fieldName
@param bool   $biDirectional
@param string $contentTypeName
@param int    $contentTypeId

@return Relations
Gets a specific relation type name from the overall collection .