本文整理汇总了PHP中Picture::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Picture::getTitle方法的具体用法?PHP Picture::getTitle怎么用?PHP Picture::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Picture
的用法示例。
在下文中一共展示了Picture::getTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePicture
/**
*
* @param Picture $picture_
* @throws InvalidArgumentException
*/
public function updatePicture(Picture $picture_)
{
try {
if (isset($this->table) && is_null($this->table)) {
throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
}
if (isset($this->id) && !is_null($this->id)) {
$where = 'id = ' . $this->id;
}
//Existance test
$picture = $this->selectPicture();
if (!emptyObjectMethod($picture)) {
$picture = $this->selectPicture();
$path = $picture->getPath();
$title = $picture->getTitle();
$ext = $picture->getExtension();
if (file_exists(UPLOAD_PATH . $path . $title . '.' . $ext)) {
if (!is_null($picture_->getTitle()) && $title !== $picture_->getTitle()) {
if (!rename(UPLOAD_PATH . $path . $title . '.' . $ext, UPLOAD_PATH . $path . $picture_->getTitle() . '.' . $ext)) {
throw new Exception('A problem occurred when renaming !');
}
}
}
} else {
throw new Exception('Picture doesn\'t exist !');
}
return parent::update($this->table, $picture_, $where);
} catch (InvalidArgumentException $e) {
print $e->getMessage();
exit;
} catch (Exception $e) {
print $e->getMessage();
exit;
}
}