public function getParent()
    {
        if ($this->parentRelation === null && $this->isParentRelationResolved === false) {
            $this->isParentRelationResolved = true;

            try {
                $source = $this->getObject();
                if ($source instanceof AttachmentContainerInterface) {
                    $model = $this->modelFactory()->create(self::class)->loadFrom('attachment_id', $source->id());
                    if ($model->id()) {
                        $this->parentRelation = $model;
                    }
                }
            } catch (Exception $e) {
                throw new LogicException(sprintf(
                    'Could not load the parent relationship: %s',
                    $e->getMessage()
                ), 0, $e);
            }
        }

        return $this->parentRelation;
    }
public function getParent()
    {
        if ($this->parentRelation === null && $this->isParentRelationResolved === false) {
            $this->isParentRelationResolved = true;

            try {
                $source = $this->getObject();
                if ($source instanceof AttachmentContainerInterface) {
                    $model = $this->modelFactory()->create(self::class)->loadFrom('attachment_id', $source->id());
                    if ($model->id()) {
                        $this->parentRelation = $model;
                    }
                }
            } catch (Exception $e) {
                throw new LogicException(sprintf(
                    'Could not load the parent relationship: %s',
                    $e->getMessage()
                ), 0, $e);
            }
        }

        return $this->parentRelation;
    }
public function getParent ( ) { if ( $ this -> parentRelation === null && $ this -> isParentRelationResolved === false ) { $ this -> isParentRelationResolved = true ; try { $ source = $ this -> getObject ( ) ; if ( $ source instanceof AttachmentContainerInterface ) { $ model = $ this -> modelFactory ( ) -> create ( self :: class ) -> loadFrom ( 'attachment_id' , $ source -> id ( ) ) ; if ( $ model -> id ( ) ) { $ this -> parentRelation = $ model ; } } } catch ( Exception $ e ) { throw new LogicException ( sprintf ( 'Could not load the parent relationship: %s' , $ e -> getMessage ( ) ) , 0 , $ e ) ; } } return $ this -> parentRelation ; }
Retrieve the parent relationship, if any.

@todo   Add support for multiple parents.
@throws LogicException If the relationship is broken or incomplete.
@return JoinInterface|null
Retrieve the parent relationship if any .