Add NullableDateTime formatting class

This commit is contained in:
Benoît Burnichon
2016-04-05 18:52:17 +02:00
parent aeac1a7141
commit d0dcdf6e6f
9 changed files with 49 additions and 36 deletions

View File

@@ -26,6 +26,7 @@ use Alchemy\Phrasea\Core\Event\Acl\SysadminChangedEvent;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\RecordInterface;
use Alchemy\Phrasea\Model\RecordReferenceInterface;
use Alchemy\Phrasea\Utilities\NullableDateTime;
use Doctrine\DBAL\DBALException;
@@ -1706,10 +1707,10 @@ class ACL implements cache_cacheableInterface
}
$params = [
':usr_id' => $this->user->getId()
, ':base_id' => $base_id
, 'limited_from' => ($limit_from ? $limit_from->format(DATE_ISO8601) : null)
, 'limited_to' => ($limit_to ? $limit_to->format(DATE_ISO8601) : null)
':usr_id' => $this->user->getId(),
':base_id' => $base_id,
'limited_from' => NullableDateTime::format($limit_from, DATE_ISO8601),
'limited_to' => NullableDateTime::format($limit_to, DATE_ISO8601),
];
$stmt = $this->app->getApplicationBox()->get_connection()->prepare($sql);

View File

@@ -10,6 +10,7 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Utilities\NullableDateTime;
class Bridge_Element
{
@@ -383,9 +384,9 @@ class Bridge_Element
SET uploaded_on = :uploaded_on, updated_on = :update WHERE id = :id';
$params = [
':uploaded_on' => $this->uploaded_on ? $this->uploaded_on->format(DATE_ISO8601) : null
, ':id' => $this->id
, ':update' => $this->updated_on->format(DATE_ISO8601)
':uploaded_on' => NullableDateTime::format($this->uploaded_on, DATE_ISO8601),
':id' => $this->id,
':update' => $this->updated_on->format(DATE_ISO8601),
];
$stmt = $this->app->getApplicationBox()->get_connection()->prepare($sql);

View File

@@ -11,6 +11,7 @@
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
use Alchemy\Phrasea\Utilities\NullableDateTime;
use Guzzle\Http\Url;
use MediaAlchemyst\Alchemyst;
use MediaVorus\Media\MediaInterface;
@@ -206,8 +207,8 @@ SQL;
'physically_present' => $this->is_physically_present,
'is_substituted' => $this->is_substituted,
'subdef_id' => $this->subdef_id,
'updated_on' => $this->modification_date ? $this->modification_date->format(DATE_ATOM) : '',
'created_on' => $this->creation_date ? $this->creation_date->format(DATE_ATOM) : '',
'updated_on' => NullableDateTime::format($this->modification_date),
'created_on' => NullableDateTime::format($this->creation_date),
'etag' => $this->etag,
'url' => (string)$this->url,
];