本文整理汇总了PHP中PropelCollection::isFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP PropelCollection::isFirst方法的具体用法?PHP PropelCollection::isFirst怎么用?PHP PropelCollection::isFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropelCollection
的用法示例。
在下文中一共展示了PropelCollection::isFirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsFirst
public function testIsFirst()
{
$col = new PropelCollection();
$this->assertTrue($col->isFirst(), 'isFirst() returns true on an empty collection');
$data = array('bar1', 'bar2', 'bar3');
$col = new PropelCollection($data);
$expectedRes = array(true, false, false);
foreach ($col as $element) {
$this->assertEquals(array_shift($expectedRes), $col->isFirst(), 'isFirst() returns true only for the first element');
$this->assertEquals($element, $col->getCurrent(), 'isFirst() does not change the current position');
}
}
示例2: getDescription
/**
*
* Renvoi une description intelligible du traitement
*
* @return String description
*
*/
public function getDescription() {
if (!isset($description) || $description === null) {
$desc = 'n° '.$this->getId();
$desc .= ' créé le ';
$desc .= strftime("%a %d/%m/%Y", $this->getUpdatedAt('U'));
$eleve_col = new PropelCollection();
foreach ($this->getAbsenceEleveSaisies() as $abs_saisie) {
if ($abs_saisie->getEleve() != null) {
$eleve_col->add($abs_saisie->getEleve());
}
}
foreach ($eleve_col as $eleve) {
if ($eleve_col->isFirst()) {
$desc .= '; ';
}
$desc .= $eleve->getNom().' '.$eleve->getPrenom();
if (!$eleve_col->isLast()) {
$desc .= ', ';
}
}
if ($this->getAbsenceEleveType() != null) {
$desc .= "; type : ".$this->getAbsenceEleveType()->getNom();
}
if ($this->getAbsenceEleveMotif() != null) {
$desc .= "; motif : ".$this->getAbsenceEleveMotif()->getNom();
}
if ($this->getAbsenceEleveJustification() != null) {
$desc .= "; justification : ".$this->getAbsenceEleveJustification()->getNom();
}
$notif = false;
foreach ($this->getAbsenceEleveNotifications() as $notification) {
if ($notification->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_SUCCES
|| $notification->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_SUCCES_AVEC_ACCUSE_DE_RECEPTION) {
$notif = true;
break;
}
}
if ($notif) {
$desc .= "; Notifié";
}
if ($this->getCommentaire() != null && $this->getCommentaire() != '') {
$desc .= "; Commentaire : ".$this->getCommentaire();
}
$description = $desc;
}
return $description;
}