public function testContains() { $col = new PropelObjectCollection(); $books = PropelQuery::from('Book')->find(); $this->assertFalse($col->contains($books[0])); $this->assertFalse($col->contains($books[1])); $col[] = $books[0]; $this->assertTrue($col->contains($books[0])); $this->assertFalse($col->contains($books[1])); }
public function testContains() { $col = new PropelObjectCollection(); $book1 = new Book(); $book1->setTitle('Foo'); $book2 = new Book(); $book2->setTitle('Bar'); $col = new PropelObjectCollection(); $this->assertFalse($col->contains($book1)); $this->assertFalse($col->contains($book2)); $col[] = $book1; $this->assertTrue($col->contains($book1)); $this->assertFalse($col->contains($book2)); }
/** * Method called to associate a Propiedadvalor object to this object * through the Propiedadvalor foreign key attribute. * * @param Propiedadvalor $l Propiedadvalor * @return Propiedad The current object (for fluent API support) */ public function addPropiedadvalor(Propiedadvalor $l) { if ($this->collPropiedadvalors === null) { $this->initPropiedadvalors(); $this->collPropiedadvalorsPartial = true; } if (!in_array($l, $this->collPropiedadvalors->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddPropiedadvalor($l); if ($this->propiedadvalorsScheduledForDeletion and $this->propiedadvalorsScheduledForDeletion->contains($l)) { $this->propiedadvalorsScheduledForDeletion->remove($this->propiedadvalorsScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a Articulo object to this object * through the Articulo foreign key attribute. * * @param Articulo $l Articulo * @return Tipo The current object (for fluent API support) */ public function addArticulo(Articulo $l) { if ($this->collArticulos === null) { $this->initArticulos(); $this->collArticulosPartial = true; } if (!in_array($l, $this->collArticulos->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddArticulo($l); if ($this->articulosScheduledForDeletion and $this->articulosScheduledForDeletion->contains($l)) { $this->articulosScheduledForDeletion->remove($this->articulosScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a DetailTransaksi object to this object * through the DetailTransaksi foreign key attribute. * * @param DetailTransaksi $l DetailTransaksi * @return Transaksi The current object (for fluent API support) */ public function addDetailTransaksi(DetailTransaksi $l) { if ($this->collDetailTransaksis === null) { $this->initDetailTransaksis(); $this->collDetailTransaksisPartial = true; } if (!in_array($l, $this->collDetailTransaksis->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddDetailTransaksi($l); if ($this->detailTransaksisScheduledForDeletion and $this->detailTransaksisScheduledForDeletion->contains($l)) { $this->detailTransaksisScheduledForDeletion->remove($this->detailTransaksisScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a Gastofacturacion object to this object * through the Gastofacturacion foreign key attribute. * * @param Gastofacturacion $l Gastofacturacion * @return Categoriagasto The current object (for fluent API support) */ public function addGastofacturacion(Gastofacturacion $l) { if ($this->collGastofacturacions === null) { $this->initGastofacturacions(); $this->collGastofacturacionsPartial = true; } if (!in_array($l, $this->collGastofacturacions->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddGastofacturacion($l); if ($this->gastofacturacionsScheduledForDeletion and $this->gastofacturacionsScheduledForDeletion->contains($l)) { $this->gastofacturacionsScheduledForDeletion->remove($this->gastofacturacionsScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a LinkBarangRak object to this object * through the LinkBarangRak foreign key attribute. * * @param LinkBarangRak $l LinkBarangRak * @return Rak The current object (for fluent API support) */ public function addLinkBarangRak(LinkBarangRak $l) { if ($this->collLinkBarangRaks === null) { $this->initLinkBarangRaks(); $this->collLinkBarangRaksPartial = true; } if (!in_array($l, $this->collLinkBarangRaks->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddLinkBarangRak($l); if ($this->linkBarangRaksScheduledForDeletion and $this->linkBarangRaksScheduledForDeletion->contains($l)) { $this->linkBarangRaksScheduledForDeletion->remove($this->linkBarangRaksScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a Expedientehistorial object to this object * through the Expedientehistorial foreign key attribute. * * @param Expedientehistorial $l Expedientehistorial * @return Servicioestado The current object (for fluent API support) */ public function addExpedientehistorial(Expedientehistorial $l) { if ($this->collExpedientehistorials === null) { $this->initExpedientehistorials(); $this->collExpedientehistorialsPartial = true; } if (!in_array($l, $this->collExpedientehistorials->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddExpedientehistorial($l); if ($this->expedientehistorialsScheduledForDeletion and $this->expedientehistorialsScheduledForDeletion->contains($l)) { $this->expedientehistorialsScheduledForDeletion->remove($this->expedientehistorialsScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a Medicoespecialidad object to this object * through the Medicoespecialidad foreign key attribute. * * @param Medicoespecialidad $l Medicoespecialidad * @return Especialidad The current object (for fluent API support) */ public function addMedicoespecialidad(Medicoespecialidad $l) { if ($this->collMedicoespecialidads === null) { $this->initMedicoespecialidads(); $this->collMedicoespecialidadsPartial = true; } if (!in_array($l, $this->collMedicoespecialidads->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddMedicoespecialidad($l); if ($this->medicoespecialidadsScheduledForDeletion and $this->medicoespecialidadsScheduledForDeletion->contains($l)) { $this->medicoespecialidadsScheduledForDeletion->remove($this->medicoespecialidadsScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a Cajachicadetalle object to this object * through the Cajachicadetalle foreign key attribute. * * @param Cajachicadetalle $l Cajachicadetalle * @return Gasto The current object (for fluent API support) */ public function addCajachicadetalle(Cajachicadetalle $l) { if ($this->collCajachicadetalles === null) { $this->initCajachicadetalles(); $this->collCajachicadetallesPartial = true; } if (!in_array($l, $this->collCajachicadetalles->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCajachicadetalle($l); if ($this->cajachicadetallesScheduledForDeletion and $this->cajachicadetallesScheduledForDeletion->contains($l)) { $this->cajachicadetallesScheduledForDeletion->remove($this->cajachicadetallesScheduledForDeletion->search($l)); } } return $this; }
/** * Associate a User object to this object * through the user_skill cross reference table. * * @param User $user The UserSkill object to relate * @return Skill The current object (for fluent API support) */ public function addUser(User $user) { if ($this->collUsers === null) { $this->initUsers(); } if (!$this->collUsers->contains($user)) { // only add it if the **same** object is not already associated $this->doAddUser($user); $this->collUsers[] = $user; if ($this->usersScheduledForDeletion and $this->usersScheduledForDeletion->contains($user)) { $this->usersScheduledForDeletion->remove($this->usersScheduledForDeletion->search($user)); } } return $this; }
/** * Method called to associate a SubscriberGroupMembership object to this object * through the SubscriberGroupMembership foreign key attribute. * * @param SubscriberGroupMembership $l SubscriberGroupMembership * @return Subscriber The current object (for fluent API support) */ public function addSubscriberGroupMembership(SubscriberGroupMembership $l) { if ($this->collSubscriberGroupMemberships === null) { $this->initSubscriberGroupMemberships(); $this->collSubscriberGroupMembershipsPartial = true; } if (!in_array($l, $this->collSubscriberGroupMemberships->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddSubscriberGroupMembership($l); if ($this->subscriberGroupMembershipsScheduledForDeletion and $this->subscriberGroupMembershipsScheduledForDeletion->contains($l)) { $this->subscriberGroupMembershipsScheduledForDeletion->remove($this->subscriberGroupMembershipsScheduledForDeletion->search($l)); } } return $this; }
$nb_creneau_a_saisir = 0; //il faut calculer le nombre de creneau a saisir pour faire un colspan if ($current_creneau != null && $current_creneau->getPrimaryKey() == $edt_creneau->getPrimaryKey()) { $creneau_courant=$i; $afficheEleve[$elv]['creneau_courant']=$i; // on va faire une boucle pour calculer le nombre de creneaux dans ce cours if ($current_cours == null) { $nb_creneau_a_saisir = 1; $absences_du_creneau = $eleve->getAbsenceEleveSaisiesDuCreneau($edt_creneau, $dt_date_absence_eleve); } else { //$nb_creneau_a_saisir = 0; $dt_fin_cours = $current_cours->getHeureFin(null); $it_creneau = $edt_creneau; $absences_du_creneau = new PropelObjectCollection(); while ($it_creneau != null && $dt_fin_cours->format('U') > $it_creneau->getHeuredebutDefiniePeriode('U')) { foreach ($eleve->getAbsenceEleveSaisiesDuCreneau($it_creneau, $dt_date_absence_eleve) as $abs) { if (!$absences_du_creneau->contains($abs)) { $absences_du_creneau->append($abs); } } $it_creneau = $it_creneau->getNextEdtCreneau(); $nb_creneau_a_saisir++; } } // pour le creneau en cours on garde uniquement les absences de l'utilisateur pour ne pas l'influencer par d'autres saisies sauf si configuré autrement if (getSettingValue("abs2_afficher_saisies_creneau_courant")!='y') { $absences_du_creneau_du_prof = new PropelObjectCollection(); foreach ($absences_du_creneau as $abs) { if ($abs->getUtilisateurId() == $utilisateur->getPrimaryKey()) { $absences_du_creneau_du_prof->append($abs); } }
/** * Method called to associate a Ordencompra object to this object * through the Ordencompra foreign key attribute. * * @param Ordencompra $l Ordencompra * @return Proveedor The current object (for fluent API support) */ public function addOrdencompra(Ordencompra $l) { if ($this->collOrdencompras === null) { $this->initOrdencompras(); $this->collOrdencomprasPartial = true; } if (!in_array($l, $this->collOrdencompras->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddOrdencompra($l); if ($this->ordencomprasScheduledForDeletion and $this->ordencomprasScheduledForDeletion->contains($l)) { $this->ordencomprasScheduledForDeletion->remove($this->ordencomprasScheduledForDeletion->search($l)); } } return $this; }
/** * Adds an element to the internal $collNestedSetChildren collection. * Beware that this doesn't insert a node in the tree. * This method is only used to facilitate children hydration. * * @param Especialidad $especialidad * * @return void */ public function addNestedSetChild($especialidad) { if ($this->collNestedSetChildren === null) { $this->initNestedSetChildren(); } if (!$this->collNestedSetChildren->contains($especialidad)) { // only add it if the **same** object is not already associated $this->collNestedSetChildren[] = $especialidad; $especialidad->setParent($this); } }
public function testContainsMatchesSimilarNewObjects() { $col = new PropelObjectCollection(); $b1 = new Book(); $b1->setTitle('Bar'); $b2 = clone $b1; $this->assertFalse($col->contains($b1), 'contains() returns false on an empty collection'); $col = new PropelObjectCollection(array($b1)); $this->assertTrue($col->contains($b1)); $this->assertTrue($col->contains($b2)); }
/** * Method called to associate a LanguageObjectHistory object to this object * through the LanguageObjectHistory foreign key attribute. * * @param LanguageObjectHistory $l LanguageObjectHistory * @return ContentObject The current object (for fluent API support) */ public function addLanguageObjectHistory(LanguageObjectHistory $l) { if ($this->collLanguageObjectHistorys === null) { $this->initLanguageObjectHistorys(); $this->collLanguageObjectHistorysPartial = true; } if (!in_array($l, $this->collLanguageObjectHistorys->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddLanguageObjectHistory($l); if ($this->languageObjectHistorysScheduledForDeletion and $this->languageObjectHistorysScheduledForDeletion->contains($l)) { $this->languageObjectHistorysScheduledForDeletion->remove($this->languageObjectHistorysScheduledForDeletion->search($l)); } } return $this; }
/** * Method called to associate a NewsletterMailing object to this object * through the NewsletterMailing foreign key attribute. * * @param NewsletterMailing $l NewsletterMailing * @return Newsletter The current object (for fluent API support) */ public function addNewsletterMailing(NewsletterMailing $l) { if ($this->collNewsletterMailings === null) { $this->initNewsletterMailings(); $this->collNewsletterMailingsPartial = true; } if (!in_array($l, $this->collNewsletterMailings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddNewsletterMailing($l); if ($this->newsletterMailingsScheduledForDeletion and $this->newsletterMailingsScheduledForDeletion->contains($l)) { $this->newsletterMailingsScheduledForDeletion->remove($this->newsletterMailingsScheduledForDeletion->search($l)); } } return $this; }
/** * Adds an element to the internal $collNestedSetChildren collection. * Beware that this doesn't insert a node in the tree. * This method is only used to facilitate children hydration. * * @param Causadiferido $causadiferido * * @return void */ public function addNestedSetChild($causadiferido) { if ($this->collNestedSetChildren === null) { $this->initNestedSetChildren(); } if (!$this->collNestedSetChildren->contains($causadiferido)) { // only add it if the **same** object is not already associated $this->collNestedSetChildren[] = $causadiferido; $causadiferido->setParent($this); } }
/** * Method called to associate a Reference object to this object * through the Reference foreign key attribute. * * @param Reference $l Reference * @return User The current object (for fluent API support) */ public function addReferenceRelatedByUpdatedBy(Reference $l) { if ($this->collReferencesRelatedByUpdatedBy === null) { $this->initReferencesRelatedByUpdatedBy(); $this->collReferencesRelatedByUpdatedByPartial = true; } if (!in_array($l, $this->collReferencesRelatedByUpdatedBy->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddReferenceRelatedByUpdatedBy($l); if ($this->referencesRelatedByUpdatedByScheduledForDeletion and $this->referencesRelatedByUpdatedByScheduledForDeletion->contains($l)) { $this->referencesRelatedByUpdatedByScheduledForDeletion->remove($this->referencesRelatedByUpdatedByScheduledForDeletion->search($l)); } } return $this; }
/** * Associate a Court object to this object * through the player_court cross reference table. * * @param Court $court The PlayerCourt object to relate * @return Player The current object (for fluent API support) */ public function addCourt(Court $court) { if ($this->collCourts === null) { $this->initCourts(); } if (!$this->collCourts->contains($court)) { // only add it if the **same** object is not already associated $this->doAddCourt($court); $this->collCourts[] = $court; if ($this->courtsScheduledForDeletion and $this->courtsScheduledForDeletion->contains($court)) { $this->courtsScheduledForDeletion->remove($this->courtsScheduledForDeletion->search($court)); } } return $this; }
/** * Method called to associate a Traspaso object to this object * through the Traspaso foreign key attribute. * * @param Traspaso $l Traspaso * @return Lugar The current object (for fluent API support) */ public function addTraspasoRelatedByIdlugarremitente(Traspaso $l) { if ($this->collTraspasosRelatedByIdlugarremitente === null) { $this->initTraspasosRelatedByIdlugarremitente(); $this->collTraspasosRelatedByIdlugarremitentePartial = true; } if (!in_array($l, $this->collTraspasosRelatedByIdlugarremitente->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddTraspasoRelatedByIdlugarremitente($l); if ($this->traspasosRelatedByIdlugarremitenteScheduledForDeletion and $this->traspasosRelatedByIdlugarremitenteScheduledForDeletion->contains($l)) { $this->traspasosRelatedByIdlugarremitenteScheduledForDeletion->remove($this->traspasosRelatedByIdlugarremitenteScheduledForDeletion->search($l)); } } return $this; }