public function update($currentVersion, $newVersion, ConnectionInterface $con) { if (file_exists(__DIR__ . "/Config/Update/{$newVersion}.sql")) { $database = new Database($con); $database->insertSql(null, [__DIR__ . "/Config/Update/{$newVersion}.sql"]); } if ($newVersion === "0.6") { $merchantId = self::getConfigValue('merchant_id'); if (null !== $merchantId) { $googleShoppingAccount = new GoogleshoppingAccount(); $googleShoppingAccount->setMerchantId($merchantId)->save(); $googleShoppingProducts = GoogleshoppingProductSynchronisationQuery::create()->find(); if (null !== $googleShoppingProducts) { /** @var GoogleshoppingProductSynchronisation $googleShoppingProduct */ foreach ($googleShoppingProducts as $googleShoppingProduct) { $googleShoppingProduct->setGoogleshoppingAccountId($googleShoppingAccount->getId())->save(); } } } } }
/** * Filter the query by a related \GoogleShopping\Model\GoogleshoppingAccount object * * @param \GoogleShopping\Model\GoogleshoppingAccount|ObjectCollection $googleshoppingAccount The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildGoogleshoppingProductSynchronisationQuery The current query, for fluid interface */ public function filterByGoogleshoppingAccount($googleshoppingAccount, $comparison = null) { if ($googleshoppingAccount instanceof \GoogleShopping\Model\GoogleshoppingAccount) { return $this->addUsingAlias(GoogleshoppingProductSynchronisationTableMap::GOOGLESHOPPING_ACCOUNT_ID, $googleshoppingAccount->getId(), $comparison); } elseif ($googleshoppingAccount instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(GoogleshoppingProductSynchronisationTableMap::GOOGLESHOPPING_ACCOUNT_ID, $googleshoppingAccount->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByGoogleshoppingAccount() only accepts arguments of type \\GoogleShopping\\Model\\GoogleshoppingAccount or Collection'); } }
/** * Exclude object from result * * @param ChildGoogleshoppingAccount $googleshoppingAccount Object to remove from the list of results * * @return ChildGoogleshoppingAccountQuery The current query, for fluid interface */ public function prune($googleshoppingAccount = null) { if ($googleshoppingAccount) { $this->addUsingAlias(GoogleshoppingAccountTableMap::ID, $googleshoppingAccount->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Declares an association between this object and a ChildGoogleshoppingAccount object. * * @param ChildGoogleshoppingAccount $v * @return \GoogleShopping\Model\GoogleshoppingProductSynchronisation The current object (for fluent API support) * @throws PropelException */ public function setGoogleshoppingAccount(ChildGoogleshoppingAccount $v = null) { if ($v === null) { $this->setGoogleshoppingAccountId(NULL); } else { $this->setGoogleshoppingAccountId($v->getId()); } $this->aGoogleshoppingAccount = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildGoogleshoppingAccount object, it will not be re-added. if ($v !== null) { $v->addGoogleshoppingProductSynchronisation($this); } return $this; }