Commit fee4315b authored by nicola85's avatar nicola85

Issue #3030553 by jurgenhaas: State entity should also implement...

Issue #3030553 by jurgenhaas: State entity should also implement EntityChangedInterface and EntityOwnerInterface
parent 0a56b65d
......@@ -13,6 +13,7 @@ use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\bat_event\StateInterface;
use Drupal\user\UserInterface;
/**
* Defines the State entity.
......@@ -80,6 +81,27 @@ class State extends ContentEntityBase implements StateInterface {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this->get('uid')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
......@@ -115,6 +137,46 @@ class State extends ContentEntityBase implements StateInterface {
return $this->get('event_type')->entity;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('uid', $account->id());
return $this;
}
/**
* {@inheritdoc}
*/
public function setColor($color) {
$this->set('color', $color);
return $this;
}
/**
* {@inheritdoc}
*/
public function setCalendarLabel($calendar_label) {
$this->set('calendar_label', $calendar_label);
return $this;
}
/**
* {@inheritdoc}
*/
public function setBlocking($blocking) {
$this->set('blocking', $blocking);
return $this;
}
/**
* {@inheritdoc}
*/
......
......@@ -8,11 +8,13 @@
namespace Drupal\bat_event;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Provides an interface for defining State entities.
*/
interface StateInterface extends ContentEntityInterface {
interface StateInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
public function getMachineName();
......@@ -24,4 +26,10 @@ interface StateInterface extends ContentEntityInterface {
public function getEventType();
public function setColor($color);
public function setCalendarLabel($calendar_label);
public function setBlocking($blocking);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment