diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 6e899e0b37..602b7cebec 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -1139,7 +1139,7 @@ class V1Controller extends Controller 'mime_type' => $record->get_mime(), 'title' => $record->get_title(), 'original_name' => $record->get_original_name(), - 'updated_on' => $record->get_modification_date()->format(DATE_ATOM), + 'updated_on' => $record->getUpdated()->format(DATE_ATOM), 'created_on' => $record->getCreated()->format(DATE_ATOM), 'collection_id' => $record->get_collection_id(), 'base_id' => $record->get_base_id(), @@ -1215,7 +1215,7 @@ class V1Controller extends Controller '@entity@' => self::OBJECT_TYPE_STORY, 'databox_id' => $story->get_sbas_id(), 'story_id' => $story->get_record_id(), - 'updated_on' => $story->get_modification_date()->format(DATE_ATOM), + 'updated_on' => $story->getUpdated()->format(DATE_ATOM), 'created_on' => $story->getCreated()->format(DATE_ATOM), 'collection_id' => \phrasea::collFromBas($this->app, $story->get_base_id()), 'thumbnail' => $this->listEmbeddableMedia($request, $story, $story->get_thumbnail()), diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index c35b0d3dda..979a064684 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -73,7 +73,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface /** @var string */ private $uuid; /** @var DateTime */ - private $modification_date; + private $updated; /** @var Application */ protected $app; @@ -135,10 +135,16 @@ class record_adapter implements RecordInterface, cache_cacheableInterface /** * @return DateTime + * @deprecated use {@link self::getUpdated} instead */ public function get_modification_date() { - return $this->modification_date; + return $this->getUpdated(); + } + + public function getUpdated() + { + return $this->updated; } /** @@ -1822,12 +1828,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface return $this->get_type(); } - /** {@inheritdoc} */ - public function getUpdated() - { - return $this->get_modification_date(); - } - /** {@inheritdoc} */ public function getUuid() { @@ -1888,7 +1888,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $this->type = $data['type']; $this->grouping = $data['grouping']; $this->uuid = $data['uuid']; - $this->modification_date = $data['modification_date']; + $this->updated = $data['modification_date']; $this->created = $data['creation_date']; $this->base_id = $data['base_id']; $this->collection_id = $data['collection_id']; @@ -1905,7 +1905,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface 'type' => $this->type, 'grouping' => $this->grouping, 'uuid' => $this->uuid, - 'modification_date' => $this->modification_date, + 'modification_date' => $this->updated, 'creation_date' => $this->created, 'base_id' => $this->base_id, 'collection_id' => $this->collection_id, @@ -1922,7 +1922,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $this->collection_id = (int)$row['coll_id']; $this->base_id = (int)phrasea::baseFromColl($this->get_sbas_id(), $this->collection_id, $this->app); $this->created = new DateTime($row['credate']); - $this->modification_date = new DateTime($row['moddate']); + $this->updated = new DateTime($row['moddate']); $this->uuid = $row['uuid']; $this->grouping = ($row['parent_record_id'] == '1'); diff --git a/tests/classes/record/adapterTest.php b/tests/classes/record/adapterTest.php index 7b88cfc5eb..50f7b318e2 100644 --- a/tests/classes/record/adapterTest.php +++ b/tests/classes/record/adapterTest.php @@ -110,14 +110,14 @@ class record_adapterTest extends \PhraseanetAuthenticatedTestCase $this->assertTrue(Uuid::isValid($this->getRecord1()->get_uuid())); } - public function testGet_modification_date() + public function testGetUpdated() { $date_obj = new DateTime(); $record_1 = $this->getRecord1(); - $this->assertTrue(($record_1->getCreated() instanceof DateTime)); + $this->assertTrue(($record_1->getUpdated() instanceof DateTime)); $this->assertTrue( $record_1->getCreated() <= $date_obj, - sprintf('Asserting that %s is before %s', $record_1->getCreated()->format(DATE_ATOM), $date_obj->format(DATE_ATOM)) + sprintf('Asserting that %s is before %s', $record_1->getUpdated()->format(DATE_ATOM), $date_obj->format(DATE_ATOM)) ); }