You are here

function CdbController::dynamic_banner_load_banner in Dynamic Banner 8

Fetch a specific banner from the database.

File

src/application/Controller/CdbController.php, line 95

Class

CdbController

Namespace

Drupal\dynamic_banner\application\Controller

Code

function dynamic_banner_load_banner($dbid) {

  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
  $query = \Drupal::database()
    ->select('dynamic_banner', 'd');
  $query
    ->condition('d.dbid', $dbid, '=')
    ->fields('d');
  $result = $query
    ->execute()
    ->fetchObject();
  if ($result) {
    return $result;
  }
  return NULL;
}