當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectCollection::getPrimaryKeys方法代碼示例

本文整理匯總了PHP中Propel\Runtime\Collection\ObjectCollection::getPrimaryKeys方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectCollection::getPrimaryKeys方法的具體用法?PHP ObjectCollection::getPrimaryKeys怎麽用?PHP ObjectCollection::getPrimaryKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Propel\Runtime\Collection\ObjectCollection的用法示例。


在下文中一共展示了ObjectCollection::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      ConnectionInterface $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(ConnectionInterface $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);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->groupAccessesScheduledForDeletion !== null) {
             if (!$this->groupAccessesScheduledForDeletion->isEmpty()) {
                 \ECP\GroupAccessQuery::create()->filterByPrimaryKeys($this->groupAccessesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->groupAccessesScheduledForDeletion = null;
             }
         }
         if ($this->collGroupAccesses !== null) {
             foreach ($this->collGroupAccesses as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:Covert-Inferno,項目名稱:EVE-Composition-Planer,代碼行數:44,代碼來源:EntityType.php

示例2: testGetPrimaryKeys

 public function testGetPrimaryKeys()
 {
     $books = new ObjectCollection();
     $books->setModel('\\Propel\\Tests\\Bookstore\\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('\\Propel\\Tests\\Bookstore\\Book_0', '\\Propel\\Tests\\Bookstore\\Book_1', '\\Propel\\Tests\\Bookstore\\Book_2', '\\Propel\\Tests\\Bookstore\\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);
     }
 }
開發者ID:norfil,項目名稱:Propel2,代碼行數:21,代碼來源:ObjectCollectionTest.php

示例3: filterByUser

 /**
  * Filter the query by a related \App\Propel\User object
  *
  * @param \App\Propel\User|ObjectCollection $user the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildResourceQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof \App\Propel\User) {
         return $this->addUsingAlias(ResourceTableMap::COL_RESOURCE_ID, $user->getResourceId(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         return $this->useUserQuery()->filterByPrimaryKeys($user->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\App\\Propel\\User or Collection');
     }
 }
開發者ID:mtornero,項目名稱:slowshop,代碼行數:18,代碼來源:ResourceQuery.php

示例4: filterByTranslationKeyword

 /**
  * Filter the query by a related \App\Models\TranslationKeyword object
  *
  * @param \App\Models\TranslationKeyword|ObjectCollection $translationKeyword the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildTranslationCatalogQuery The current query, for fluid interface
  */
 public function filterByTranslationKeyword($translationKeyword, $comparison = null)
 {
     if ($translationKeyword instanceof \App\Models\TranslationKeyword) {
         return $this->addUsingAlias(TranslationCatalogTableMap::COL_ID, $translationKeyword->getCatalogId(), $comparison);
     } elseif ($translationKeyword instanceof ObjectCollection) {
         return $this->useTranslationKeywordQuery()->filterByPrimaryKeys($translationKeyword->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByTranslationKeyword() only accepts arguments of type \\App\\Models\\TranslationKeyword or Collection');
     }
 }
開發者ID:nstojanovickg,項目名稱:diplomski,代碼行數:18,代碼來源:TranslationCatalogQuery.php

示例5: 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      ConnectionInterface $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(ConnectionInterface $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->aCourse !== null) {
             if ($this->aCourse->isModified() || $this->aCourse->isNew()) {
                 $affectedRows += $this->aCourse->save($con);
             }
             $this->setCourse($this->aCourse);
         }
         if ($this->aSchoolYear !== null) {
             if ($this->aSchoolYear->isModified() || $this->aSchoolYear->isNew()) {
                 $affectedRows += $this->aSchoolYear->save($con);
             }
             $this->setSchoolYear($this->aSchoolYear);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->adminUsersScheduledForDeletion !== null) {
             if (!$this->adminUsersScheduledForDeletion->isEmpty()) {
                 \App\Models\AdminUserQuery::create()->filterByPrimaryKeys($this->adminUsersScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->adminUsersScheduledForDeletion = null;
             }
         }
         if ($this->collAdminUsers !== null) {
             foreach ($this->collAdminUsers as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->applicationsScheduledForDeletion !== null) {
             if (!$this->applicationsScheduledForDeletion->isEmpty()) {
                 \App\Models\ApplicationQuery::create()->filterByPrimaryKeys($this->applicationsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->applicationsScheduledForDeletion = null;
             }
         }
         if ($this->collApplications !== null) {
             foreach ($this->collApplications as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:nstojanovickg,項目名稱:diplomski,代碼行數:73,代碼來源:Student.php

示例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      ConnectionInterface $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(ConnectionInterface $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->rolesScheduledForDeletion !== null) {
             if (!$this->rolesScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->rolesScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \Alchemy\Component\Cerberus\Model\UserRoleQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->rolesScheduledForDeletion = null;
             }
         }
         if ($this->collRoles) {
             foreach ($this->collRoles as $role) {
                 if (!$role->isDeleted() && ($role->isNew() || $role->isModified())) {
                     $role->save($con);
                 }
             }
         }
         if ($this->userRolesScheduledForDeletion !== null) {
             if (!$this->userRolesScheduledForDeletion->isEmpty()) {
                 \Alchemy\Component\Cerberus\Model\UserRoleQuery::create()->filterByPrimaryKeys($this->userRolesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->userRolesScheduledForDeletion = null;
             }
         }
         if ($this->collUserRoles !== null) {
             foreach ($this->collUserRoles as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:phpalchemy,項目名稱:cerberus,代碼行數:64,代碼來源:User.php

示例7: filterByPayment

 /**
  * Filter the query by a related \ORM\DebitPayment object
  *
  * @param \ORM\DebitPayment|ObjectCollection $debitPayment  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildDebitQuery The current query, for fluid interface
  */
 public function filterByPayment($debitPayment, $comparison = null)
 {
     if ($debitPayment instanceof \ORM\DebitPayment) {
         return $this->addUsingAlias(DebitTableMap::COL_ID, $debitPayment->getDebitId(), $comparison);
     } elseif ($debitPayment instanceof ObjectCollection) {
         return $this->usePaymentQuery()->filterByPrimaryKeys($debitPayment->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByPayment() only accepts arguments of type \\ORM\\DebitPayment or Collection');
     }
 }
開發者ID:AlvaCorp,項目名稱:POS-2,代碼行數:18,代碼來源:DebitQuery.php

示例8: 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      ConnectionInterface $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(ConnectionInterface $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->aProduct !== null) {
             if ($this->aProduct->isModified() || $this->aProduct->isNew()) {
                 $affectedRows += $this->aProduct->save($con);
             }
             $this->setProduct($this->aProduct);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->productSaleElementssScheduledForDeletion !== null) {
             if (!$this->productSaleElementssScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 $pk = $this->getPrimaryKey();
                 foreach ($this->productSaleElementssScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
                     $pks[] = array($remotePk, $pk);
                 }
                 ProductSaleElementsProductImageQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->productSaleElementssScheduledForDeletion = null;
             }
             foreach ($this->getProductSaleElementss() as $productSaleElements) {
                 if ($productSaleElements->isModified()) {
                     $productSaleElements->save($con);
                 }
             }
         } elseif ($this->collProductSaleElementss) {
             foreach ($this->collProductSaleElementss as $productSaleElements) {
                 if ($productSaleElements->isModified()) {
                     $productSaleElements->save($con);
                 }
             }
         }
         if ($this->productSaleElementsProductImagesScheduledForDeletion !== null) {
             if (!$this->productSaleElementsProductImagesScheduledForDeletion->isEmpty()) {
                 \Thelia\Model\ProductSaleElementsProductImageQuery::create()->filterByPrimaryKeys($this->productSaleElementsProductImagesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->productSaleElementsProductImagesScheduledForDeletion = null;
             }
         }
         if ($this->collProductSaleElementsProductImages !== null) {
             foreach ($this->collProductSaleElementsProductImages as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->productImageI18nsScheduledForDeletion !== null) {
             if (!$this->productImageI18nsScheduledForDeletion->isEmpty()) {
                 \Thelia\Model\ProductImageI18nQuery::create()->filterByPrimaryKeys($this->productImageI18nsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->productImageI18nsScheduledForDeletion = null;
             }
         }
         if ($this->collProductImageI18ns !== null) {
             foreach ($this->collProductImageI18ns as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:margery,項目名稱:thelia,代碼行數:89,代碼來源:ProductImage.php

示例9: filterByUserAttributeValues

 /**
  * Filter the query by a related \UserAttributeValues object
  *
  * @param \UserAttributeValues|ObjectCollection $userAttributeValues the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserAttributesQuery The current query, for fluid interface
  */
 public function filterByUserAttributeValues($userAttributeValues, $comparison = null)
 {
     if ($userAttributeValues instanceof \UserAttributeValues) {
         return $this->addUsingAlias(UserAttributesTableMap::COL_ID, $userAttributeValues->getUserAttributeId(), $comparison);
     } elseif ($userAttributeValues instanceof ObjectCollection) {
         return $this->useUserAttributeValuesQuery()->filterByPrimaryKeys($userAttributeValues->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByUserAttributeValues() only accepts arguments of type \\UserAttributeValues or Collection');
     }
 }
開發者ID:nirkbirk,項目名稱:site,代碼行數:18,代碼來源:UserAttributesQuery.php

示例10: filterByData

 /**
  * Filter the query by a related \Data object
  *
  * @param \Data|ObjectCollection $data the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildContributionsQuery The current query, for fluid interface
  */
 public function filterByData($data, $comparison = null)
 {
     if ($data instanceof \Data) {
         return $this->addUsingAlias(ContributionsTableMap::COL_ID, $data->getForcontribution(), $comparison);
     } elseif ($data instanceof ObjectCollection) {
         return $this->useDataQuery()->filterByPrimaryKeys($data->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByData() only accepts arguments of type \\Data or Collection');
     }
 }
開發者ID:Rokfor,項目名稱:rokfor-php-db,代碼行數:18,代碼來源:ContributionsQuery.php

示例11: filterBySocolissimoPrice

 /**
  * Filter the query by a related \SoColissimo\Model\SocolissimoPrice object
  *
  * @param \SoColissimo\Model\SocolissimoPrice|ObjectCollection $socolissimoPrice  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface
  */
 public function filterBySocolissimoPrice($socolissimoPrice, $comparison = null)
 {
     if ($socolissimoPrice instanceof \SoColissimo\Model\SocolissimoPrice) {
         return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoPrice->getDeliveryModeId(), $comparison);
     } elseif ($socolissimoPrice instanceof ObjectCollection) {
         return $this->useSocolissimoPriceQuery()->filterByPrimaryKeys($socolissimoPrice->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterBySocolissimoPrice() only accepts arguments of type \\SoColissimo\\Model\\SocolissimoPrice or Collection');
     }
 }
開發者ID:ThomasArnaud,項目名稱:SoColissimo,代碼行數:18,代碼來源:SocolissimoDeliveryModeQuery.php

示例12: elseif

 /**
  * Filter the query by a related \физическиеобъёмы object
  *
  * @param \физическиеобъёмы|ObjectCollection $�изическиеобъёмы the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildучасткиработQuery The current query, for fluid interface
  */
 public function filterByфизическиеобъёмы($�изическиеобъёмы, $comparison = null)
 {
     if ($�изическиеобъёмы instanceof \физическиеобъёмы) {
         return $this->addUsingAlias(участкиработTableMap::COL_ID, $�изическиеобъёмы->getучастокработ(), $comparison);
     } elseif ($�изическиеобъёмы instanceof ObjectCollection) {
         return $this->useфизическиеобъёмыQuery()->filterByPrimaryKeys($�изическиеобъёмы->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByфизическиеобъёмы() only accepts arguments of type \\физическиеобъёмы or Collection');
     }
 }
開發者ID:Polymedia,項目名稱:BI-Platform-v3,代碼行數:18,代碼來源:участкиработQuery.php

示例13: filterByAdminCredential

 /**
  * Filter the query by a related \App\Models\AdminCredential object
  *
  * @param \App\Models\AdminCredential|ObjectCollection $adminCredential the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildAdminCredentialGroupQuery The current query, for fluid interface
  */
 public function filterByAdminCredential($adminCredential, $comparison = null)
 {
     if ($adminCredential instanceof \App\Models\AdminCredential) {
         return $this->addUsingAlias(AdminCredentialGroupTableMap::COL_ID, $adminCredential->getGroupId(), $comparison);
     } elseif ($adminCredential instanceof ObjectCollection) {
         return $this->useAdminCredentialQuery()->filterByPrimaryKeys($adminCredential->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByAdminCredential() only accepts arguments of type \\App\\Models\\AdminCredential or Collection');
     }
 }
開發者ID:nstojanovickg,項目名稱:diplomski,代碼行數:18,代碼來源:AdminCredentialGroupQuery.php

示例14: filterByOrder

 /**
  * Filter the query by a related \Model\Order object
  *
  * @param \Model\Order|ObjectCollection $order the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildTruckQuery The current query, for fluid interface
  */
 public function filterByOrder($order, $comparison = null)
 {
     if ($order instanceof \Model\Order) {
         return $this->addUsingAlias(TruckTableMap::COL_ID, $order->getTruckId(), $comparison);
     } elseif ($order instanceof ObjectCollection) {
         return $this->useOrderQuery()->filterByPrimaryKeys($order->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByOrder() only accepts arguments of type \\Model\\Order or Collection');
     }
 }
開發者ID:hackathon-5,項目名稱:power-ragers-repo,代碼行數:18,代碼來源:TruckQuery.php

示例15: filterByIssues

 /**
  * Filter the query by a related \Issues object
  *
  * @param \Issues|ObjectCollection $issues the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildBooksQuery The current query, for fluid interface
  */
 public function filterByIssues($issues, $comparison = null)
 {
     if ($issues instanceof \Issues) {
         return $this->addUsingAlias(BooksTableMap::COL_ID, $issues->getForbook(), $comparison);
     } elseif ($issues instanceof ObjectCollection) {
         return $this->useIssuesQuery()->filterByPrimaryKeys($issues->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByIssues() only accepts arguments of type \\Issues or Collection');
     }
 }
開發者ID:Rokfor,項目名稱:rokfor-php-db,代碼行數:18,代碼來源:BooksQuery.php


注:本文中的Propel\Runtime\Collection\ObjectCollection::getPrimaryKeys方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。