You are here

protected function OpignoGroupManagerController::hasItem in Opigno group manager 3.x

Same name and namespace in other branches
  1. 8 src/Controller/OpignoGroupManagerController.php \Drupal\opigno_group_manager\Controller\OpignoGroupManagerController::hasItem()

Checking if the group contain item.

Parameters

int $group_id:

int $entity_id:

string $content_type:

Return value

bool

1 call to OpignoGroupManagerController::hasItem()
OpignoGroupManagerController::addItem in src/Controller/OpignoGroupManagerController.php
This method adds an item (content) in the learning path.

File

src/Controller/OpignoGroupManagerController.php, line 526

Class

OpignoGroupManagerController
Controller for all the actions of the Opigno group manager app.

Namespace

Drupal\opigno_group_manager\Controller

Code

protected function hasItem($group_id, $entity_id, $content_type) {
  if (empty($group_id) || empty($entity_id) || empty($content_type)) {
    return FALSE;
  }
  $query = $this->database
    ->select('opigno_group_content', 'gc')
    ->condition('gc.group_id', $group_id)
    ->condition('gc.group_content_type_id', $content_type)
    ->condition('gc.entity_id', $entity_id)
    ->fields('gc', [
    'id',
  ]);
  $result = $query
    ->execute()
    ->fetchField();
  if (!empty($result)) {
    return TRUE;
  }
  return FALSE;
}