idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
45,400 | public function set ( CurrencyInterface $ currency ) { $ this -> session -> set ( $ this -> sessionFieldName , $ currency -> getIso ( ) ) ; return $ this ; } | Set Currency in session . |
45,401 | public function populate ( ) { $ currenciesCodes = [ ] ; $ currencies = $ this -> currencyRepository -> findAll ( ) ; foreach ( $ currencies as $ currency ) { if ( $ currency -> getIso ( ) != $ this -> defaultCurrency ) { $ currenciesCodes [ ] = $ currency -> getIso ( ) ; } } $ rates = $ this -> currencyExchangeRatesAdapter -> getExchangeRates ( $ this -> defaultCurrency , $ currenciesCodes ) ; $ sourceCurrency = $ this -> currencyRepository -> findOneBy ( [ 'iso' => $ this -> defaultCurrency , ] ) ; foreach ( $ rates as $ code => $ rate ) { $ targetCurrency = $ this -> currencyRepository -> findOneBy ( [ 'iso' => $ code , ] ) ; if ( ! ( $ targetCurrency instanceof CurrencyInterface ) ) { continue ; } $ exchangeRate = $ this -> currencyExchangeRateObjectDirector -> findOneBy ( [ 'sourceCurrency' => $ sourceCurrency , 'targetCurrency' => $ targetCurrency , ] ) ; if ( ! ( $ exchangeRate instanceof CurrencyExchangeRateInterface ) ) { $ exchangeRate = $ this -> currencyExchangeRateObjectDirector -> create ( ) ; } $ exchangeRate -> setExchangeRate ( $ rate ) -> setSourceCurrency ( $ sourceCurrency ) -> setTargetCurrency ( $ targetCurrency ) ; $ this -> currencyExchangeRateObjectDirector -> save ( $ exchangeRate ) ; } return $ this ; } | Populates the exchange rates . |
45,402 | public function addSubCategory ( CategoryInterface $ category ) { if ( ! $ this -> subCategories -> contains ( $ category ) ) { $ this -> subCategories -> add ( $ category ) ; } return $ this ; } | Add Subcategory . |
45,403 | public function loadPlugins ( ) { $ oldPlugins = $ this -> getExistingPlugins ( ) ; $ pluginBundles = $ this -> getInstalledPluginBundles ( $ this -> kernel ) ; $ pluginsLoaded = [ ] ; foreach ( $ pluginBundles as $ plugin ) { $ pluginConfiguration = $ this -> pluginLoader -> getPluginConfiguration ( $ plugin -> getPath ( ) ) ; $ pluginNamespace = get_class ( $ plugin ) ; $ pluginInstance = $ this -> getPluginInstance ( $ pluginNamespace , $ pluginConfiguration ) ; if ( isset ( $ oldPlugins [ $ pluginNamespace ] ) ) { $ existingPlugin = $ oldPlugins [ $ pluginNamespace ] ; $ pluginInstance = $ existingPlugin -> merge ( $ pluginInstance ) ; unset ( $ oldPlugins [ $ pluginNamespace ] ) ; } $ this -> savePlugin ( $ pluginInstance ) ; $ pluginsLoaded [ ] = $ pluginInstance ; } $ this -> removePlugins ( $ oldPlugins ) ; return $ pluginsLoaded ; } | Load plugins . |
45,404 | private function getExistingPlugins ( ) { $ pluginsIndexed = [ ] ; $ plugins = $ this -> pluginRepository -> findAll ( ) ; foreach ( $ plugins as $ plugin ) { $ pluginNamespace = $ plugin -> getNamespace ( ) ; $ pluginsIndexed [ $ pluginNamespace ] = $ plugin ; } return $ pluginsIndexed ; } | Load existing plugins from database and return an array with them all indexed by its namespace . |
45,405 | private function getPluginInstance ( $ pluginNamespace , array $ pluginConfiguration ) { $ pluginType = $ pluginConfiguration [ 'type' ] ; $ pluginCategory = $ pluginConfiguration [ 'category' ] ; $ pluginEnabledByDefault = $ pluginConfiguration [ 'enabled_by_default' ] ; unset ( $ pluginConfiguration [ 'type' ] ) ; $ pluginInstance = Plugin :: create ( $ pluginNamespace , $ pluginType , $ pluginCategory , PluginConfiguration :: create ( $ pluginConfiguration ) , $ pluginEnabledByDefault ) ; return $ pluginInstance ; } | Create or update existing plugin given a set of plugin instances and the information to create a new one . |
45,406 | private function savePlugin ( Plugin $ plugin ) { $ this -> pluginObjectManager -> persist ( $ plugin ) ; $ this -> pluginObjectManager -> flush ( $ plugin ) ; return $ this ; } | Saves a plugin into database . |
45,407 | private function removePlugins ( $ plugins ) { foreach ( $ plugins as $ pluginToBeRemoved ) { $ this -> pluginObjectManager -> remove ( $ pluginToBeRemoved ) ; $ this -> pluginObjectManager -> flush ( $ pluginToBeRemoved ) ; } return $ this ; } | Remove a set of Plugins from database . |
45,408 | public function onCommentChange ( AbstractCommentEvent $ event ) { $ comment = $ event -> getComment ( ) ; $ this -> commentCache -> invalidateCache ( $ comment -> getSource ( ) , $ comment -> getContext ( ) ) ; } | on Comment change . |
45,409 | protected function renderEmail ( $ subject , $ receiverEmail , array $ context = [ ] ) { $ message = Swift_Message :: newInstance ( ) -> setSubject ( $ subject ) -> setFrom ( $ this -> fromEmail ) -> setTo ( $ receiverEmail ) -> setContentType ( 'text/html' ) -> setBody ( $ this -> templatingEngine -> render ( $ this -> template , array_merge ( $ context , [ 'layout' => $ this -> layout ] ) ) ) ; $ this -> mailer -> send ( $ message ) ; return $ this ; } | Render email . |
45,410 | public function setCartAsOrdered ( OrderOnCreatedEvent $ event ) { $ cart = $ event -> getCart ( ) -> setOrdered ( true ) ; $ this -> cartObjectManager -> flush ( $ cart ) ; } | After an Order is created the cart is set as Ordered enabling related flag . |
45,411 | public function postLoad ( LifecycleEventArgs $ args ) { $ this -> container -> get ( 'elcodi.entity_translator' ) -> translate ( $ args -> getEntity ( ) , $ this -> locale -> getIso ( ) ) ; } | Translate the entity to given locale . |
45,412 | public function createAndSaveCartCoupon ( CartCouponOnApplyEvent $ event ) { $ cartCoupon = $ this -> cartCouponManager -> createAndSaveCartCoupon ( $ event -> getCart ( ) , $ event -> getCoupon ( ) ) ; $ event -> setCartCoupon ( $ cartCoupon ) ; } | Creates a new CartCoupon instance . |
45,413 | public function dispatchOrderLineOnCreatedEvent ( OrderInterface $ order , CartLineInterface $ cartLine , OrderLineInterface $ orderLine ) { $ orderLineOnCreatedEvent = new OrderLineOnCreatedEvent ( $ order , $ cartLine , $ orderLine ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: ORDERLINE_ONCREATED , $ orderLineOnCreatedEvent ) ; return $ this ; } | Event dispatched when a Cart is being converted to an OrderLine . |
45,414 | public function dispatchCommentOnAddEvent ( CommentInterface $ comment ) { $ event = new CommentOnAddEvent ( $ comment ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCommentEvents :: COMMENT_ONADD , $ event ) ; return $ this ; } | Dispatch Comment added event . |
45,415 | public function dispatchCommentOnEditEvent ( CommentInterface $ comment ) { $ event = new CommentOnEditEvent ( $ comment ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCommentEvents :: COMMENT_ONEDIT , $ event ) ; return $ this ; } | Dispatch Comment edited event . |
45,416 | public function dispatchCommentPreRemoveEvent ( CommentInterface $ comment ) { $ event = new CommentPreRemoveEvent ( $ comment ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCommentEvents :: COMMENT_PREREMOVE , $ event ) ; return $ this ; } | Dispatch Comment pre removed event . |
45,417 | public function dispatchCommentOnRemoveEvent ( CommentInterface $ comment ) { $ event = new CommentOnRemoveEvent ( $ comment ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCommentEvents :: COMMENT_ONREMOVE , $ event ) ; return $ this ; } | Dispatch Comment removed event . |
45,418 | public function dispatchCommentOnVotedEvent ( CommentInterface $ comment , VoteInterface $ vote , $ edited ) { $ event = new CommentOnVotedEvent ( $ comment , $ vote , $ edited ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCommentEvents :: COMMENT_ONVOTED , $ event ) ; return $ this ; } | Dispatch Comment voted event . |
45,419 | public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ menu = new $ classNamespace ( ) ; $ menu -> setDescription ( '' ) -> setSubnodes ( new ArrayCollection ( ) ) -> setEnabled ( false ) ; return $ menu ; } | Creates an instance of Menu entity . |
45,420 | public function dispatchCartLineOnAddEvent ( CartInterface $ cart , CartLineInterface $ cartLine ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CARTLINE_ONADD , new CartLineOnAddEvent ( $ cart , $ cartLine ) ) ; return $ this ; } | Dispatch cartLine event when is added into cart . |
45,421 | public function dispatchCartLineOnEditEvent ( CartInterface $ cart , CartLineInterface $ cartLine ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CARTLINE_ONEDIT , new CartLineOnEditEvent ( $ cart , $ cartLine ) ) ; return $ this ; } | Dispatch cartLine event when is edited . |
45,422 | public function dispatchCartLineOnRemoveEvent ( CartInterface $ cart , CartLineInterface $ cartLine ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CARTLINE_ONREMOVE , new CartLineOnAddEvent ( $ cart , $ cartLine ) ) ; return $ this ; } | Dispatch cartLine event when is removed . |
45,423 | private function loadCurrencyFromSession ( ) { $ currencyIdInSession = $ this -> currencySessionManager -> get ( ) ; return $ currencyIdInSession ? $ this -> currency = $ this -> currencyRepository -> find ( $ currencyIdInSession ) : null ; } | Load currency from session . |
45,424 | public function getFunctions ( ) { return [ new ExpressionFunction ( 'money' , function ( ) { throw new RuntimeException ( 'Function "money" can\'t be compiled.' ) ; } , function ( array $ context , $ amount , $ currencyIso = null ) { if ( $ currencyIso === null ) { $ currency = $ this -> defaultCurrencyWrapper -> get ( ) ; } else { $ currency = $ this -> currencyRepository -> findOneBy ( [ 'iso' => $ currencyIso , ] ) ; } return Money :: create ( $ amount * 100 , $ currency ) ; } ) , ] ; } | Return functions . |
45,425 | public function process ( ContainerBuilder $ container ) { $ taggedServices = $ container -> findTaggedServiceIds ( 'elcodi.rule_context' ) ; $ contextProviders = [ ] ; foreach ( $ taggedServices as $ id => $ attributes ) { $ contextProviders [ ] = new Reference ( $ id ) ; } $ definition = $ container -> getDefinition ( 'elcodi.expression_language_context_collector' ) ; $ definition -> addArgument ( $ contextProviders ) ; } | Collect services tagged to add context for RuleManager . |
45,426 | public static function create ( $ object , StateLineStack $ stateLineStack , Transition $ transition ) { return new self ( $ object , $ stateLineStack , $ transition ) ; } | Create new object . |
45,427 | public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ node = new $ classNamespace ( ) ; $ node -> setSubnodes ( new ArrayCollection ( ) ) -> setPriority ( 0 ) -> setActiveUrls ( [ ] ) -> setEnabled ( true ) ; return $ node ; } | Creates an instance of Node entity . |
45,428 | private function locateTemplate ( ) { foreach ( $ this -> bundles as $ bundleName ) { $ templateName = "{$bundleName}:{$this->templatePath}" ; if ( $ this -> engine -> exists ( $ templateName ) ) { return $ templateName ; } } throw new RuntimeException ( sprintf ( 'Template "%s" not found' , $ this -> templatePath ) ) ; } | Search for the template in every specified bundle . |
45,429 | protected function processPlugin ( Bundle $ plugin ) { $ resourcePath = $ plugin -> getPath ( ) . '/Resources/config/external.yml' ; return file_exists ( $ resourcePath ) ? Yaml :: parse ( file_get_contents ( $ resourcePath ) ) : [ ] ; } | Process plugin . |
45,430 | public function getAvailableOptions ( ProductInterface $ product , AttributeInterface $ attribute ) { $ availableOptions = new ArrayCollection ( ) ; foreach ( $ product -> getVariants ( ) as $ variant ) { if ( ! $ variant -> isEnabled ( ) || $ variant -> getStock ( ) <= 0 ) { continue ; } foreach ( $ variant -> getOptions ( ) as $ option ) { if ( $ option -> getAttribute ( ) == $ attribute && ! $ availableOptions -> contains ( $ option ) ) { $ availableOptions -> add ( $ option ) ; } } } return $ availableOptions ; } | Returns an array of unique available options for a Product . |
45,431 | public function validateCartCoupons ( CartInterface $ cart ) { $ cartCoupons = $ this -> cartCouponManager -> getCartCoupons ( $ cart ) ; foreach ( $ cartCoupons as $ cartCoupon ) { $ coupon = $ cartCoupon -> getCoupon ( ) ; try { $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnCheckEvent ( $ cart , $ coupon ) ; } catch ( AbstractCouponException $ exception ) { $ this -> cartCouponManager -> removeCoupon ( $ cart , $ coupon ) ; $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnRejectedEvent ( $ cart , $ coupon ) ; } } } | Checks if all Coupons applied to current cart are still valid . If are not they will be deleted from the Cart and new Event typeof CartCouponOnRejected will be dispatched . |
45,432 | public function onNewsletterSubscribeFlush ( NewsletterSubscriptionEvent $ event ) { $ subscription = $ event -> getNewsletterSubscription ( ) ; $ this -> newsletterObjectManager -> persist ( $ subscription ) ; $ this -> newsletterObjectManager -> flush ( $ subscription ) ; } | Subscribed on newsletter subscription . |
45,433 | public function onNewsletterUnsubscribeFlush ( NewsletterUnsubscriptionEvent $ event ) { $ subscription = $ event -> getNewsletterSubscription ( ) ; $ this -> newsletterObjectManager -> flush ( $ subscription ) ; } | Subscribed on newsletter unsubscription . |
45,434 | public function transform ( ImageInterface $ image , $ height , $ width , $ type ) { return sha1 ( $ image -> getId ( ) . '.' . $ image -> getUpdatedAt ( ) -> getTimestamp ( ) . '.' . $ height . '.' . $ width . '.' . $ type ) ; } | Transforms an Image with some resizing information into an ETag . |
45,435 | public function getLoc ( $ element , $ language = null ) { return $ this -> router -> generate ( $ element , [ '_locale' => $ language , ] , false ) ; } | Get url given an entity . |
45,436 | public function addStateLine ( StateLineInterface $ stateLine ) { $ this -> stateLines -> add ( $ stateLine ) ; $ this -> lastStateLine = $ stateLine ; return $ this ; } | Add state line . |
45,437 | public function getBannersFromBannerZoneCode ( $ bannerZoneCode , LanguageInterface $ language = null ) { return $ this -> bannerRepository -> getBannerByZone ( $ bannerZoneCode , $ language ) ; } | Get banners from a bannerZone code given a language . |
45,438 | public function getBannersFromBannerZone ( BannerZoneInterface $ bannerZone , LanguageInterface $ language = null ) { return $ this -> getBannersFromBannerZoneCode ( $ bannerZone -> getCode ( ) , $ language ) ; } | Get banners from a bannerZone given a language . |
45,439 | public function rememberPasswordByEmail ( UserEmaileableInterface $ userRepository , $ email , $ recoverPasswordUrlName , $ hashField = 'hash' ) { $ user = $ userRepository -> findOneByEmail ( $ email ) ; if ( ! ( $ user instanceof AbstractUser ) ) { return false ; } $ this -> rememberPassword ( $ user , $ recoverPasswordUrlName , $ hashField ) ; return true ; } | Remember a password from a user given its email . |
45,440 | public function rememberPassword ( AbstractUser $ user , $ recoverPasswordUrlName , $ hashField = 'hash' ) { $ recoveryHash = $ this -> recoveryHashGenerator -> generate ( ) ; $ user -> setRecoveryHash ( $ recoveryHash ) ; $ this -> manager -> flush ( $ user ) ; $ recoverUrl = $ this -> router -> generate ( $ recoverPasswordUrlName , [ $ hashField => $ recoveryHash , ] , true ) ; $ this -> passwordEventDispatcher -> dispatchOnPasswordRememberEvent ( $ user , $ recoverUrl ) ; return $ this ; } | Set a user in a remember password mode . Also rises an event to hook when this happens . |
45,441 | public function recoverPassword ( AbstractUser $ user , $ hash , $ newPassword ) { if ( $ hash == $ user -> getRecoveryHash ( ) ) { $ user -> setPassword ( $ newPassword ) -> setRecoveryHash ( null ) ; $ this -> manager -> flush ( $ user ) ; $ this -> passwordEventDispatcher -> dispatchOnPasswordRecoverEvent ( $ user ) ; } return $ this ; } | Recovers a password given a user . |
45,442 | public function validateCartIntegrity ( CartInterface $ cart ) { foreach ( $ cart -> getCartLines ( ) as $ cartLine ) { $ this -> validateCartLine ( $ cartLine ) ; } } | Validate cart integrity . |
45,443 | private function validateCartLine ( CartLineInterface $ cartLine ) { $ cart = $ cartLine -> getCart ( ) ; $ purchasable = $ cartLine -> getPurchasable ( ) ; $ realStockAvailable = $ this -> purchasableStockValidator -> isStockAvailable ( $ purchasable , $ cartLine -> getQuantity ( ) , $ this -> useStock ) ; if ( false === $ realStockAvailable || $ realStockAvailable === 0 ) { $ this -> cartManager -> silentRemoveLine ( $ cart , $ cartLine ) ; $ this -> cartEventDispatcher -> dispatchCartInconsistentEvent ( $ cart , $ cartLine ) ; return $ cartLine ; } if ( is_int ( $ realStockAvailable ) ) { $ cartLine -> setQuantity ( $ realStockAvailable ) ; } return $ cartLine ; } | Check CartLine integrity . |
45,444 | public function findAllCartsWithAddress ( AddressInterface $ address ) { $ queryBuilder = $ this -> createQueryBuilder ( 'c' ) ; $ result = $ queryBuilder -> innerJoin ( 'c.billingAddress' , 'b' ) -> innerJoin ( 'c.deliveryAddress' , 'd' ) -> where ( $ queryBuilder -> expr ( ) -> orX ( $ queryBuilder -> expr ( ) -> eq ( 'b.id' , ':customerId' ) , $ queryBuilder -> expr ( ) -> eq ( 'c.id' , ':addressId' ) ) ) -> setParameter ( 'customerId' , $ address -> getId ( ) ) -> setParameter ( 'addressId' , $ address -> getId ( ) ) -> getQuery ( ) -> getResult ( ) ; return $ result ; } | Finds all the carts that had an address for billing or delivery . |
45,445 | public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ category = new $ classNamespace ( ) ; $ category -> setSubcategories ( new ArrayCollection ( ) ) -> setRoot ( true ) -> setPosition ( 0 ) -> setEnabled ( true ) -> setCreatedAt ( $ this -> now ( ) ) ; return $ category ; } | Creates an instance of Category . |
45,446 | public function getStock ( ) { if ( $ this -> getStockType ( ) !== ElcodiProductStock :: INHERIT_STOCK ) { return $ this -> stock ; } $ stock = ElcodiProductStock :: INFINITE_STOCK ; foreach ( $ this -> getPurchasables ( ) as $ purchasable ) { $ purchasableStock = $ purchasable -> getStock ( ) ; if ( is_int ( $ purchasableStock ) && ( ! is_int ( $ stock ) || $ purchasableStock < $ stock ) ) { $ stock = $ purchasableStock ; } } return $ stock ; } | Get stock . |
45,447 | public function addCategory ( CategoryInterface $ category ) { if ( ! $ this -> categories -> contains ( $ category ) ) { $ this -> categories -> add ( $ category ) ; } return $ this ; } | Add category . |
45,448 | public function subscribe ( $ email , LanguageInterface $ language = null ) { if ( ! $ this -> validateEmail ( $ email ) ) { throw new NewsletterCannotBeAddedException ( ) ; } $ newsletterSubscription = $ this -> getSubscription ( $ email ) ; if ( ! ( $ newsletterSubscription instanceof NewsletterSubscriptionInterface ) ) { $ newsletterSubscription = $ this -> newsletterSubscriptionFactory -> create ( ) ; $ newsletterSubscription -> setEmail ( $ email ) -> setHash ( $ this -> hashGenerator -> generate ( ) ) -> setLanguage ( $ language ) ; } $ newsletterSubscription -> setEnabled ( true ) ; $ this -> newsletterEventDispatcher -> dispatchSubscribeEvent ( $ newsletterSubscription ) ; return $ this ; } | Subscribe email to newsletter . |
45,449 | public function unSubscribe ( $ email , $ hash , LanguageInterface $ language = null , $ reason = null ) { if ( ! $ this -> validateEmail ( $ email ) ) { throw new NewsletterCannotBeRemovedException ( ) ; } $ conditions = [ 'email' => $ email , 'hash' => $ hash , ] ; if ( $ language instanceof LanguageInterface ) { $ conditions [ 'language' ] = $ language ; } $ newsletterSubscription = $ this -> newsletterSubscriptionRepository -> findOneBy ( $ conditions ) ; if ( ! ( $ newsletterSubscription instanceof NewsletterSubscriptionInterface ) ) { throw new NewsletterCannotBeRemovedException ( ) ; } $ newsletterSubscription -> setEnabled ( false ) -> setReason ( $ reason ) ; $ this -> newsletterEventDispatcher -> dispatchUnsubscribeEvent ( $ newsletterSubscription ) ; return $ this ; } | Unsubscribe email from newsletter . |
45,450 | public function validateEmail ( $ email ) { if ( empty ( $ email ) ) { return false ; } $ validationViolationList = $ this -> validator -> validate ( $ email , new Email ( ) ) ; return $ validationViolationList -> count ( ) === 0 ; } | Return if email is valid . |
45,451 | public function updateSessionReferrer ( GetResponseEvent $ event ) { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ server = $ event -> getRequest ( ) -> server ; $ referrer = parse_url ( $ server -> get ( 'HTTP_REFERER' , false ) , PHP_URL_HOST ) ; $ host = parse_url ( $ server -> get ( 'HTTP_HOST' ) , PHP_URL_HOST ) ; if ( ( $ referrer != $ host ) && ( $ referrer !== false ) ) { $ event -> getRequest ( ) -> getSession ( ) -> set ( 'referrer' , $ referrer ) ; } } | Update referrer from session . |
45,452 | public function validateCoupon ( CartCouponOnApplyEvent $ event ) { $ this -> cartCouponDispatcher -> dispatchCartCouponOnCheckEvent ( $ event -> getCart ( ) , $ event -> getCoupon ( ) ) ; } | Checks if a Coupon is applicable to a Cart . |
45,453 | public function addEntry ( $ token , $ event , $ uniqueId , $ type , DateTime $ dateTime ) { $ entry = $ this -> entryFactory -> create ( $ token , $ event , $ uniqueId , $ type , $ dateTime ) ; $ this -> entryObjectManager -> persist ( $ entry ) ; $ this -> entryObjectManager -> flush ( $ entry ) ; $ this -> metricsBucket -> add ( $ entry ) ; return $ this ; } | Adds a new entry into database and into metrics bucket . |
45,454 | public function populateCountry ( $ countryCode ) { $ rootLocation = $ this -> locationPopulatorAdapter -> populate ( $ countryCode ) ; $ this -> locationObjectManager -> persist ( $ rootLocation ) ; $ this -> locationObjectManager -> flush ( $ rootLocation ) ; return $ this ; } | Populate the locations for the received country . |
45,455 | public function getTransitionsByName ( $ transitionName ) { return array_filter ( $ this -> transitions , function ( Transition $ transition ) use ( $ transitionName ) { return $ transition -> getName ( ) === $ transitionName ; } ) ; } | Get transitions with specific name . |
45,456 | public function getTransitionsByStartingState ( $ stateName ) { return array_filter ( $ this -> transitions , function ( Transition $ transition ) use ( $ stateName ) { return $ transition -> getStart ( ) -> getName ( ) === $ stateName ; } ) ; } | Get transitions given the name of the start state . |
45,457 | public function getTransitionsByFinalState ( $ stateName ) { return array_filter ( $ this -> transitions , function ( Transition $ transition ) use ( $ stateName ) { return $ transition -> getFinal ( ) -> getName ( ) === $ stateName ; } ) ; } | Get transitions given the name of the final state name . |
45,458 | public function getTransitionByStartingStateAndTransitionName ( $ stateName , $ transitionName ) { $ transition = array_filter ( $ this -> transitions , function ( Transition $ transition ) use ( $ stateName , $ transitionName ) { return $ transition -> getName ( ) === $ transitionName && $ transition -> getStart ( ) -> getName ( ) === $ stateName ; } ) ; return ! empty ( $ transition ) ? reset ( $ transition ) : null ; } | Get transition starting state name and transition name . |
45,459 | public function getTransitionByStartingStateAndFinalState ( $ startStateName , $ finalStateName ) { $ transition = array_filter ( $ this -> transitions , function ( Transition $ transition ) use ( $ startStateName , $ finalStateName ) { return $ transition -> getStart ( ) -> getName ( ) === $ startStateName && $ transition -> getFinal ( ) -> getName ( ) === $ finalStateName ; } ) ; return ! empty ( $ transition ) ? reset ( $ transition ) : null ; } | Get transition starting state name and final state name . |
45,460 | private function formatOutputLocationArray ( $ locations ) { $ formattedResponse = [ ] ; foreach ( $ locations as $ location ) { $ formattedResponse [ ] = $ this -> formatOutputLocation ( $ location ) ; } return $ formattedResponse ; } | Given a group of locations return a simplified output using the ValueObject LocationData ready to be serialized . |
45,461 | public function getChildrenCategories ( CategoryInterface $ parentCategory , $ recursively = false ) { $ categories = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.parent = :parent_category' ) -> setParameters ( [ 'parent_category' => $ parentCategory , ] ) -> getQuery ( ) -> getResult ( ) ; if ( $ recursively && ! empty ( $ categories ) ) { foreach ( $ categories as $ category ) { $ categories = array_merge ( $ categories , $ this -> getChildrenCategories ( $ category , true ) ) ; } } return $ categories ; } | Get the children categories given a parent category . |
45,462 | public function getAvailableParentCategoriesQueryBuilder ( $ categoryId = null ) { $ queryBuilder = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.root = 1' ) ; if ( null !== $ categoryId ) { $ queryBuilder -> andWhere ( 'c.id <> :parent_category' ) -> setParameter ( 'parent_category' , $ categoryId ) ; } return $ queryBuilder ; } | Get the available parent categories for the received usually the category itself and all the non root categories are excluded . |
45,463 | public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ currency = new $ classNamespace ( ) ; $ currency -> setEnabled ( true ) -> setCreatedAt ( $ this -> now ( ) ) ; return $ currency ; } | Creates an instance of Currency entity . |
45,464 | public function preSubmit ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; $ formHash = $ this -> getFormHash ( $ form ) ; $ this -> submittedDataPlain [ $ formHash ] = $ event -> getData ( ) ; } | Pre submit . |
45,465 | public function postSubmit ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; if ( ! $ form -> isValid ( ) ) { return ; } $ entity = $ event -> getData ( ) ; $ formHash = $ this -> getFormHash ( $ form ) ; $ entityConfiguration = $ this -> getTranslatableEntityConfiguration ( $ entity ) ; if ( is_null ( $ entityConfiguration ) ) { return null ; } $ this -> translationsBackup [ $ formHash ] = [ ] ; $ entityData = [ 'object' => $ entity , 'idGetter' => $ entityConfiguration [ 'idGetter' ] , 'alias' => $ entityConfiguration [ 'alias' ] , 'fields' => [ ] , ] ; $ entityFields = $ entityConfiguration [ 'fields' ] ; foreach ( $ entityFields as $ fieldName => $ fieldConfiguration ) { if ( ! isset ( $ this -> submittedDataPlain [ $ formHash ] [ $ fieldName ] ) ) { continue ; } $ field = $ this -> submittedDataPlain [ $ formHash ] [ $ fieldName ] ; foreach ( $ this -> locales as $ locale ) { $ entityData [ 'fields' ] [ $ fieldName ] [ $ locale ] = $ field [ $ locale . '_' . $ fieldName ] ; } if ( $ this -> masterLocale && isset ( $ field [ $ this -> masterLocale . '_' . $ fieldName ] ) ) { $ masterLocaleData = $ field [ $ this -> masterLocale . '_' . $ fieldName ] ; $ setter = $ fieldConfiguration [ 'setter' ] ; $ entity -> $ setter ( $ masterLocaleData ) ; } } $ this -> translationsBackup [ $ formHash ] [ ] = $ entityData ; } | Post submit . |
45,466 | public function saveEntityTranslations ( ) { if ( empty ( $ this -> translationsBackup ) ) { return null ; } foreach ( $ this -> translationsBackup as $ formHash => $ entities ) { foreach ( $ entities as $ entityData ) { $ entity = $ entityData [ 'object' ] ; $ entityIdGetter = $ entityData [ 'idGetter' ] ; $ entityAlias = $ entityData [ 'alias' ] ; $ fields = $ entityData [ 'fields' ] ; foreach ( $ fields as $ fieldName => $ locales ) { foreach ( $ locales as $ locale => $ translation ) { $ this -> entityTranslationProvider -> setTranslation ( $ entityAlias , $ entity -> $ entityIdGetter ( ) , $ fieldName , $ translation , $ locale ) ; } } } } $ this -> entityTranslationProvider -> flushTranslations ( ) ; } | Method executed at the end of the response . Save all entity translations previously generated and waiting for being flushed into database and cache layer . |
45,467 | private function getTranslatableEntityConfiguration ( $ entity ) { $ entityNamespace = get_class ( $ entity ) ; $ classStack = $ this -> getNamespacesFromClass ( $ entityNamespace ) ; foreach ( $ classStack as $ classNamespace ) { if ( array_key_exists ( $ classNamespace , $ this -> translationConfiguration ) ) { return $ this -> translationConfiguration [ $ classNamespace ] ; } } return null ; } | Get configuration for a translatable entity or null if the entity is not translatable . |
45,468 | public function uploadAction ( ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ file = $ request -> files -> get ( $ this -> uploadFieldName ) ; if ( ! ( $ file instanceof UploadedFile ) ) { return new JsonResponse ( [ 'status' => 'ko' , 'response' => [ 'message' => 'Image not found' , ] , ] ) ; } try { $ image = $ this -> imageUploader -> uploadImage ( $ file ) ; $ routes = $ this -> router -> getRouteCollection ( ) ; $ response = [ 'status' => 'ok' , 'response' => [ 'id' => $ image -> getId ( ) , 'extension' => $ image -> getExtension ( ) , 'routes' => [ 'view' => $ routes -> get ( $ this -> viewImageRouteName ) -> getPath ( ) , 'resize' => $ routes -> get ( $ this -> resizeImageRouteName ) -> getPath ( ) , ] , ] , ] ; } catch ( Exception $ exception ) { $ response = [ 'status' => 'ko' , 'response' => [ 'message' => $ exception -> getMessage ( ) , ] , ] ; } return new JsonResponse ( $ response ) ; } | Dynamic upload action . |
45,469 | public function transform ( LocationInterface $ location ) { return $ this -> locationDataFactory -> create ( $ location -> getId ( ) , $ location -> getName ( ) , $ location -> getCode ( ) , $ location -> getType ( ) ) ; } | Transform a Location to LocationData . |
45,470 | public function resolveImage ( ImagesContainerInterface $ imagesContainer ) { if ( $ imagesContainer instanceof PrincipalImageInterface && $ imagesContainer -> getPrincipalImage ( ) instanceof ImageInterface ) { return $ imagesContainer -> getPrincipalImage ( ) ; } $ firstImage = $ imagesContainer -> getSortedImages ( ) -> first ( ) ; return ( $ firstImage instanceof ImageInterface ) ? $ firstImage : false ; } | Return one image given a ImagesContainerInterface implementation . |
45,471 | public function flush ( $ entity ) { $ objectManager = $ this -> get ( 'elcodi.provider.manager' ) -> getManagerByEntityNamespace ( get_class ( $ entity ) ) ; $ objectManager -> persist ( $ entity ) ; $ objectManager -> flush ( $ entity ) ; return $ this ; } | Save an entity . To ensure the method is simple the entity will be persisted always . |
45,472 | public function clear ( $ entity ) { $ objectManager = $ this -> get ( 'elcodi.provider.manager' ) -> getManagerByEntityNamespace ( get_class ( $ entity ) ) ; $ objectManager -> clear ( $ entity ) ; return $ this ; } | Remove an entity from ORM map . |
45,473 | public function load ( ObjectManager $ objectManager ) { $ zoneDirector = $ this -> getDirector ( 'zone' ) ; $ zone08021 = $ zoneDirector -> create ( ) -> setName ( 'Postalcode 08021' ) -> setCode ( 'zone-08021' ) -> addLocation ( $ this -> getReference ( 'location-sant-celoni' ) ) -> addLocation ( $ this -> getReference ( 'location-08021' ) ) ; $ this -> setReference ( 'zone-08021' , $ zone08021 ) ; $ zoneDirector -> save ( $ zone08021 ) ; $ zoneViladecavalls = $ zoneDirector -> create ( ) -> setName ( 'Viladecavalls i alrededores' ) -> setCode ( 'zone-viladecavalls' ) -> addLocation ( $ this -> getReference ( 'location-viladecavalls' ) ) ; $ this -> setReference ( 'zone-viladecavalls' , $ zoneViladecavalls ) ; $ zoneDirector -> save ( $ zoneViladecavalls ) ; } | Loads sample fixtures for Zone entities . |
45,474 | public function getPurchasableAmount ( ) { return \ Elcodi \ Component \ Currency \ Entity \ Money :: create ( $ this -> purchasableAmount , $ this -> purchasableCurrency ) ; } | Gets the purchasable or purchasables amount with tax . |
45,475 | public function setPurchasableAmount ( \ Elcodi \ Component \ Currency \ Entity \ Interfaces \ MoneyInterface $ amount ) { $ this -> purchasableAmount = $ amount -> getAmount ( ) ; $ this -> purchasableCurrency = $ amount -> getCurrency ( ) ; return $ this ; } | Sets the purchasable or purchasables amount with tax . |
45,476 | public function getAmount ( ) { return \ Elcodi \ Component \ Currency \ Entity \ Money :: create ( $ this -> amount , $ this -> currency ) ; } | Gets the total amount with tax . |
45,477 | public function setAmount ( \ Elcodi \ Component \ Currency \ Entity \ Interfaces \ MoneyInterface $ amount ) { $ this -> amount = $ amount -> getAmount ( ) ; $ this -> currency = $ amount -> getCurrency ( ) ; return $ this ; } | Sets the total amount with tax . |
45,478 | public function updateCarts ( AddressOnCloneEvent $ event ) { $ originalAddress = $ event -> getOriginalAddress ( ) ; $ clonedAddress = $ event -> getClonedAddress ( ) ; $ carts = $ this -> cartRepository -> findAllCartsWithAddress ( $ originalAddress ) ; foreach ( $ carts as $ cart ) { $ deliveryAddress = $ cart -> getDeliveryAddress ( ) ; $ billingAddress = $ cart -> getBillingAddress ( ) ; if ( $ deliveryAddress instanceof AddressInterface && $ deliveryAddress -> getId ( ) == $ originalAddress -> getId ( ) ) { $ cart -> setDeliveryAddress ( $ clonedAddress ) ; } if ( $ billingAddress instanceof AddressInterface && $ billingAddress -> getId ( ) == $ originalAddress -> getId ( ) ) { $ cart -> setBillingAddress ( $ clonedAddress ) ; } $ this -> cartObjectManager -> flush ( $ cart ) ; } } | Updates all the carts with the cloned address . |
45,479 | public function dump ( $ basepath , $ language = null ) { $ sitemapData = $ this -> sitemapBuilder -> build ( $ basepath , $ language ) ; $ path = $ this -> resolvePathWithLanguage ( $ this -> path , $ language ) ; $ this -> sitemapDumper -> dump ( $ path , $ sitemapData ) ; } | Dump builder using a dumper . |
45,480 | public function preUpdate ( PreUpdateEventArgs $ eventArgs ) { $ entity = $ eventArgs -> getEntity ( ) ; if ( $ this -> checkEntityType ( $ entity ) ) { if ( $ eventArgs -> hasChangedField ( 'password' ) ) { $ password = $ entity -> getPassword ( ) ; if ( ! empty ( $ password ) ) { $ encodedPassword = $ this -> encryptPassword ( $ password ) ; $ eventArgs -> setNewValue ( 'password' , $ encodedPassword ) ; } } } } | PreUpdate event listener . |
45,481 | public function prePersist ( LifecycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; if ( $ this -> checkEntityType ( $ entity ) ) { $ password = $ entity -> getPassword ( ) ; if ( ! empty ( $ password ) ) { $ encodedPassword = $ this -> encryptPassword ( $ password ) ; $ entity -> setPassword ( $ encodedPassword ) ; } } } | New entity . Password must be encrypted always . |
45,482 | protected function getInstalledPluginBundles ( \ Symfony \ Component \ HttpKernel \ KernelInterface $ kernel ) { $ plugins = [ ] ; $ bundles = $ kernel -> getBundles ( ) ; foreach ( $ bundles as $ bundle ) { if ( $ bundle instanceof \ Symfony \ Component \ HttpKernel \ Bundle \ Bundle && $ bundle instanceof \ Elcodi \ Component \ Plugin \ Interfaces \ PluginInterface ) { $ pluginNamespace = $ bundle -> getNamespace ( ) ; $ plugins [ $ pluginNamespace ] = $ bundle ; } } return $ plugins ; } | Load installed plugin bundles and return an array with them indexed by their namespaces . |
45,483 | private function buildResponseFromImage ( Request $ request , ImageInterface $ image ) { $ response = new Response ( ) ; $ height = $ request -> get ( 'height' ) ; $ width = $ request -> get ( 'width' ) ; $ type = $ request -> get ( 'type' ) ; $ response -> setEtag ( $ this -> imageEtagTransformer -> transform ( $ image , $ height , $ width , $ type ) ) -> setLastModified ( $ image -> getUpdatedAt ( ) ) -> setPublic ( ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response -> setStatusCode ( 304 ) ; } $ image = $ this -> imageManager -> resize ( $ image , $ height , $ width , $ type ) ; $ imageData = $ image -> getContent ( ) ; $ response -> setStatusCode ( 200 ) -> setMaxAge ( $ this -> maxAge ) -> setSharedMaxAge ( $ this -> sharedMaxAge ) -> setContent ( $ imageData ) ; $ response -> headers -> add ( [ 'Content-Type' => $ image -> getContentType ( ) , ] ) ; return $ response ; } | Create new response given a request and an image . |
45,484 | protected function loadCartFromSession ( ) { $ cartIdInSession = $ this -> cartSessionManager -> get ( ) ; if ( ! $ cartIdInSession ) { return null ; } $ cart = $ this -> cartRepository -> findOneBy ( [ 'id' => $ cartIdInSession , 'ordered' => false , ] ) ; return ( $ cart instanceof CartInterface ) ? $ cart : null ; } | Get cart from session . |
45,485 | public function load ( ObjectManager $ manager ) { $ currency = $ this -> getReference ( 'currency-dollar' ) ; $ productWithVariants = $ this -> getReference ( 'product-with-variants' ) ; $ variantDirector = $ this -> getDirector ( 'product_variant' ) ; $ optionWhite = $ this -> getReference ( 'value-color-white' ) ; $ optionRed = $ this -> getReference ( 'value-color-red' ) ; $ optionSmall = $ this -> getReference ( 'value-size-small' ) ; $ optionLarge = $ this -> getReference ( 'value-size-large' ) ; $ variantWhiteSmall = $ variantDirector -> create ( ) -> setSku ( 'variant-white-small-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionWhite ) -> addOption ( $ optionSmall ) -> setPrice ( Money :: create ( 1500 , $ currency ) ) -> setHeight ( 13 ) -> setWidth ( 12 ) -> setDepth ( 19 ) -> setWeight ( 125 ) -> setEnabled ( true ) ; $ productWithVariants -> setPrincipalVariant ( $ variantWhiteSmall ) ; $ variantDirector -> save ( $ variantWhiteSmall ) ; $ this -> addReference ( 'variant-white-small' , $ variantWhiteSmall ) ; $ variantWhiteLarge = $ variantDirector -> create ( ) -> setSku ( 'variant-white-large-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionWhite ) -> addOption ( $ optionLarge ) -> setPrice ( Money :: create ( 1800 , $ currency ) ) -> setHeight ( 12 ) -> setWidth ( 11 ) -> setDepth ( 45 ) -> setWeight ( 155 ) -> setEnabled ( true ) ; $ variantDirector -> save ( $ variantWhiteLarge ) ; $ this -> addReference ( 'variant-white-large' , $ variantWhiteLarge ) ; $ variantRedSmall = $ variantDirector -> create ( ) -> setSku ( 'variant-red-small-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionRed ) -> addOption ( $ optionSmall ) -> setPrice ( Money :: create ( 1500 , $ currency ) ) -> setHeight ( 19 ) -> setWidth ( 9 ) -> setDepth ( 33 ) -> setWeight ( 1000 ) -> setEnabled ( true ) ; $ this -> storeProductImage ( $ variantRedSmall , 'variant.jpg' ) ; $ variantDirector -> save ( $ variantRedSmall ) ; $ this -> addReference ( 'variant-red-small' , $ variantRedSmall ) ; $ variantRedLarge = $ variantDirector -> create ( ) -> setSku ( 'variant-red-large-sku' ) -> setStock ( 100 ) -> setProduct ( $ productWithVariants ) -> addOption ( $ optionRed ) -> addOption ( $ optionLarge ) -> setPrice ( Money :: create ( 1800 , $ currency ) ) -> setHeight ( 50 ) -> setWidth ( 30 ) -> setDepth ( 18 ) -> setWeight ( 70 ) -> setEnabled ( true ) ; $ variantDirector -> save ( $ variantRedLarge ) ; $ this -> addReference ( 'variant-red-large' , $ variantRedLarge ) ; } | Loads sample fixtures for product Variant entities . |
45,486 | public function toArray ( AddressInterface $ address ) { $ cityLocationId = $ address -> getCity ( ) ; $ cityHierarchy = $ this -> locationProvider -> getHierarchy ( $ cityLocationId ) ; $ cityHierarchyAsc = array_reverse ( $ cityHierarchy ) ; $ addressArray = [ 'id' => $ address -> getId ( ) , 'name' => $ address -> getName ( ) , 'recipientName' => $ address -> getRecipientName ( ) , 'recipientSurname' => $ address -> getRecipientSurname ( ) , 'address' => $ address -> getAddress ( ) , 'addressMore' => $ address -> getAddressMore ( ) , 'postalCode' => $ address -> getPostalcode ( ) , 'phone' => $ address -> getPhone ( ) , 'mobile' => $ address -> getMobile ( ) , 'comment' => $ address -> getComments ( ) , ] ; foreach ( $ cityHierarchyAsc as $ cityLocationNode ) { $ addressArray [ 'city' ] [ $ cityLocationNode -> getType ( ) ] = $ cityLocationNode -> getName ( ) ; } $ addressArray [ 'fullAddress' ] = $ this -> buildFullAddressString ( $ address , $ addressArray [ 'city' ] ) ; return $ addressArray ; } | Formats an address on an array . |
45,487 | private function buildFullAddressString ( AddressInterface $ address , array $ cityHierarchy ) { $ cityString = implode ( ', ' , $ cityHierarchy ) ; return sprintf ( '%s %s, %s %s' , $ address -> getAddress ( ) , $ address -> getAddressMore ( ) , $ cityString , $ address -> getPostalcode ( ) ) ; } | Builds a full address string . |
45,488 | public function loadCountry ( $ countryIso ) { $ content = $ this -> locationLoaderAdapter -> getSqlForCountry ( $ countryIso ) ; $ statement = $ this -> locationEntityManager -> getConnection ( ) -> prepare ( $ content ) ; $ statement -> execute ( ) ; return $ this ; } | Load country data . |
45,489 | public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ cartLine = new $ classNamespace ( ) ; $ cartLine -> setAmount ( $ this -> createZeroAmountMoney ( ) ) -> setPurchasableAmount ( $ this -> createZeroAmountMoney ( ) ) ; return $ cartLine ; } | Creates an instance of CartLine . |
45,490 | public function get ( $ key , $ default = null ) { if ( array_key_exists ( $ key , $ this -> context ) ) { return $ this -> context [ $ key ] ; } return $ default ; } | Get a value from the context with a fallback default . |
45,491 | public function evaluate ( RuleInterface $ rule , array $ context = [ ] ) { $ context = array_merge ( $ this -> contextProvider -> getContext ( ) , $ context ) ; return $ this -> expressionLanguage -> evaluate ( $ rule -> getExpression ( ) , $ context ) ; } | Evaluates a rule and returns result . |
45,492 | public function resize ( ImageInterface $ imageMedia , array $ options ) { $ this -> prepareRouterContext ( ) ; $ absoluteUrlOption = isset ( $ options [ 'absolute_url' ] ) ? $ options [ 'absolute_url' ] : false ; $ routeReferenceType = $ this -> getReferenceType ( $ absoluteUrlOption ) ; $ generatedRoute = $ this -> router -> generate ( $ this -> imageResizeControllerRouteName , [ 'id' => ( int ) $ imageMedia -> getId ( ) , 'height' => ( int ) $ options [ 'height' ] , 'width' => ( int ) $ options [ 'width' ] , 'type' => ( int ) $ options [ 'type' ] , '_format' => $ imageMedia -> getExtension ( ) , ] , $ routeReferenceType ) ; $ this -> fixRouterContext ( ) ; return $ generatedRoute ; } | Return route of image with desired resize . |
45,493 | public function viewImage ( ImageInterface $ imageMedia , $ absoluteUrl = false ) { $ this -> prepareRouterContext ( ) ; $ routeReferenceType = $ this -> getReferenceType ( $ absoluteUrl ) ; $ generatedRoute = $ this -> router -> generate ( $ this -> imageViewControllerRouteName , [ 'id' => ( int ) $ imageMedia -> getId ( ) , '_format' => $ imageMedia -> getExtension ( ) , ] , $ routeReferenceType ) ; $ this -> fixRouterContext ( ) ; return $ generatedRoute ; } | Return route of image . |
45,494 | private function prepareRouterContext ( ) { if ( $ this -> generatedRouteHost ) { $ this -> router -> setContext ( $ this -> modifiedContext ) ; $ this -> router -> getContext ( ) -> setHost ( $ this -> generatedRouteHost ) ; } } | Prepares the Host part of a image resize URL . |
45,495 | private function getReferenceType ( $ absoluteUrlOption = false ) { return ( $ this -> generatedRouteHost || $ absoluteUrlOption ) ? UrlGeneratorInterface :: ABSOLUTE_URL : UrlGeneratorInterface :: ABSOLUTE_PATH ; } | Gets the reference type depending on the option and the generated route host . |
45,496 | public function getEtag ( ) { $ sha1Able = ( $ this instanceof IdentifiableInterface ) ? $ this -> getId ( ) : spl_object_hash ( $ this ) ; if ( $ this instanceof DateTimeInterface ) { $ sha1Able .= $ this -> getUpdatedAt ( ) -> getTimestamp ( ) ; } return sha1 ( $ sha1Able ) ; } | Return etag from entity . |
45,497 | public function get ( ) { if ( $ this -> store instanceof StoreInterface ) { return $ this -> store ; } $ stores = $ this -> storeRepository -> findAll ( ) ; if ( empty ( $ stores ) ) { throw new StoreNotFoundException ( ) ; } $ this -> store = reset ( $ stores ) ; return $ this -> store ; } | Load store . |
45,498 | public function dispatchCartLoadEvents ( CartInterface $ cart ) { $ this -> dispatchCartPreLoadEvent ( $ cart ) -> dispatchCartOnLoadEvent ( $ cart ) ; $ cart -> setLoaded ( true ) ; return $ this ; } | Dispatch all cart events . |
45,499 | public function dispatchCartPreLoadEvent ( CartInterface $ cart ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CART_PRELOAD , new CartPreLoadEvent ( $ cart ) ) ; return $ this ; } | Dispatch cart event just before is loaded . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.