本文整理汇总了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;
}
示例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);
}
}
示例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');
}
}
示例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');
}
}
示例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;
}
示例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;
}
示例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');
}
}
示例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;
}
示例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');
}
}
示例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');
}
}
示例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');
}
}
示例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');
}
}
示例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');
}
}
示例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');
}
}
示例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');
}
}