Asset: introduce save method
This commit is contained in:
parent
30bc0bb884
commit
e604b3aaa6
@ -8,17 +8,17 @@
|
||||
|
||||
class Asset
|
||||
{
|
||||
protected $id_asset;
|
||||
protected $id_user_uploaded;
|
||||
protected $subdir;
|
||||
protected $filename;
|
||||
protected $title;
|
||||
protected $slug;
|
||||
protected $mimetype;
|
||||
protected $image_width;
|
||||
protected $image_height;
|
||||
protected $date_captured;
|
||||
protected $priority;
|
||||
public $id_asset;
|
||||
public $id_user_uploaded;
|
||||
public $subdir;
|
||||
public $filename;
|
||||
public $title;
|
||||
public $slug;
|
||||
public $mimetype;
|
||||
public $image_width;
|
||||
public $image_height;
|
||||
public $date_captured;
|
||||
public $priority;
|
||||
|
||||
protected $meta;
|
||||
protected $tags;
|
||||
@ -675,6 +675,28 @@ class Asset
|
||||
FROM assets');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if (empty($this->id_asset))
|
||||
throw new UnexpectedValueException();
|
||||
|
||||
return Registry::get('db')->query('
|
||||
UPDATE assets
|
||||
SET id_asset = {int:id_asset},
|
||||
id_user_uploaded = {int:id_user_uploaded},
|
||||
subdir = {string:subdir},
|
||||
filename = {string:filename},
|
||||
title = {string:title},
|
||||
slug = {string:slug},
|
||||
mimetype = {string:mimetype},
|
||||
image_width = {int:image_width},
|
||||
image_height = {int:image_height},
|
||||
date_captured = {datetime:date_captured},
|
||||
priority = {int:priority}
|
||||
WHERE id_asset = {int:id_asset}',
|
||||
get_object_vars($this));
|
||||
}
|
||||
|
||||
public function setKeyData($title, $slug, DateTime $date_captured = null, $priority)
|
||||
{
|
||||
$params = [
|
||||
|
Loading…
Reference in New Issue
Block a user