protected function deleteRecord(Repository $repo, Content $entity)
    {
        $recordId = $entity->getId();
        /** @var Mapping\ContentType $contentType */
        $contentType = $entity->getContenttype();
        $contentTypeName = (string) $contentType;
        if (!$this->users->isAllowed("contenttype:$contentTypeName:delete:$recordId")) {
            $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));

            return false;
        }
        $result = $repo->delete($entity);
        if ($result) {
            $this->loggerSystem->info(sprintf('Deleted %s: %s', $contentType['singular_name'], $entity->getTitle()), ['event' => 'content']);
            $fieldRepo = $this->em->getRepository(FieldValue::class);
            $deleteFieldQuery = $fieldRepo->createQueryBuilder()
                ->delete($fieldRepo->getTableName())
                ->where('content_id = :content_id')
                ->andWhere('contenttype= :contenttype')
                ->setParameter('content_id', $recordId)
                ->setParameter('contenttype', $contentTypeName);
            $deleteFieldQuery->execute();
        }

        return $result;
    }
protected function deleteRecord(Repository $repo, Content $entity)
    {
        $recordId = $entity->getId();
        /** @var Mapping\ContentType $contentType */
        $contentType = $entity->getContenttype();
        $contentTypeName = (string) $contentType;
        if (!$this->users->isAllowed("contenttype:$contentTypeName:delete:$recordId")) {
            $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));

            return false;
        }
        $result = $repo->delete($entity);
        if ($result) {
            $this->loggerSystem->info(sprintf('Deleted %s: %s', $contentType['singular_name'], $entity->getTitle()), ['event' => 'content']);
            $fieldRepo = $this->em->getRepository(FieldValue::class);
            $deleteFieldQuery = $fieldRepo->createQueryBuilder()
                ->delete($fieldRepo->getTableName())
                ->where('content_id = :content_id')
                ->andWhere('contenttype= :contenttype')
                ->setParameter('content_id', $recordId)
                ->setParameter('contenttype', $contentTypeName);
            $deleteFieldQuery->execute();
        }

        return $result;
    }
protected function deleteRecord ( Repository $ repo , Content $ entity ) { $ recordId = $ entity -> getId ( ) ; /** @var Mapping\ContentType $contentType */ $ contentType = $ entity -> getContenttype ( ) ; $ contentTypeName = ( string ) $ contentType ; if ( ! $ this -> users -> isAllowed ( "contenttype:$contentTypeName:delete:$recordId" ) ) { $ this -> loggerFlash -> error ( Trans :: __ ( 'general.access-denied.content-not-modified' , [ '%title%' => $ entity -> getTitle ( ) ] ) ) ; return false ; } $ result = $ repo -> delete ( $ entity ) ; if ( $ result ) { $ this -> loggerSystem -> info ( sprintf ( 'Deleted %s: %s' , $ contentType [ 'singular_name' ] , $ entity -> getTitle ( ) ) , [ 'event' => 'content' ] ) ; $ fieldRepo = $ this -> em -> getRepository ( FieldValue :: class ) ; $ deleteFieldQuery = $ fieldRepo -> createQueryBuilder ( ) -> delete ( $ fieldRepo -> getTableName ( ) ) -> where ( 'content_id = :content_id' ) -> andWhere ( 'contenttype= :contenttype' ) -> setParameter ( 'content_id' , $ recordId ) -> setParameter ( 'contenttype' , $ contentTypeName ) ; $ deleteFieldQuery -> execute ( ) ; } return $ result ; }
Execute the deletion of a record.

@param Repository $repo
@param Content    $entity

@return bool
Execute the deletion of a record .