本文整理匯總了PHP中Sylius\Component\Resource\Repository\RepositoryInterface::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP RepositoryInterface::add方法的具體用法?PHP RepositoryInterface::add怎麽用?PHP RepositoryInterface::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sylius\Component\Resource\Repository\RepositoryInterface
的用法示例。
在下文中一共展示了RepositoryInterface::add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: theStoreHasDisabledCountry
/**
* @Given /^the store has disabled country "([^"]*)"$/
*/
public function theStoreHasDisabledCountry($countryName)
{
$country = $this->createCountryNamed(trim($countryName));
$country->disable();
$this->sharedStorage->set('country', $country);
$this->countryRepository->add($country);
}
示例2: create
/**
* {@inheritdoc}
*/
public function create()
{
$channel = $this->channelFactory->createNamed(self::DEFAULT_CHANNEL_NAME);
$channel->setCode(self::DEFAULT_CHANNEL_CODE);
$this->channelRepository->add($channel);
return ['channel' => $channel];
}
示例3: createCountryNamed
/**
* @param string $name
*/
private function createCountryNamed($name)
{
/** @var CountryInterface $country */
$country = $this->countryFactory->createNew();
$country->setCode($this->countryNameConverter->convertToCode($name));
$this->countryRepository->add($country);
}
示例4: createCountryNamed
/**
* @param string $name
*/
private function createCountryNamed($name)
{
/** @var CountryInterface $country */
$country = $this->countryFactory->createNew();
$country->setCode($this->getCountryCodeByEnglishCountryName($name));
$this->countryRepository->add($country);
}
示例5: theStoreHasDisabledLocale
/**
* @Given the store has disabled locale :localeName
*/
public function theStoreHasDisabledLocale($localeName)
{
$locale = $this->localeFactory->createNew();
$locale->setCode($this->localeNameConverter->convertToCode($localeName));
$locale->disable();
$this->sharedStorage->set('locale', $locale);
$this->localeRepository->add($locale);
}
示例6: createCustomerGroup
/**
* @param string $name
*/
private function createCustomerGroup($name)
{
/** @var CustomerGroupInterface $customerGroup */
$customerGroup = $this->customerGroupFactory->createNew();
$customerGroup->setName(ucfirst($name));
$this->sharedStorage->set('customer_group', $customerGroup);
$this->customerGroupRepository->add($customerGroup);
}
示例7: thereIsUserWithShippingCountry
/**
* @Given there is user :email identified by :password, with :country as shipping country
*/
public function thereIsUserWithShippingCountry($email, $password, $country)
{
$user = $this->userFactory->create($email, $password);
$customer = $user->getCustomer();
$customer->setShippingAddress($this->createAddress($customer->getFirstName(), $customer->getLastName(), $country));
$this->sharedStorage->set('user', $user);
$this->userRepository->add($user);
}
示例8: thereIsEUZoneContainingAllMembersOfEuropeanUnion
/**
* @Given /^there is "EU" zone containing all members of European Union$/
*/
public function thereIsEUZoneContainingAllMembersOfEuropeanUnion()
{
$zone = $this->zoneFactory->createWithMembers($this->euMembers);
$zone->setType(ZoneInterface::TYPE_COUNTRY);
$zone->setCode('EU');
$zone->setName('European Union');
$this->zoneRepository->add($zone);
}
示例9: getSequence
/**
* @return OrderSequenceInterface
*/
private function getSequence()
{
$sequence = $this->sequenceRepository->findOneBy([]);
if (null === $sequence) {
$sequence = $this->sequenceFactory->createNew();
$this->sequenceRepository->add($sequence);
}
return $sequence;
}
示例10: defaultCurrencyIs
/**
* @Given default currency is :currencyCode
*/
public function defaultCurrencyIs($currencyCode)
{
$currency = $this->currencyFactory->createNew();
$currency->setCode($currencyCode);
$currency->setExchangeRate(1.0);
$channel = $this->sharedStorage->getCurrentResource('channel');
$channel->setDefaultCurrency($currency);
$this->currencyRepository->add($currency);
}
示例11: productHasAReview
/**
* @Given /^(this product) has one review$/
*/
public function productHasAReview(ProductInterface $product)
{
$review = $this->productReviewFactory->createNew();
$review->setTitle('title');
$review->setRating(5);
$review->setReviewSubject($product);
$product->addReview($review);
$this->productReviewRepository->add($review);
}
示例12: thereIsRestOfTheWorldZoneContainingAllOtherCountries
/**
* @Given /^there is rest of the world zone containing all other countries$/
*/
public function thereIsRestOfTheWorldZoneContainingAllOtherCountries()
{
$restOfWorldCountries = array_diff(array_keys(Intl::getRegionBundle()->getCountryNames('en')), array_merge($this->euMembers, ['US']));
$zone = $this->zoneFactory->createWithMembers($restOfWorldCountries);
$zone->setType(ZoneInterface::TYPE_COUNTRY);
$zone->setCode('RoW');
$zone->setName('Rest of the World');
$this->zoneRepository->add($zone);
}
示例13: storeClassifiesItsProductsAs
/**
* @Given the store classifies its products as :firstTaxonName
* @Given the store classifies its products as :firstTaxonName and :secondTaxonName
* @Given the store classifies its products as :firstTaxonName, :secondTaxonName and :thirdTaxonName
*/
public function storeClassifiesItsProductsAs($firstTaxonName, $secondTaxonName = null, $thirdTaxonName = null)
{
foreach ([$firstTaxonName, $secondTaxonName, $thirdTaxonName] as $taxonName) {
if (null === $taxonName) {
break;
}
$this->taxonRepository->add($this->createTaxon($taxonName));
}
}
示例14: catalogHasAProductPricedAt
/**
* @Given catalog has a product :productName priced at $:price
*/
public function catalogHasAProductPricedAt($productName, $price)
{
$product = $this->productFactory->createNew();
$product->setName($productName);
$product->setPrice((int) $price);
$product->setDescription('Awesome star wars mug');
$channel = $this->sharedStorage->getCurrentResource('channel');
$product->addChannel($channel);
$this->productRepository->add($product);
}
示例15: create
/**
* {@inheritdoc}
*/
public function create()
{
$defaultData['channel'] = $this->createChannel();
$defaultData['zone_member'] = $this->createZoneMember();
$defaultData['zone'] = $this->createZone($defaultData['zone_member']);
$this->channelRepository->add($defaultData['channel']);
$this->zoneRepository->add($defaultData['zone']);
$this->zoneMemberRepository->add($defaultData['zone_member']);
return $defaultData;
}