You are here

public static function OpignoGroupManagedLink::createWithValues in Opigno group manager 8

Same name and namespace in other branches
  1. 3.x src/Entity/OpignoGroupManagedLink.php \Drupal\opigno_group_manager\Entity\OpignoGroupManagedLink::createWithValues()

Helper method to create a new LPManagedLink.

It's not saved on creation. You have to do $obj->save() to save it in DB.

Parameters

int $group_id: The group entity ID.

int $parent_content_id: The parent content ID.

int $child_content_id: The child content ID.

int $required_score: The required score to go from the parent to the child content.

Return value

\Drupal\Core\Entity\EntityInterface|self OpignoGroupManagedLink object.

3 calls to OpignoGroupManagedLink::createWithValues()
OpignoGroupManagerController::addLink in src/Controller/OpignoGroupManagerController.php
Add a new link in the Learning Path.
OpignoGroupManagerController::updateEntities in src/Controller/OpignoGroupManagerController.php
Update entities ancestors.
OpignoGroupManagerController::updateLink in src/Controller/OpignoGroupManagerController.php
Update a link minimum score to go to next step.

File

src/Entity/OpignoGroupManagedLink.php, line 49

Class

OpignoGroupManagedLink
Defines the Opigno Group Link entity.

Namespace

Drupal\opigno_group_manager\Entity

Code

public static function createWithValues($group_id, $parent_content_id, $child_content_id, $required_score = 0, $required_activities = '') {
  $values = [
    'group_id' => $group_id,
    'parent_content_id' => $parent_content_id,
    'child_content_id' => $child_content_id,
    'required_score' => $required_score,
    'required_activities' => $required_activities,
  ];
  return parent::create($values);
}