/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->articulosScheduledForDeletion !== null) { if (!$this->articulosScheduledForDeletion->isEmpty()) { ArticuloQuery::create()->filterByPrimaryKeys($this->articulosScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->articulosScheduledForDeletion = null; } } if ($this->collArticulos !== null) { foreach ($this->collArticulos as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aArticulo !== null) { if ($this->aArticulo->isModified() || $this->aArticulo->isNew()) { $affectedRows += $this->aArticulo->save($con); } $this->setArticulo($this->aArticulo); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->articulovariantevalorsScheduledForDeletion !== null) { if (!$this->articulovariantevalorsScheduledForDeletion->isEmpty()) { ArticulovariantevalorQuery::create()->filterByPrimaryKeys($this->articulovariantevalorsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->articulovariantevalorsScheduledForDeletion = null; } } if ($this->collArticulovariantevalors !== null) { foreach ($this->collArticulovariantevalors as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->propiedadvalorsScheduledForDeletion !== null) { if (!$this->propiedadvalorsScheduledForDeletion->isEmpty()) { PropiedadvalorQuery::create()->filterByPrimaryKeys($this->propiedadvalorsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->propiedadvalorsScheduledForDeletion = null; } } if ($this->collPropiedadvalors !== null) { foreach ($this->collPropiedadvalors as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->usersScheduledForDeletion !== null) { if (!$this->usersScheduledForDeletion->isEmpty()) { $pks = array(); $pk = $this->getPrimaryKey(); foreach ($this->usersScheduledForDeletion->getPrimaryKeys(false) as $remotePk) { $pks[] = array($remotePk, $pk); } UserSkillQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->usersScheduledForDeletion = null; } foreach ($this->getUsers() as $user) { if ($user->isModified()) { $user->save($con); } } } elseif ($this->collUsers) { foreach ($this->collUsers as $user) { if ($user->isModified()) { $user->save($con); } } } if ($this->userSkillsScheduledForDeletion !== null) { if (!$this->userSkillsScheduledForDeletion->isEmpty()) { UserSkillQuery::create()->filterByPrimaryKeys($this->userSkillsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->userSkillsScheduledForDeletion = null; } } if ($this->collUserSkills !== null) { foreach ($this->collUserSkills as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
public function testGetPrimaryKeys() { $books = new PropelObjectCollection(); $books->setModel('Book'); for ($i = 0; $i < 4; $i++) { $book = new Book(); $book->setTitle('Title' . $i); $book->save($this->con); $books[] = $book; } $pks = $books->getPrimaryKeys(); $this->assertEquals(4, count($pks)); $keys = array('Book_0', 'Book_1', 'Book_2', 'Book_3'); $this->assertEquals($keys, array_keys($pks)); $pks = $books->getPrimaryKeys(false); $keys = array(0, 1, 2, 3); $this->assertEquals($keys, array_keys($pks)); foreach ($pks as $key => $value) { $this->assertEquals($books[$key]->getPrimaryKey(), $value); } }
/** * Filter the query by a related SubscriberGroupMembership object * * @param SubscriberGroupMembership|PropelObjectCollection $subscriberGroupMembership the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return SubscriberQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterBySubscriberGroupMembership($subscriberGroupMembership, $comparison = null) { if ($subscriberGroupMembership instanceof SubscriberGroupMembership) { return $this->addUsingAlias(SubscriberPeer::ID, $subscriberGroupMembership->getSubscriberId(), $comparison); } elseif ($subscriberGroupMembership instanceof PropelObjectCollection) { return $this->useSubscriberGroupMembershipQuery()->filterByPrimaryKeys($subscriberGroupMembership->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterBySubscriberGroupMembership() only accepts arguments of type SubscriberGroupMembership or PropelCollection'); } }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->organizationsScheduledForDeletion !== null) { if (!$this->organizationsScheduledForDeletion->isEmpty()) { $pks = array(); $pk = $this->getPrimaryKey(); foreach ($this->organizationsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) { $pks[] = array($pk, $remotePk); } PluginOrganizationQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->organizationsScheduledForDeletion = null; } foreach ($this->getOrganizations() as $organization) { if ($organization->isModified()) { $organization->save($con); } } } elseif ($this->collOrganizations) { foreach ($this->collOrganizations as $organization) { if ($organization->isModified()) { $organization->save($con); } } } if ($this->productsScheduledForDeletion !== null) { if (!$this->productsScheduledForDeletion->isEmpty()) { $pks = array(); $pk = $this->getPrimaryKey(); foreach ($this->productsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) { $pks[] = array($remotePk, $pk); } ProductPluginQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->productsScheduledForDeletion = null; } foreach ($this->getProducts() as $product) { if ($product->isModified()) { $product->save($con); } } } elseif ($this->collProducts) { foreach ($this->collProducts as $product) { if ($product->isModified()) { $product->save($con); } } } if ($this->pluginOrganizationsScheduledForDeletion !== null) { if (!$this->pluginOrganizationsScheduledForDeletion->isEmpty()) { PluginOrganizationQuery::create()->filterByPrimaryKeys($this->pluginOrganizationsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->pluginOrganizationsScheduledForDeletion = null; } } if ($this->collPluginOrganizations !== null) { foreach ($this->collPluginOrganizations as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->pluginDatasScheduledForDeletion !== null) { if (!$this->pluginDatasScheduledForDeletion->isEmpty()) { PluginDataQuery::create()->filterByPrimaryKeys($this->pluginDatasScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->pluginDatasScheduledForDeletion = null; } } if ($this->collPluginDatas !== null) { foreach ($this->collPluginDatas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->productPluginsScheduledForDeletion !== null) { if (!$this->productPluginsScheduledForDeletion->isEmpty()) { ProductPluginQuery::create()->filterByPrimaryKeys($this->productPluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->productPluginsScheduledForDeletion = null; } } if ($this->collProductPlugins !== null) { foreach ($this->collProductPlugins as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Filter the query by a related NewsletterMailing object * * @param NewsletterMailing|PropelObjectCollection $newsletterMailing the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return NewsletterQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByNewsletterMailing($newsletterMailing, $comparison = null) { if ($newsletterMailing instanceof NewsletterMailing) { return $this->addUsingAlias(NewsletterPeer::ID, $newsletterMailing->getNewsletterId(), $comparison); } elseif ($newsletterMailing instanceof PropelObjectCollection) { return $this->useNewsletterMailingQuery()->filterByPrimaryKeys($newsletterMailing->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByNewsletterMailing() only accepts arguments of type NewsletterMailing or PropelCollection'); } }
/** * Filter the query by a related Expedientegasto object * * @param Expedientegasto|PropelObjectCollection $expedientegasto the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return GastofacturacionQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByExpedientegasto($expedientegasto, $comparison = null) { if ($expedientegasto instanceof Expedientegasto) { return $this->addUsingAlias(GastofacturacionPeer::IDGASTOFACTURACION, $expedientegasto->getIdgastofacturacion(), $comparison); } elseif ($expedientegasto instanceof PropelObjectCollection) { return $this->useExpedientegastoQuery()->filterByPrimaryKeys($expedientegasto->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByExpedientegasto() only accepts arguments of type Expedientegasto or PropelCollection'); } }
/** * Filter the query by a related Factura object * * @param Factura|PropelObjectCollection $factura the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PacientefacturacionQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByFactura($factura, $comparison = null) { if ($factura instanceof Factura) { return $this->addUsingAlias(PacientefacturacionPeer::IDPACIENTEFACTURACION, $factura->getIddatosfacturacion(), $comparison); } elseif ($factura instanceof PropelObjectCollection) { return $this->useFacturaQuery()->filterByPrimaryKeys($factura->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByFactura() only accepts arguments of type Factura or PropelCollection'); } }
/** * Filter the query by a related Barang object * * @param Barang|PropelObjectCollection $barang the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return KategoriQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByBarang($barang, $comparison = null) { if ($barang instanceof Barang) { return $this->addUsingAlias(KategoriPeer::ID, $barang->getIdKategori(), $comparison); } elseif ($barang instanceof PropelObjectCollection) { return $this->useBarangQuery()->filterByPrimaryKeys($barang->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByBarang() only accepts arguments of type Barang or PropelCollection'); } }
/** * Filter the query by a related Transaction object * * @param Transaction|PropelObjectCollection $transaction the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return UserQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByTransactionRelatedByUserId($transaction, $comparison = null) { if ($transaction instanceof Transaction) { return $this->addUsingAlias(UserPeer::ID, $transaction->getUserId(), $comparison); } elseif ($transaction instanceof PropelObjectCollection) { return $this->useTransactionRelatedByUserIdQuery()->filterByPrimaryKeys($transaction->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByTransactionRelatedByUserId() only accepts arguments of type Transaction or PropelCollection'); } }
/** * Filter the query by a related Venta object * * @param Venta|PropelObjectCollection $venta the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PacienteQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByVenta($venta, $comparison = null) { if ($venta instanceof Venta) { return $this->addUsingAlias(PacientePeer::IDPACIENTE, $venta->getIdpaciente(), $comparison); } elseif ($venta instanceof PropelObjectCollection) { return $this->useVentaQuery()->filterByPrimaryKeys($venta->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByVenta() only accepts arguments of type Venta or PropelCollection'); } }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aPageRelatedByCanonicalId !== null) { if ($this->aPageRelatedByCanonicalId->isModified() || $this->aPageRelatedByCanonicalId->isNew()) { $affectedRows += $this->aPageRelatedByCanonicalId->save($con); } $this->setPageRelatedByCanonicalId($this->aPageRelatedByCanonicalId); } if ($this->aUserRelatedByCreatedBy !== null) { if ($this->aUserRelatedByCreatedBy->isModified() || $this->aUserRelatedByCreatedBy->isNew()) { $affectedRows += $this->aUserRelatedByCreatedBy->save($con); } $this->setUserRelatedByCreatedBy($this->aUserRelatedByCreatedBy); } if ($this->aUserRelatedByUpdatedBy !== null) { if ($this->aUserRelatedByUpdatedBy->isModified() || $this->aUserRelatedByUpdatedBy->isNew()) { $affectedRows += $this->aUserRelatedByUpdatedBy->save($con); } $this->setUserRelatedByUpdatedBy($this->aUserRelatedByUpdatedBy); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->pagesRelatedByIdScheduledForDeletion !== null) { if (!$this->pagesRelatedByIdScheduledForDeletion->isEmpty()) { foreach ($this->pagesRelatedByIdScheduledForDeletion as $pageRelatedById) { // need to save related object because we set the relation to null $pageRelatedById->save($con); } $this->pagesRelatedByIdScheduledForDeletion = null; } } if ($this->collPagesRelatedById !== null) { foreach ($this->collPagesRelatedById as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->pagePropertysScheduledForDeletion !== null) { if (!$this->pagePropertysScheduledForDeletion->isEmpty()) { PagePropertyQuery::create()->filterByPrimaryKeys($this->pagePropertysScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->pagePropertysScheduledForDeletion = null; } } if ($this->collPagePropertys !== null) { foreach ($this->collPagePropertys as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->pageStringsScheduledForDeletion !== null) { if (!$this->pageStringsScheduledForDeletion->isEmpty()) { PageStringQuery::create()->filterByPrimaryKeys($this->pageStringsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->pageStringsScheduledForDeletion = null; } } if ($this->collPageStrings !== null) { foreach ($this->collPageStrings as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->contentObjectsScheduledForDeletion !== null) { if (!$this->contentObjectsScheduledForDeletion->isEmpty()) { ContentObjectQuery::create()->filterByPrimaryKeys($this->contentObjectsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->contentObjectsScheduledForDeletion = null; } } if ($this->collContentObjects !== null) { foreach ($this->collContentObjects as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->rightsScheduledForDeletion !== null) { if (!$this->rightsScheduledForDeletion->isEmpty()) { RightQuery::create()->filterByPrimaryKeys($this->rightsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rightsScheduledForDeletion = null; } } if ($this->collRights !== null) { foreach ($this->collRights as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Filter the query by a related Afiliado object * * @param Afiliado|PropelObjectCollection $afiliado the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return LocalidadQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByAfiliado($afiliado, $comparison = null) { if ($afiliado instanceof Afiliado) { return $this->addUsingAlias(LocalidadPeer::ID, $afiliado->getLocalidadId(), $comparison); } elseif ($afiliado instanceof PropelObjectCollection) { return $this->useAfiliadoQuery()->filterByPrimaryKeys($afiliado->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByAfiliado() only accepts arguments of type Afiliado or PropelCollection'); } }
/** * Filter the query by a related Procedimientregrogramado object * * @param Procedimientregrogramado|PropelObjectCollection $procedimientregrogramado the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return AgendaQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByProcedimientregrogramado($procedimientregrogramado, $comparison = null) { if ($procedimientregrogramado instanceof Procedimientregrogramado) { return $this->addUsingAlias(AgendaPeer::ID, $procedimientregrogramado->getAgendaId(), $comparison); } elseif ($procedimientregrogramado instanceof PropelObjectCollection) { return $this->useProcedimientregrogramadoQuery()->filterByPrimaryKeys($procedimientregrogramado->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByProcedimientregrogramado() only accepts arguments of type Procedimientregrogramado or PropelCollection'); } }
/** * Filter the query by a related Right object * * @param Right|PropelObjectCollection $right the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PageQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByRight($right, $comparison = null) { if ($right instanceof Right) { return $this->addUsingAlias(PagePeer::ID, $right->getPageId(), $comparison); } elseif ($right instanceof PropelObjectCollection) { return $this->useRightQuery()->filterByPrimaryKeys($right->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByRight() only accepts arguments of type Right or PropelCollection'); } }
/** * Filter the query by a related Agenda object * * @param Agenda|PropelObjectCollection $agenda the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return EventoqxQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByAgenda($agenda, $comparison = null) { if ($agenda instanceof Agenda) { return $this->addUsingAlias(EventoqxPeer::ID, $agenda->getEventoqxId(), $comparison); } elseif ($agenda instanceof PropelObjectCollection) { return $this->useAgendaQuery()->filterByPrimaryKeys($agenda->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByAgenda() only accepts arguments of type Agenda or PropelCollection'); } }
/** * Filter the query by a related OrganizationProduct object * * @param OrganizationProduct|PropelObjectCollection $organizationProduct the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ProductQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByOrganizationProduct($organizationProduct, $comparison = null) { if ($organizationProduct instanceof OrganizationProduct) { return $this->addUsingAlias(ProductPeer::ID, $organizationProduct->getProductId(), $comparison); } elseif ($organizationProduct instanceof PropelObjectCollection) { return $this->useOrganizationProductQuery()->filterByPrimaryKeys($organizationProduct->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByOrganizationProduct() only accepts arguments of type OrganizationProduct or PropelCollection'); } }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aConsultorio !== null) { if ($this->aConsultorio->isModified() || $this->aConsultorio->isNew()) { $affectedRows += $this->aConsultorio->save($con); } $this->setConsultorio($this->aConsultorio); } if ($this->aMedico !== null) { if ($this->aMedico->isModified() || $this->aMedico->isNew()) { $affectedRows += $this->aMedico->save($con); } $this->setMedico($this->aMedico); } if ($this->aPaciente !== null) { if ($this->aPaciente->isModified() || $this->aPaciente->isNew()) { $affectedRows += $this->aPaciente->save($con); } $this->setPaciente($this->aPaciente); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->cargoconsultasScheduledForDeletion !== null) { if (!$this->cargoconsultasScheduledForDeletion->isEmpty()) { CargoconsultaQuery::create()->filterByPrimaryKeys($this->cargoconsultasScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->cargoconsultasScheduledForDeletion = null; } } if ($this->collCargoconsultas !== null) { foreach ($this->collCargoconsultas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->consultaanticiposScheduledForDeletion !== null) { if (!$this->consultaanticiposScheduledForDeletion->isEmpty()) { ConsultaanticipoQuery::create()->filterByPrimaryKeys($this->consultaanticiposScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->consultaanticiposScheduledForDeletion = null; } } if ($this->collConsultaanticipos !== null) { foreach ($this->collConsultaanticipos as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->facturasScheduledForDeletion !== null) { if (!$this->facturasScheduledForDeletion->isEmpty()) { FacturaQuery::create()->filterByPrimaryKeys($this->facturasScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->facturasScheduledForDeletion = null; } } if ($this->collFacturas !== null) { foreach ($this->collFacturas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Filter the query by a related State object * * @param State|PropelObjectCollection $state the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CountryQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByState($state, $comparison = null) { if ($state instanceof State) { return $this->addUsingAlias(CountryPeer::ID, $state->getCountryId(), $comparison); } elseif ($state instanceof PropelObjectCollection) { return $this->useStateQuery()->filterByPrimaryKeys($state->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByState() only accepts arguments of type State or PropelCollection'); } }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aUser !== null) { if ($this->aUser->isModified() || $this->aUser->isNew()) { $affectedRows += $this->aUser->save($con); } $this->setUser($this->aUser); } if ($this->aOrganization !== null) { if ($this->aOrganization->isModified() || $this->aOrganization->isNew()) { $affectedRows += $this->aOrganization->save($con); } $this->setOrganization($this->aOrganization); } if ($this->aChartRelatedByForkedFrom !== null) { if ($this->aChartRelatedByForkedFrom->isModified() || $this->aChartRelatedByForkedFrom->isNew()) { $affectedRows += $this->aChartRelatedByForkedFrom->save($con); } $this->setChartRelatedByForkedFrom($this->aChartRelatedByForkedFrom); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->chartsRelatedByIdScheduledForDeletion !== null) { if (!$this->chartsRelatedByIdScheduledForDeletion->isEmpty()) { foreach ($this->chartsRelatedByIdScheduledForDeletion as $chartRelatedById) { // need to save related object because we set the relation to null $chartRelatedById->save($con); } $this->chartsRelatedByIdScheduledForDeletion = null; } } if ($this->collChartsRelatedById !== null) { foreach ($this->collChartsRelatedById as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->jobsScheduledForDeletion !== null) { if (!$this->jobsScheduledForDeletion->isEmpty()) { JobQuery::create()->filterByPrimaryKeys($this->jobsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->jobsScheduledForDeletion = null; } } if ($this->collJobs !== null) { foreach ($this->collJobs as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Filter the query by a related JugadorMesa object * * @param JugadorMesa|PropelObjectCollection $jugadorMesa the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return JugadorQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByJugadorMesa($jugadorMesa, $comparison = null) { if ($jugadorMesa instanceof JugadorMesa) { return $this->addUsingAlias(JugadorPeer::ID, $jugadorMesa->getJugadorId(), $comparison); } elseif ($jugadorMesa instanceof PropelObjectCollection) { return $this->useJugadorMesaQuery()->filterByPrimaryKeys($jugadorMesa->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByJugadorMesa() only accepts arguments of type JugadorMesa or PropelCollection'); } }
/** * Filter the query by a related Factura object * * @param Factura|PropelObjectCollection $factura the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return TipoPagoQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByFactura($factura, $comparison = null) { if ($factura instanceof Factura) { return $this->addUsingAlias(TipoPagoPeer::ID, $factura->getTipoPagoId(), $comparison); } elseif ($factura instanceof PropelObjectCollection) { return $this->useFacturaQuery()->filterByPrimaryKeys($factura->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByFactura() only accepts arguments of type Factura or PropelCollection'); } }
/** * Filter the query by a related Expedienteservicio object * * @param Expedienteservicio|PropelObjectCollection $expedienteservicio the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ExpedienteQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByExpedienteservicio($expedienteservicio, $comparison = null) { if ($expedienteservicio instanceof Expedienteservicio) { return $this->addUsingAlias(ExpedientePeer::IDEXPEDIENTE, $expedienteservicio->getIdexpediente(), $comparison); } elseif ($expedienteservicio instanceof PropelObjectCollection) { return $this->useExpedienteservicioQuery()->filterByPrimaryKeys($expedienteservicio->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByExpedienteservicio() only accepts arguments of type Expedienteservicio or PropelCollection'); } }
/** * Filter the query by a related Ordencompra object * * @param Ordencompra|PropelObjectCollection $ordencompra the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ProveedorQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByOrdencompra($ordencompra, $comparison = null) { if ($ordencompra instanceof Ordencompra) { return $this->addUsingAlias(ProveedorPeer::IDPROVEEDOR, $ordencompra->getIdproveedor(), $comparison); } elseif ($ordencompra instanceof PropelObjectCollection) { return $this->useOrdencompraQuery()->filterByPrimaryKeys($ordencompra->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByOrdencompra() only accepts arguments of type Ordencompra or PropelCollection'); } }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aUserRelatedByCreatedBy !== null) { if ($this->aUserRelatedByCreatedBy->isModified() || $this->aUserRelatedByCreatedBy->isNew()) { $affectedRows += $this->aUserRelatedByCreatedBy->save($con); } $this->setUserRelatedByCreatedBy($this->aUserRelatedByCreatedBy); } if ($this->aUserRelatedByUpdatedBy !== null) { if ($this->aUserRelatedByUpdatedBy->isModified() || $this->aUserRelatedByUpdatedBy->isNew()) { $affectedRows += $this->aUserRelatedByUpdatedBy->save($con); } $this->setUserRelatedByUpdatedBy($this->aUserRelatedByUpdatedBy); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; // Rewind the newsletter_body LOB column, since PDO does not rewind after inserting value. if ($this->newsletter_body !== null && is_resource($this->newsletter_body)) { rewind($this->newsletter_body); } $this->resetModified(); } if ($this->newsletterMailingsScheduledForDeletion !== null) { if (!$this->newsletterMailingsScheduledForDeletion->isEmpty()) { NewsletterMailingQuery::create()->filterByPrimaryKeys($this->newsletterMailingsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->newsletterMailingsScheduledForDeletion = null; } } if ($this->collNewsletterMailings !== null) { foreach ($this->collNewsletterMailings as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aAddress !== null) { if ($this->aAddress->isModified() || $this->aAddress->isNew()) { $affectedRows += $this->aAddress->save($con); } $this->setAddress($this->aAddress); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->bookingTypesScheduledForDeletion !== null) { if (!$this->bookingTypesScheduledForDeletion->isEmpty()) { BookingTypeQuery::create()->filterByPrimaryKeys($this->bookingTypesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->bookingTypesScheduledForDeletion = null; } } if ($this->collBookingTypes !== null) { foreach ($this->collBookingTypes as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->clockingTypesScheduledForDeletion !== null) { if (!$this->clockingTypesScheduledForDeletion->isEmpty()) { ClockingTypeQuery::create()->filterByPrimaryKeys($this->clockingTypesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->clockingTypesScheduledForDeletion = null; } } if ($this->collClockingTypes !== null) { foreach ($this->collClockingTypes as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->domainsScheduledForDeletion !== null) { if (!$this->domainsScheduledForDeletion->isEmpty()) { DomainQuery::create()->filterByPrimaryKeys($this->domainsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->domainsScheduledForDeletion = null; } } if ($this->collDomains !== null) { foreach ($this->collDomains as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->holidaysScheduledForDeletion !== null) { if (!$this->holidaysScheduledForDeletion->isEmpty()) { HolidayQuery::create()->filterByPrimaryKeys($this->holidaysScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->holidaysScheduledForDeletion = null; } } if ($this->collHolidays !== null) { foreach ($this->collHolidays as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->pluginsScheduledForDeletion !== null) { if (!$this->pluginsScheduledForDeletion->isEmpty()) { PluginQuery::create()->filterByPrimaryKeys($this->pluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->pluginsScheduledForDeletion = null; } } if ($this->collPlugins !== null) { foreach ($this->collPlugins as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->propertysScheduledForDeletion !== null) { if (!$this->propertysScheduledForDeletion->isEmpty()) { PropertyQuery::create()->filterByPrimaryKeys($this->propertysScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->propertysScheduledForDeletion = null; } } if ($this->collPropertys !== null) { foreach ($this->collPropertys as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->usersScheduledForDeletion !== null) { if (!$this->usersScheduledForDeletion->isEmpty()) { UserQuery::create()->filterByPrimaryKeys($this->usersScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->usersScheduledForDeletion = null; } } if ($this->collUsers !== null) { foreach ($this->collUsers as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * Filter the query by a related Clocking object * * @param Clocking|PropelObjectCollection $clocking the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ClockingTypeQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByClocking($clocking, $comparison = null) { if ($clocking instanceof Clocking) { return $this->addUsingAlias(ClockingTypePeer::ID, $clocking->getTypeId(), $comparison); } elseif ($clocking instanceof PropelObjectCollection) { return $this->useClockingQuery()->filterByPrimaryKeys($clocking->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByClocking() only accepts arguments of type Clocking or PropelCollection'); } }
/** * Filter the query by a related PropertyValue object * * @param PropertyValue|PropelObjectCollection $propertyValue the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PropertyQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByPropertyValue($propertyValue, $comparison = null) { if ($propertyValue instanceof PropertyValue) { return $this->addUsingAlias(PropertyPeer::ID, $propertyValue->getPropertyId(), $comparison); } elseif ($propertyValue instanceof PropelObjectCollection) { return $this->usePropertyValueQuery()->filterByPrimaryKeys($propertyValue->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByPropertyValue() only accepts arguments of type PropertyValue or PropelCollection'); } }
/** * Filter the query by a related Rolmodulo object * * @param Rolmodulo|PropelObjectCollection $rolmodulo the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return RolQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByRolmodulo($rolmodulo, $comparison = null) { if ($rolmodulo instanceof Rolmodulo) { return $this->addUsingAlias(RolPeer::IDROL, $rolmodulo->getIdrol(), $comparison); } elseif ($rolmodulo instanceof PropelObjectCollection) { return $this->useRolmoduloQuery()->filterByPrimaryKeys($rolmodulo->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByRolmodulo() only accepts arguments of type Rolmodulo or PropelCollection'); } }