Started adding case count func to actor
This commit is contained in:
parent
be7f5fc591
commit
4ee9cd5bef
@ -207,6 +207,16 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getCountOfCaseProvisions(array $conditions = []): int {
|
||||
$query = \Drupal::entityQuery('oc_case_provision');
|
||||
$query->condition('oc_provider', $this->id());
|
||||
// foreach($conditions as $condition) {
|
||||
// $query->condition($condition);
|
||||
// }
|
||||
return count($query->execute());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -331,6 +341,11 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true);
|
||||
|
||||
$fields['total_cases'] = BaseFieldDefinition::create('integer')
|
||||
->setLabel(t('Number of Cases'))
|
||||
->setRevisionable(TRUE)
|
||||
->setDisplayConfigurable('view', true);
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Created'))
|
||||
->setDescription(t('The time that the entity was created.'));
|
||||
|
Reference in New Issue
Block a user