本文整理汇总了PHP中PropelObjectCollection::getPrimaryKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP PropelObjectCollection::getPrimaryKeys方法的具体用法?PHP PropelObjectCollection::getPrimaryKeys怎么用?PHP PropelObjectCollection::getPrimaryKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropelObjectCollection
的用法示例。
在下文中一共展示了PropelObjectCollection::getPrimaryKeys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSave
/**
* 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;
}
示例2: doSave
/**
* 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;
}
示例3: doSave
/**
* 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;
}
示例4: testGetPrimaryKeys
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);
}
}
示例5: filterBySubscriberGroupMembership
/**
* 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');
}
}
示例6: doSave
/**
* 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);
//.........这里部分代码省略.........
示例7: filterByNewsletterMailing
/**
* 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');
}
}
示例8: filterByExpedientegasto
/**
* 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');
}
}
示例9: filterByFactura
/**
* 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');
}
}
示例10: filterByBarang
/**
* 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');
}
}
示例11: filterByTransactionRelatedByUserId
/**
* 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');
}
}
示例12: filterByVenta
/**
* 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');
}
}
示例13: doSave
/**
* 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())) {
//.........这里部分代码省略.........
示例14: filterByAfiliado
/**
* 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');
}
}
示例15: filterByProcedimientregrogramado
/**
* 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');
}
}