public function shouldSkipClass(ClassMetadata $metadata, Context $context)
    {
        $obj = null;
        // Get the last item of the visiting set
        foreach ($context->getVisitingSet() as $item) {
            $obj = $item;
        }

        if ($obj && $obj instanceof Block && $obj->getParent() && $obj->getParent()->getTemplate() && $obj->getContent() && $obj->getContentId() != $this->content->getId()) {
            return true;
        }

        return false;
    }
public function shouldSkipClass(ClassMetadata $metadata, Context $context)
    {
        $obj = null;
        // Get the last item of the visiting set
        foreach ($context->getVisitingSet() as $item) {
            $obj = $item;
        }

        if ($obj && $obj instanceof Block && $obj->getParent() && $obj->getParent()->getTemplate() && $obj->getContent() && $obj->getContentId() != $this->content->getId()) {
            return true;
        }

        return false;
    }
public function shouldSkipClass ( ClassMetadata $ metadata , Context $ context ) { $ obj = null ; // Get the last item of the visiting set foreach ( $ context -> getVisitingSet ( ) as $ item ) { $ obj = $ item ; } if ( $ obj && $ obj instanceof Block && $ obj -> getParent ( ) && $ obj -> getParent ( ) -> getTemplate ( ) && $ obj -> getContent ( ) && $ obj -> getContentId ( ) != $ this -> content -> getId ( ) ) { return true ; } return false ; }
Skip blocks of a content item that are children of a template block and do not match the content id.
The reason for this is that template blocks could have children from different content items

{@inheritdoc}
Skip blocks of a content item that are children of a template block and do not match the content id . The reason for this is that template blocks could have children from different content items