本文整理匯總了PHP中Participant::getUnique方法的典型用法代碼示例。如果您正苦於以下問題:PHP Participant::getUnique方法的具體用法?PHP Participant::getUnique怎麽用?PHP Participant::getUnique使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Participant
的用法示例。
在下文中一共展示了Participant::getUnique方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
public function add(Participant $participant)
{
$db = $this->connection();
$sql = "INSERT INTO {$this->dbTable} (" . self::$key . ", " . self::$name . ") VALUES (?, ?)";
$params = array($participant->getUnique(), $participant->getName());
$query = $db->prepare($sql);
$query->execute($params);
foreach ($participant->getProjects()->toArray() as $project) {
$sql = "INSERT INTO " . self::$projectTable . " (" . self::$key . ", " . self::$name . ", participantUnique) VALUES (?, ?, ?)";
$query = $db->prepare($sql);
$query->execute(array($project->getUnique(), $project->getName(), $participant->getUnique()));
}
}
示例2: contains
/**
* Check if a participant can be found within the list.
*
* @param \model\Participant $participant The needle to look for.
*
* @return Boolean
*/
public function contains(Participant $participant)
{
foreach ($this->portfolioOwners as $key => $owner) {
if ($owner->getUnique() == $participant->getUnique() && $owner->getName() == $participant->getName()) {
return true;
}
}
return false;
}