本文整理汇总了PHP中Author::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::setId方法的具体用法?PHP Author::setId怎么用?PHP Author::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::setId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToArrayDeep
public function testToArrayDeep()
{
$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);
$coll = new PropelObjectCollection();
$coll->setModel('Book');
$coll[] = $book;
$expected = array(array('Id' => 9012, 'Title' => 'Don Juan', 'ISBN' => '0140422161', 'Price' => 12.99, 'PublisherId' => null, 'AuthorId' => 5678, 'Author' => array('Id' => 5678, 'FirstName' => 'George', 'LastName' => 'Byron', 'Email' => null, 'Age' => null, 'Books' => array('Book_0' => '*RECURSION*'))));
$this->assertEquals($expected, $coll->toArray());
}
示例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: getPublishedPaperAuthors
/**
* Retrieve all authors from published papers
* @param $schedConfId int
* @return $authors array Author Objects
*/
function getPublishedPaperAuthors($schedConfId)
{
$primaryLocale = AppLocale::getPrimaryLocale();
$locale = AppLocale::getLocale();
$authors = array();
$result =& $this->retrieve('SELECT aa.*,
aspl.setting_value AS affiliation_pl,
asl.setting_value AS affiliation_l
FROM authors aa
LEFT JOIN published_papers pa ON (pa.paper_id = aa.submission_id)
LEFT JOIN author_settings aspl ON (aspl.author_id = aa.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
LEFT JOIN author_settings asl ON (asl.author_id = aa.author_id AND asl.setting_name = ? AND asl.locale = ?)
WHERE pa.sched_conf_id = ?', array('affiliation', $primaryLocale, 'affiliation', $locale, (int) $schedConfId));
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setSubmissionId($row['paper_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation_pl'], $primaryLocale);
$author->setAffiliation($row['affiliation_l'], $locale);
$author->setEmail($row['email']);
$author->setBiography($row['biography']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$authors[] = $author;
$result->moveNext();
}
$result->Close();
unset($result);
return $authors;
}
示例4: testEquals
/**
* Test the BaseObject#equals().
*/
public function testEquals()
{
$b = BookPeer::doSelectOne(new Criteria());
$c = new Book();
$c->setId($b->getId());
$this->assertTrue($b->equals($c), "Expected Book objects to be equal()");
$a = new Author();
$a->setId($b->getId());
$this->assertFalse($b->equals($a), "Expected Book and Author with same primary key NOT to match.");
}
示例5: getPublishedPaperAuthors
/**
* Retrieve all authors from published papers
* @param $schedConfId int
* @return $authors array Author Objects
*/
function getPublishedPaperAuthors($schedConfId)
{
$authors = array();
$result =& $this->retrieve('SELECT aa.* FROM paper_authors aa, published_papers pa WHERE aa.paper_id = pa.paper_id AND pa.sched_conf_id = ? ORDER BY pa.sched_conf_id', $schedConfId);
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setPaperId($row['paper_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation']);
$author->setEmail($row['email']);
$author->setBiography($row['biography']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$authors[] = $author;
$result->moveNext();
}
$result->Close();
unset($result);
return $authors;
}
示例6: Author
/**
* Internal function to return an Author object from a row.
* @param $row array
* @return Author
*/
function &_returnAuthorFromRow(&$row)
{
$author = new Author();
$author->setId($row['author_id']);
$author->setPaperId($row['paper_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation']);
$author->setCountry($row['country']);
$author->setEmail($row['email']);
$author->setUrl($row['url']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$this->getDataObjectSettings('paper_author_settings', 'author_id', $row['author_id'], $author);
HookRegistry::call('AuthorDAO::_returnAuthorFromRow', array(&$author, &$row));
return $author;
}
示例7: getPublishedArticleAuthors
/**
* Retrieve all authors from published articles
* @param $issueId int
* @return $authors array Author Objects
*/
function getPublishedArticleAuthors($issueId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$authors = array();
$result =& $this->retrieve('SELECT aa.*
FROM authors aa
LEFT JOIN published_articles pa ON (pa.article_id = aa.submission_id)
WHERE pa.issue_id = ? ORDER BY pa.issue_id', (int) $issueId);
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setSubmissionId($row['article_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation_pl'], $primaryLocale);
$author->setAffiliation($row['affiliation_l'], $locale);
$author->setEmail($row['email']);
$author->setBiography($row['biography']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$authors[] = $author;
$result->moveNext();
}
$result->Close();
unset($result);
return $authors;
}
示例8: testToKeyValue
public function testToKeyValue()
{
$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);
$coll = new PropelObjectCollection();
$coll->setModel('Book');
$coll->append($book);
$this->assertCount(1, $coll);
// This will call $book->getId()
$this->assertEquals(array(9012 => 'Don Juan'), $coll->toKeyValue('Id', 'Title'));
// This will call: $book->getAuthor()->getBooks()->getFirst()->getId()
$this->assertEquals(array(9012 => 'Don Juan'), $coll->toKeyValue(array('Author', 'Books', 'First', 'Id'), 'Title'));
}
示例9: getAllAuthor
function getAllAuthor()
{
$key = 'author';
$collection = CacheManager::get($key, TRUE);
if ($collection) {
return $collection;
}
$collection = new Collection();
$this->connect();
$result = $this->conn->query("CALL sp_get_all_author()");
if ($result) {
//$row = $result->fetch_assoc();
while ($obj = $result->fetch_object()) {
$author = new Author();
$author->setId($obj->Author_id);
$author->setName($obj->Author_name);
$collection->addItem($author, $obj->Author_id);
}
$result->close();
// for fetch_object()
}
//$result->free_result(); // for fetch_assoc()
$this->close();
CacheManager::set($key, $collection, TRUE);
return $collection;
}
示例10: _toObject
private function _toObject($row)
{
$author = new Author();
$author->setId($row->AvtorId);
$author->setFirstName($row->FirstName);
$author->setMiddleName($row->MiddleName);
$author->setLastName($row->LastName);
$author->setHomePage($row->HomePage);
$author->setNickname($row->NickName);
$author->setBooksNumber($row->BooksNumber);
return $author;
}