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


PHP RepositoryInterface::add方法代碼示例

本文整理匯總了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);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:10,代碼來源:GeographicalContext.php

示例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];
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:10,代碼來源:DefaultChannelFactory.php

示例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);
 }
開發者ID:Mozan,項目名稱:Sylius,代碼行數:10,代碼來源:GeographicalContext.php

示例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);
 }
開發者ID:stevedien,項目名稱:Sylius,代碼行數:10,代碼來源:GeographicalContext.php

示例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);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:11,代碼來源:LocaleContext.php

示例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);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:11,代碼來源:CustomerGroupContext.php

示例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);
 }
開發者ID:vikey89,項目名稱:Sylius,代碼行數:11,代碼來源:UserContext.php

示例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);
 }
開發者ID:weppyk,項目名稱:Sylius,代碼行數:11,代碼來源:ZoneContext.php

示例9: getSequence

 /**
  * @return OrderSequenceInterface
  */
 private function getSequence()
 {
     $sequence = $this->sequenceRepository->findOneBy([]);
     if (null === $sequence) {
         $sequence = $this->sequenceFactory->createNew();
         $this->sequenceRepository->add($sequence);
     }
     return $sequence;
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:12,代碼來源:SequentialOrderNumberGenerator.php

示例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);
 }
開發者ID:Spomky,項目名稱:Sylius,代碼行數:12,代碼來源:CurrencyContext.php

示例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);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:12,代碼來源:ProductReviewContext.php

示例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);
 }
開發者ID:starspire,項目名稱:eventmanager,代碼行數:12,代碼來源:ZoneContext.php

示例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));
     }
 }
開發者ID:Mozan,項目名稱:Sylius,代碼行數:14,代碼來源:TaxonomyContext.php

示例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);
 }
開發者ID:Spomky,項目名稱:Sylius,代碼行數:13,代碼來源:ProductContext.php

示例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;
 }
開發者ID:stevedien,項目名稱:Sylius,代碼行數:13,代碼來源:DefaultFranceChannelFactory.php


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