Deprecated get_modification_date

This commit is contained in:
Benoît Burnichon
2015-07-13 16:58:27 +02:00
parent 9fea438079
commit e14b2155aa
3 changed files with 16 additions and 16 deletions

View File

@@ -1139,7 +1139,7 @@ class V1Controller extends Controller
'mime_type' => $record->get_mime(), 'mime_type' => $record->get_mime(),
'title' => $record->get_title(), 'title' => $record->get_title(),
'original_name' => $record->get_original_name(), '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), 'created_on' => $record->getCreated()->format(DATE_ATOM),
'collection_id' => $record->get_collection_id(), 'collection_id' => $record->get_collection_id(),
'base_id' => $record->get_base_id(), 'base_id' => $record->get_base_id(),
@@ -1215,7 +1215,7 @@ class V1Controller extends Controller
'@entity@' => self::OBJECT_TYPE_STORY, '@entity@' => self::OBJECT_TYPE_STORY,
'databox_id' => $story->get_sbas_id(), 'databox_id' => $story->get_sbas_id(),
'story_id' => $story->get_record_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), 'created_on' => $story->getCreated()->format(DATE_ATOM),
'collection_id' => \phrasea::collFromBas($this->app, $story->get_base_id()), 'collection_id' => \phrasea::collFromBas($this->app, $story->get_base_id()),
'thumbnail' => $this->listEmbeddableMedia($request, $story, $story->get_thumbnail()), 'thumbnail' => $this->listEmbeddableMedia($request, $story, $story->get_thumbnail()),

View File

@@ -73,7 +73,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
/** @var string */ /** @var string */
private $uuid; private $uuid;
/** @var DateTime */ /** @var DateTime */
private $modification_date; private $updated;
/** @var Application */ /** @var Application */
protected $app; protected $app;
@@ -135,10 +135,16 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
/** /**
* @return DateTime * @return DateTime
* @deprecated use {@link self::getUpdated} instead
*/ */
public function get_modification_date() 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(); return $this->get_type();
} }
/** {@inheritdoc} */
public function getUpdated()
{
return $this->get_modification_date();
}
/** {@inheritdoc} */ /** {@inheritdoc} */
public function getUuid() public function getUuid()
{ {
@@ -1888,7 +1888,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$this->type = $data['type']; $this->type = $data['type'];
$this->grouping = $data['grouping']; $this->grouping = $data['grouping'];
$this->uuid = $data['uuid']; $this->uuid = $data['uuid'];
$this->modification_date = $data['modification_date']; $this->updated = $data['modification_date'];
$this->created = $data['creation_date']; $this->created = $data['creation_date'];
$this->base_id = $data['base_id']; $this->base_id = $data['base_id'];
$this->collection_id = $data['collection_id']; $this->collection_id = $data['collection_id'];
@@ -1905,7 +1905,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
'type' => $this->type, 'type' => $this->type,
'grouping' => $this->grouping, 'grouping' => $this->grouping,
'uuid' => $this->uuid, 'uuid' => $this->uuid,
'modification_date' => $this->modification_date, 'modification_date' => $this->updated,
'creation_date' => $this->created, 'creation_date' => $this->created,
'base_id' => $this->base_id, 'base_id' => $this->base_id,
'collection_id' => $this->collection_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->collection_id = (int)$row['coll_id'];
$this->base_id = (int)phrasea::baseFromColl($this->get_sbas_id(), $this->collection_id, $this->app); $this->base_id = (int)phrasea::baseFromColl($this->get_sbas_id(), $this->collection_id, $this->app);
$this->created = new DateTime($row['credate']); $this->created = new DateTime($row['credate']);
$this->modification_date = new DateTime($row['moddate']); $this->updated = new DateTime($row['moddate']);
$this->uuid = $row['uuid']; $this->uuid = $row['uuid'];
$this->grouping = ($row['parent_record_id'] == '1'); $this->grouping = ($row['parent_record_id'] == '1');

View File

@@ -110,14 +110,14 @@ class record_adapterTest extends \PhraseanetAuthenticatedTestCase
$this->assertTrue(Uuid::isValid($this->getRecord1()->get_uuid())); $this->assertTrue(Uuid::isValid($this->getRecord1()->get_uuid()));
} }
public function testGet_modification_date() public function testGetUpdated()
{ {
$date_obj = new DateTime(); $date_obj = new DateTime();
$record_1 = $this->getRecord1(); $record_1 = $this->getRecord1();
$this->assertTrue(($record_1->getCreated() instanceof DateTime)); $this->assertTrue(($record_1->getUpdated() instanceof DateTime));
$this->assertTrue( $this->assertTrue(
$record_1->getCreated() <= $date_obj, $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))
); );
} }