Skip to content

Commit

Permalink
Merge pull request #37 from City-of-Helsinki/UHF-X-fix-created-time
Browse files Browse the repository at this point in the history
Added ::getCreatedTime() method back
  • Loading branch information
tuutti authored Jun 24, 2021
2 parents 0451fe1 + 861d98b commit 2176f18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Entity/Listing/ListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function buildHeader() {
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\helfi_tpr\Entity\Unit $entity */
/** @var \Drupal\helfi_tpr\Entity\TprEntityBase $entity */
$row['id'] = $entity->toLink($entity->id());
$row['created'] = $this->dateFormatter->format($entity->getCreatedTime());
$row['changed'] = $this->dateFormatter->format($entity->getChangedTime());
Expand Down
12 changes: 12 additions & 0 deletions src/Entity/TprEntityBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ public function getChangedTime() : ? int {
return $value ? (int) $value : NULL;
}

/**
* Gets the created time.
*
* @return int|null
* The timestamp.
*/
public function getCreatedTime() : ? int {
$value = $this->get('content_translation_created')->value;

return $value ? (int) $value : NULL;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 2176f18

Please sign in to comment.