Skip to content

Commit

Permalink
Added missing destoy function for BasicContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel committed Sep 2, 2015
1 parent d3e3780 commit 09cfc5d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions ObjectManager/BasicContent.php
Expand Up @@ -55,6 +55,7 @@ function() use( $repository, $languageCode, $contentType, $fields, $location )
}
);

$this->addObjectToList( $content );
return $content->contentInfo->mainLocationId;
}

Expand Down Expand Up @@ -107,10 +108,28 @@ private function mapContentPath( $path )
}

/**
* NOT USED FOR NOW
* Deletes the content object provided
* used to clean after testing
*/
protected function destroy( ValueObject $object )
{
// do nothing for now, to be implemented later when decided waht to do with the created objects
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$contentId = $object->id;
$repository->sudo(
function() use( $repository, $contentId )
{
try
{
$contentService = $repository->getContentService();
$contentInfo = $contentService->loadContentInfo( $contentId );
$contentService->deleteContent( $contentInfo );
}
catch ( ApiExceptions\NotFoundException $e )
{
// Nothing to do
}
}
);
}
}

0 comments on commit 09cfc5d

Please sign in to comment.