本文整理汇总了PHP中Writer::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::save方法的具体用法?PHP Writer::save怎么用?PHP Writer::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Writer
的用法示例。
在下文中一共展示了Writer::save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeUpdate
public function executeUpdate()
{
$i18n = new sfI18N();
$i18n->initialize($this->getContext());
$i18n->setCulture($this->getUser()->getCulture());
$action_i18n = $i18n->globalMessageFormat->format('save as new');
$action_edit_i18n = $i18n->globalMessageFormat->format('edit');
$action_type = $this->getRequestParameter('action_type');
if ($action_type == $action_i18n || !$this->getRequestParameter('id', 0)) {
$catalog = new Catalog();
} else {
$catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($catalog);
}
$catalog->setId($this->getRequestParameter('id'));
$catalog->setCatLanguageId($this->getRequestParameter('cat_language_id'));
$catalog->setCatCategoryId($this->getRequestParameter('cat_category_id'));
$catalog->setCatSubjectId($this->getRequestParameter('cat_subject_id'));
$catalog->setTitle($this->getRequestParameter('title'));
$catalog->setSubtitle($this->getRequestParameter('subtitle'));
$catalog->setPublishedYear($this->getRequestParameter('published_year'));
$catalog->setPublishedLocation($this->getRequestParameter('published_location'));
$catalog->setIsbn($this->getRequestParameter('isbn'));
$catalog->setStudentNo($this->getRequestParameter('student_no'));
$catalog->setStudentName($this->getRequestParameter('student_name'));
$catalog->setStudentMajor($this->getRequestParameter('student_major'));
$catalog->setStudentTutor($this->getRequestParameter('student_tutor'));
$catalog->setVersion($this->getRequestParameter('version'));
$catalog->setEdition($this->getRequestParameter('edition'));
$catalog->setPrintNo($this->getRequestParameter('print_no'));
$catalog->setPart($this->getRequestParameter('part'));
$catalog->setVolume($this->getRequestParameter('volume'));
$catalog->setMonth($this->getRequestParameter('month'));
$catalog->setYear($this->getRequestParameter('year'));
$catalog->setNo($this->getRequestParameter('no'));
$catalog->setBonus($this->getRequestParameter('bonus'));
$catalog->setPages($this->getRequestParameter('pages'));
$catalog->setHeight($this->getRequestParameter('height'));
$catalog->setSynopsis($this->getRequestParameter('synopsis'));
$catalog->setAbstracts($this->getRequestParameter('abstracts'));
$catalog->setSearchKeywords($this->getRequestParameter('search_keywords'));
//publisher
if ($action_type == $action_i18n || !$this->getRequestParameter('publisher_id')) {
$publisher = new Publisher();
$publisher->setId($this->getRequestParameter('publisher_id'));
$publisher->setName($this->getRequestParameter('publisher_name'));
$publisher->save();
$catalog->setPublisher($publisher);
$catalog->save();
} elseif ($action_type !== $action_i18n || !$this->getRequestParameter('publisher_id')) {
$publisher = new Publisher();
$publisher->setId($this->getRequestParameter('publisher_id'));
$publisher->setName($this->getRequestParameter('publisher_name'));
$publisher->save();
$catalog->setPublisher($publisher);
$catalog->save();
} elseif ($this->getRequestParameter('publisher_id')) {
$catalog->setPublisherId($this->getRequestParameter('publisher_id'));
$catalog->save();
}
//writer
#if ($this->getRequestParameter('cat_category_id') != 3 && $this->getRequestParameter('cat_category_id') != 2) {
if ($this->hasRequestParameter('writers_id') && $this->getRequestParameter('writers_id') != null && $this->getRequestParameter('writers_id') != '') {
$name = $this->getRequestParameter('writers_name');
$c = new Criteria();
$c->add(WriterPeer::NAME, "%{$name}%", Criteria::LIKE);
$rows = WriterPeer::doSelect($c);
if ($rows != null) {
$catalog->updateWriters($this->getRequestParameter('writers_name'));
$catalog->save();
} else {
$writer = new Writer();
$writer->setId($this->getRequestParameter('writers_id'));
$writer->setName($this->getRequestParameter('writers_name'));
$writer->save();
$cw = new CatalogWriter();
$cw->setCatalog($catalog);
$cw->setWriter($writer);
$cw->save();
}
} elseif ($action_type !== $action_i18n || !$this->getRequestParameter('writer_id')) {
$writer = new Writer();
$writer->setName($this->getRequestParameter('writers_name'));
$writer->save();
$cw = new CatalogWriter();
$cw->setCatalog($catalog);
$cw->setWriter($writer);
$cw->save();
} else {
$writer = new Writer();
$writer->setName($this->getRequestParameter('writers_name'));
$writer->save();
$cw = new CatalogWriter();
$cw->setCatalog($catalog);
$cw->setWriter($writer);
$cw->save();
}
#}
$writer_name = $catalog->getFirstWriterName();
$writer_name = preg_replace('/\\W+/', '', $writer_name);
//.........这里部分代码省略.........