本文整理汇总了PHP中Publisher::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Publisher::setId方法的具体用法?PHP Publisher::setId怎么用?PHP Publisher::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToStringUsesDefaultStringFormat
public function testToStringUsesDefaultStringFormat()
{
$author = new Author();
$author->setFirstName('John');
$author->setLastName('Doe');
$expected = <<<EOF
Id: null
FirstName: John
LastName: Doe
Email: null
Age: null
EOF;
$this->assertEquals($expected, (string) $author, 'generated __toString() uses default string format and exportTo()');
$publisher = new Publisher();
$publisher->setId(345345);
$publisher->setName('Peguinoo');
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<Id>345345</Id>
<Name><![CDATA[Peguinoo]]></Name>
</data>
EOF;
$this->assertEquals($expected, (string) $publisher, 'generated __toString() uses default string format and exportTo()');
}
示例2: setUp
protected function setUp()
{
parent::setUp();
$publisher = new Publisher();
$publisher->setId(1234);
$publisher->setName('Penguin');
$author = new Author();
$author->setId(5678);
$author->setFirstName('George');
$author->setLastName('Byron');
$book = new Book();
$book->setId(9012);
$book->setTitle('Don Juan');
$book->setISBN('0140422161');
$book->setPrice(12.99);
$book->setAuthor($author);
$book->setPublisher($publisher);
$this->book = $book;
}
示例3: testToStringUsesCustomStringFormat
public function testToStringUsesCustomStringFormat()
{
$coll = new PropelObjectCollection();
$coll->setModel('Publisher');
$publisher = new Publisher();
$publisher->setId(12345);
$publisher->setName('Penguinoo');
$coll[] = $publisher;
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<Publisher>
<Id>12345</Id>
<Name><![CDATA[Penguinoo]]></Name>
</Publisher>
</data>
EOF;
$this->assertEquals($expected, (string) $coll);
}
示例4: 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);
//.........这里部分代码省略.........
示例5: getAllPublisher
function getAllPublisher()
{
$key = 'publisher';
$collection = CacheManager::get($key, TRUE);
if ($collection) {
return $collection;
}
$collection = new Collection();
$this->connect();
$result = $this->conn->query("CALL sp_get_all_publisher()");
if ($result) {
//$row = $result->fetch_assoc();
while ($obj = $result->fetch_object()) {
$publisher = new Publisher();
$publisher->setId($obj->Publisher_id);
$publisher->setName($obj->Name);
$publisher->setAddress($obj->Address);
$publisher->setPhone($obj->Phone);
$collection->addItem($publisher, $obj->Publisher_id);
}
$result->close();
// for fetch_object()
}
//$result->free_result(); // for fetch_assoc()
$this->close();
CacheManager::set($key, $collection, TRUE);
return $collection;
}