findContent() protected method

Find record from Content Type and Content Id.
protected findContent ( string $tablename, integer $contentId ) : array
$tablename string Table name
$contentId integer Content Id
return array
 /**
  * Delete a record.
  *
  * @param string  $contenttype
  * @param integer $id
  *
  * @throws \Bolt\Exception\StorageException
  *
  * @return integer The number of affected rows.
  */
 public function deleteContent($contenttype, $id)
 {
     if (empty($contenttype)) {
         $this->app['logger.system']->error('Contenttype is required for' . __FUNCTION__, ['event' => 'exception']);
         throw new StorageException('Contenttype is required for ' . __FUNCTION__);
     }
     $synced = false;
     if (is_string($contenttype)) {
         $ct = $this->getContentType($contenttype);
         $synced = $ct['blimp_mode'] === 'sync';
     } else {
         $synced = $contenttype['blimp_mode'] === 'sync';
         $contenttype = $contenttype['slug'];
     }
     $collection = $this->getContentTypeCollection($contenttype);
     // Test that the record exists in the database
     if ($synced) {
         $oldContent = parent::findContent(parent::getContenttypeTablename($contenttype), $id);
     } else {
         $oldContent = $this->findContent($collection, $id);
     }
     if (empty($oldContent)) {
         throw new StorageException('Attempted to delete a non-existent record');
     }
     $real_id = null;
     if ($synced) {
         if (!empty($oldContent['blimp_id'])) {
             $real_id = $oldContent['blimp_id'];
         }
     } else {
         $real_id = $id;
     }
     // Dispatch pre-delete event
     if (!$synced && $this->app['dispatcher']->hasListeners(StorageEvents::PRE_DELETE)) {
         $event = new StorageEvent($oldContent, ['contenttype' => $contenttype]);
         $this->app['dispatcher']->dispatch(StorageEvents::PRE_DELETE, $event);
     }
     $this->logDelete($contenttype, $id, $oldContent);
     if (!empty($real_id)) {
         $uri = $collection . '/' . $real_id;
         $res = $this->app['blimp_client.request']('DELETE', $uri);
         if ($res['status'] == 200 || $synced && $res['status'] == 404) {
             if ($synced) {
                 return $this->app['storage']->deleteContent($contenttype, $id);
             }
             if ($this->app['dispatcher']->hasListeners(StorageEvents::POST_DELETE)) {
                 $event = new StorageEvent($oldContent, ['contenttype' => $contenttype]);
                 $this->app['dispatcher']->dispatch(StorageEvents::POST_DELETE, $event);
             }
             return 1;
         }
     } else {
         return $this->app['storage']->deleteContent($contenttype, $id);
     }
     return 0;
 }