79 $row = $this->db->getDataRow($select);
84 return new \ElggRiverItem($row);
100 if (!empty($item->view) && !$this->views->viewExists($item->view)) {
104 if (empty($item->action_type)) {
108 if (empty($item->subject_guid) || !$this->entityTable->exists($item->subject_guid)) {
112 if (empty($item->object_guid) || !$this->entityTable->exists($item->object_guid)) {
116 if (!empty($item->target_guid) && !$this->entityTable->exists($item->target_guid)) {
120 if (!empty($item->annotation_id) && !$this->annotationsTable->get($item->annotation_id)) {
124 $created = $item->posted ?? $this->
getCurrentTime()->getTimestamp();
126 if (!$this->events->triggerBefore(
'create',
'river', $item)) {
134 'subject_guid' => $insert->param($item->subject_guid,
ELGG_VALUE_GUID),
136 'target_guid' => $insert->param($item->target_guid ?? 0,
ELGG_VALUE_GUID),
137 'annotation_id' => $insert->param($item->annotation_id ?? 0,
ELGG_VALUE_ID),
141 $id = $this->db->insertData($insert);
147 $item->posted = $created;
149 $this->events->triggerAfter(
'create',
'river', $item);
166 if (!$this->events->triggerBefore(
'delete',
'river',
$item)) {
175 $this->events->triggerAfter(
'delete',
'river',
$item);
create(\ElggRiverItem $item)
Save a river item to the database.
trait TimeUsing
Adds methods for setting the current time (for testing)
getCurrentTime($modifier= '')
Get the (cloned) time.
static intoTable($table)
{}
const ELGG_VALUE_TIMESTAMP
static fromTable($table, $alias=null)
{}
Interfaces with the database to perform CRUD operations on annotations.
River table database action.
__construct(Database $db, AnnotationsTable $annotationsTable, EntityTable $entityTable, EventsService $events, ViewsService $views)
Create the river table service.
$id
Generic annotation delete action.
static fromTable($table, $alias=null)
{}
Entity table database service.