forked from Public/pics
Asset: introduce save method
This commit is contained in:
parent
cf6adbf80c
commit
8613054d69
@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
class Asset
|
class Asset
|
||||||
{
|
{
|
||||||
protected $id_asset;
|
public $id_asset;
|
||||||
protected $id_user_uploaded;
|
public $id_user_uploaded;
|
||||||
protected $subdir;
|
public $subdir;
|
||||||
protected $filename;
|
public $filename;
|
||||||
protected $title;
|
public $title;
|
||||||
protected $slug;
|
public $slug;
|
||||||
protected $mimetype;
|
public $mimetype;
|
||||||
protected $image_width;
|
public $image_width;
|
||||||
protected $image_height;
|
public $image_height;
|
||||||
protected $date_captured;
|
public $date_captured;
|
||||||
protected $priority;
|
public $priority;
|
||||||
|
|
||||||
protected $meta;
|
protected $meta;
|
||||||
protected $tags;
|
protected $tags;
|
||||||
@ -675,6 +675,28 @@ class Asset
|
|||||||
FROM assets');
|
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)
|
public function setKeyData($title, $slug, DateTime $date_captured = null, $priority)
|
||||||
{
|
{
|
||||||
$params = [
|
$params = [
|
||||||
|
Loading…
Reference in New Issue
Block a user