deleteContent() public method

Delete a record.
public deleteContent ( string $contenttype, integer $id ) : integer
$contenttype string
$id integer
return integer The number of affected rows.
Example #1
0
 public function testDeleteContent()
 {
     $app = $this->getApp();
     $app['request'] = Request::create('/');
     $storage = new Storage($app);
     // Test delete fails on missing params
     $this->setExpectedException('Bolt\\Exception\\StorageException', 'Contenttype is required for deleteContent');
     $this->assertFalse($storage->deleteContent('', 999));
     $content = $storage->getContent('showcases/1');
     // Test the delete events are triggered
     $delete = 0;
     $listener = function () use(&$delete) {
         $delete++;
     };
     $app['dispatcher']->addListener(StorageEvents::PRE_DELETE, $listener);
     $app['dispatcher']->addListener(StorageEvents::POST_DELETE, $listener);
     $storage->deleteContent(['slug' => 'showcases'], 1);
     $this->assertFalse($storage->getContent('showcases/1'));
     $this->assertEquals(2, $delete);
 }