public function getFirstParent($parentClassName)
    {
        $foundParent = null;

        $this->alongParents(function ($parent) use ($parentClassName, &$foundParent) {
            if ($parent instanceof $parentClassName) {
                $foundParent = $parent;

                return false;
            }

            return true;
        });

        if (null === $foundParent) {
            throw new EntryNotFoundException(
                'The parent "' . $parentClassName . '" was not found in this object (class "' . get_class($this) . '"). Use the function "hasParent()" before your call to this function!',
                1471379635
            );
        }

        return $foundParent;
    }
public function getFirstParent($parentClassName)
    {
        $foundParent = null;

        $this->alongParents(function ($parent) use ($parentClassName, &$foundParent) {
            if ($parent instanceof $parentClassName) {
                $foundParent = $parent;

                return false;
            }

            return true;
        });

        if (null === $foundParent) {
            throw new EntryNotFoundException(
                'The parent "' . $parentClassName . '" was not found in this object (class "' . get_class($this) . '"). Use the function "hasParent()" before your call to this function!',
                1471379635
            );
        }

        return $foundParent;
    }
public function getFirstParent ( $ parentClassName ) { $ foundParent = null ; $ this -> alongParents ( function ( $ parent ) use ( $ parentClassName , & $ foundParent ) { if ( $ parent instanceof $ parentClassName ) { $ foundParent = $ parent ; return false ; } return true ; } ) ; if ( null === $ foundParent ) { throw new EntryNotFoundException ( 'The parent "' . $ parentClassName . '" was not found in this object (class "' . get_class ( $ this ) . '"). Use the function "hasParent()" before your call to this function!' , 1471379635 ) ; } return $ foundParent ; }
Returns the first found instance of the desired parent.

An exception is thrown if the parent is not found. It is advised to use
the function `hasParent()` before using this function.

@param string $parentClassName Name of the parent class.
@return object
@throws EntryNotFoundException
Returns the first found instance of the desired parent .