idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
45,500
public function dispatchCartOnLoadEvent ( CartInterface $ cart ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CART_ONLOAD , new CartOnLoadEvent ( $ cart ) ) ; return $ this ; }
Dispatch event when Cart is loaded .
45,501
public function dispatchCartInconsistentEvent ( CartInterface $ cart , CartLineInterface $ cartLine ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CART_INCONSISTENT , new CartInconsistentEvent ( $ cart , $ cartLine ) ) ; return $ this ; }
Dispatch cart event for inconsistent cart .
45,502
public function dispatchCartOnEmptyEvent ( CartInterface $ cart ) { $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: CART_ONEMPTY , new CartOnEmptyEvent ( $ cart ) ) ; return $ this ; }
Dispatch cart event when a cart ois emptied .
45,503
public function onUserRegister ( UserRegisterEvent $ event ) { $ masterRequest = $ this -> requestStack -> getMasterRequest ( ) ; if ( ! ( $ masterRequest instanceof Request ) ) { return $ this ; } if ( null === $ this -> tokenStorage -> getToken ( ) ) { return $ this ; } $ token = $ this -> createNewToken ( $ event -> getUser ( ) ) ; $ this -> tokenStorage -> setToken ( $ token ) ; $ event = new InteractiveLoginEvent ( $ masterRequest , $ token ) ; $ this -> dispatcher -> dispatch ( SecurityEvents :: INTERACTIVE_LOGIN , $ event ) ; return $ this ; }
Autologin users after registration .
45,504
private function createNewToken ( AbstractUserInterface $ user ) { return new UsernamePasswordToken ( $ user , null , $ this -> providerKey , $ user -> getRoles ( ) ) ; }
Generate new token given a user .
45,505
public function saveCart ( CartInterface $ cart ) { if ( ! $ cart -> getCartLines ( ) -> isEmpty ( ) ) { $ this -> cartObjectManager -> persist ( $ cart ) ; } $ this -> cartObjectManager -> flush ( ) ; }
Flushes all loaded cart and related entities .
45,506
public function set ( CartInterface $ cart ) { if ( ! $ this -> saveInSession ) { return $ this ; } $ this -> session -> set ( $ this -> sessionFieldName , $ cart -> getId ( ) ) ; return $ this ; }
Set Cart in session .
45,507
public function render ( array $ sitemapElements , $ basepath ) { $ data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ; $ data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL ; foreach ( $ sitemapElements as $ sitemapElement ) { $ data .= ' <url>' . PHP_EOL ; $ data .= ' <loc>' . $ basepath . $ sitemapElement -> getLocation ( ) . '</loc>' . PHP_EOL ; $ lastModification = $ sitemapElement -> getLastModification ( ) ; if ( null !== $ lastModification ) { $ data .= ' <lastmod>' . $ lastModification . '</lastmod>' . PHP_EOL ; } $ changeFrequency = $ sitemapElement -> getChangeFrequency ( ) ; if ( null !== $ changeFrequency ) { $ data .= ' <changefreq>' . $ changeFrequency . '</changefreq>' . PHP_EOL ; } $ priority = $ sitemapElement -> getPriority ( ) ; if ( null !== $ priority ) { $ data .= ' <priority>' . $ priority . '</priority>' . PHP_EOL ; } $ data .= ' </url>' . PHP_EOL ; } $ data .= '</urlset>' . PHP_EOL ; return $ data ; }
Given an array of sitemapElements render the Sitemap .
45,508
public function createAndSaveCartCoupon ( CartInterface $ cart , CouponInterface $ coupon ) { $ cartCoupon = $ this -> cartCouponDirector -> create ( ) ; $ cartCoupon -> setCart ( $ cart ) ; $ cartCoupon -> setCoupon ( $ coupon ) ; $ this -> cartCouponDirector -> save ( $ cartCoupon ) ; return $ cartCoupon ; }
Create a cart coupon given a cart and a coupon .
45,509
public function addCouponByCode ( CartInterface $ cart , $ couponCode ) { $ coupon = $ this -> couponRepository -> findOneBy ( [ 'code' => $ couponCode , 'enabled' => true , ] ) ; if ( ! ( $ coupon instanceof CouponInterface ) ) { throw new CouponNotAvailableException ( ) ; } return $ this -> addCoupon ( $ cart , $ coupon ) ; }
Given a coupon code applies it to cart .
45,510
public function addCoupon ( CartInterface $ cart , CouponInterface $ coupon ) { $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnApplyEvent ( $ cart , $ coupon ) ; return $ this ; }
Adds a Coupon to a Cart and recalculates the Cart Totals .
45,511
public function removeCouponByCode ( CartInterface $ cart , $ couponCode ) { $ coupon = $ this -> couponRepository -> findOneBy ( [ 'code' => $ couponCode , ] ) ; if ( ! ( $ coupon instanceof CouponInterface ) ) { return false ; } return $ this -> removeCoupon ( $ cart , $ coupon ) ; }
Given a coupon code removes it from cart .
45,512
public function removeCoupon ( CartInterface $ cart , CouponInterface $ coupon ) { $ cartCoupons = $ this -> cartCouponDirector -> findBy ( [ 'cart' => $ cart , 'coupon' => $ coupon , ] ) ; if ( empty ( $ cartCoupons ) ) { return false ; } foreach ( $ cartCoupons as $ cartCoupon ) { $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnRemoveEvent ( $ cartCoupon ) ; } return true ; }
Removes a Coupon from a Cart and recalculates Cart Totals .
45,513
public function addSubnode ( \ Elcodi \ Component \ Menu \ Entity \ Menu \ Interfaces \ NodeInterface $ node ) { if ( $ node !== $ this ) { $ this -> subnodes -> add ( $ node ) ; } return $ this ; }
Add subnode .
45,514
public function removeSubnode ( \ Elcodi \ Component \ Menu \ Entity \ Menu \ Interfaces \ NodeInterface $ node ) { $ this -> subnodes -> removeElement ( $ node ) ; return $ this ; }
Remove subnode .
45,515
public function setSubnodes ( \ Doctrine \ Common \ Collections \ ArrayCollection $ subnodes ) { $ this -> subnodes = $ subnodes ; return $ this ; }
Sets Subnodes .
45,516
public function getSubnodes ( ) { $ sort = \ Doctrine \ Common \ Collections \ Criteria :: create ( ) ; $ sort -> orderBy ( [ 'priority' => \ Doctrine \ Common \ Collections \ Criteria :: DESC , ] ) ; return $ this -> subnodes -> matching ( $ sort ) ; }
Get Subnodes sorted by priority .
45,517
public function getSubnodesByTag ( $ tag ) { return $ this -> getSubnodes ( ) -> filter ( function ( \ Elcodi \ Component \ Menu \ Entity \ Menu \ Interfaces \ NodeInterface $ menuNode ) use ( $ tag ) { return $ menuNode -> getTag ( ) == $ tag ; } ) ; }
Get Subnodes sorted by priority and filtered by tag .
45,518
public function findSubnodeByName ( $ subnodeName , $ inDepth = true ) { $ subnodes = $ this -> getSubnodes ( ) ; foreach ( $ subnodes as $ subnode ) { if ( $ subnodeName == $ subnode -> getName ( ) ) { return $ subnode ; } if ( $ inDepth ) { $ subnode = $ subnode -> findSubnodeByName ( $ subnodeName , $ inDepth ) ; if ( $ subnode instanceof \ Elcodi \ Component \ Menu \ Entity \ Menu \ Interfaces \ NodeInterface ) { return $ subnode ; } } } return null ; }
Find subnode given its name . You can decide if this search is deep or not .
45,519
private function addLine ( CartInterface $ cart , CartLineInterface $ cartLine ) { $ cartLine -> setCart ( $ cart ) ; $ cart -> addCartLine ( $ cartLine ) ; $ this -> cartLineEventDispatcher -> dispatchCartLineOnAddEvent ( $ cart , $ cartLine ) ; $ this -> cartEventDispatcher -> dispatchCartLoadEvents ( $ cart ) ; return $ this ; }
Adds cartLine to Cart .
45,520
public function emptyLines ( CartInterface $ cart ) { $ cart -> getCartLines ( ) -> map ( function ( CartLineInterface $ cartLine ) use ( $ cart ) { $ this -> silentRemoveLine ( $ cart , $ cartLine ) ; } ) ; $ this -> cartEventDispatcher -> dispatchCartOnEmptyEvent ( $ cart ) ; $ this -> cartEventDispatcher -> dispatchCartLoadEvents ( $ cart ) ; return $ this ; }
Empty cart .
45,521
public function editCartLine ( CartLineInterface $ cartLine , PurchasableInterface $ purchasable , $ quantity ) { $ cart = $ cartLine -> getCart ( ) ; if ( ! ( $ cart instanceof CartInterface ) ) { return $ this ; } $ cartLine -> setPurchasable ( $ purchasable ) ; $ this -> setCartLineQuantity ( $ cartLine , $ quantity ) ; return $ this ; }
Edit CartLine .
45,522
public function increaseCartLineQuantity ( CartLineInterface $ cartLine , $ quantity ) { if ( ! is_int ( $ quantity ) || empty ( $ quantity ) ) { return $ this ; } $ newQuantity = $ cartLine -> getQuantity ( ) + $ quantity ; return $ this -> setCartLineQuantity ( $ cartLine , $ newQuantity ) ; }
Adds quantity to cartLine .
45,523
public function decreaseCartLineQuantity ( CartLineInterface $ cartLine , $ quantity ) { if ( ! is_int ( $ quantity ) || empty ( $ quantity ) ) { return $ this ; } return $ this -> increaseCartLineQuantity ( $ cartLine , ( $ quantity * - 1 ) ) ; }
Removes quantity to cartLine .
45,524
public function setCartLineQuantity ( CartLineInterface $ cartLine , $ quantity ) { $ cart = $ cartLine -> getCart ( ) ; if ( ! ( $ cart instanceof CartInterface ) ) { return $ this ; } if ( is_int ( $ quantity ) && $ quantity <= 0 ) { $ this -> silentRemoveLine ( $ cart , $ cartLine ) ; } elseif ( is_int ( $ quantity ) ) { $ cartLine -> setQuantity ( $ quantity ) ; $ this -> cartLineEventDispatcher -> dispatchCartLineOnEditEvent ( $ cart , $ cartLine ) ; } else { return $ this ; } $ this -> cartEventDispatcher -> dispatchCartLoadEvents ( $ cart ) ; return $ this ; }
Sets quantity to cartLine .
45,525
public function addPurchasable ( CartInterface $ cart , PurchasableInterface $ purchasable , $ quantity ) { if ( ! is_int ( $ quantity ) || $ quantity <= 0 ) { return $ this ; } foreach ( $ cart -> getCartLines ( ) as $ cartLine ) { if ( ( get_class ( $ cartLine -> getPurchasable ( ) ) === get_class ( $ purchasable ) ) && ( $ cartLine -> getPurchasable ( ) -> getId ( ) == $ purchasable -> getId ( ) ) ) { return $ this -> increaseCartLineQuantity ( $ cartLine , $ quantity ) ; } } $ cartLine = $ this -> cartLineFactory -> create ( ) ; $ cartLine -> setPurchasable ( $ purchasable ) -> setQuantity ( $ quantity ) ; $ this -> addLine ( $ cart , $ cartLine ) ; return $ this ; }
Add a Purchasable to Cart as a new CartLine .
45,526
public function removePurchasable ( CartInterface $ cart , PurchasableInterface $ purchasable , $ quantity ) { if ( ! is_int ( $ quantity ) || $ quantity <= 0 ) { return $ this ; } foreach ( $ cart -> getCartLines ( ) as $ cartLine ) { if ( ( get_class ( $ cartLine -> getPurchasable ( ) ) === get_class ( $ purchasable ) ) && ( $ cartLine -> getPurchasable ( ) -> getId ( ) == $ purchasable -> getId ( ) ) ) { return $ this -> decreaseCartLineQuantity ( $ cartLine , $ quantity ) ; } } return $ this ; }
Remove a Purchasable from Cart .
45,527
public function getBeaconsUnique ( $ token , $ event , array $ dates ) { $ keys = [ ] ; foreach ( $ dates as $ date ) { $ keys [ ] = $ this -> generateEntryKey ( $ token , $ event , $ date ) . '_unique' ; } return ( int ) $ this -> doRedisQuery ( function ( ) use ( $ keys ) { $ this -> redis -> pfCount ( $ keys ) ; } , 0 ) ; }
Get number of unique beacons given an event and a set of dates .
45,528
public function getBeaconsTotal ( $ token , $ event , array $ dates ) { $ total = 0 ; foreach ( $ dates as $ date ) { $ key = $ this -> generateEntryKey ( $ token , $ event , $ date ) ; $ total += $ this -> doRedisQuery ( function ( ) use ( $ key ) { $ this -> redis -> get ( $ key . '_total' ) ; } , 0 ) ; } return $ total ; }
Get the total of beacons given an event and a set of dates .
45,529
public function getDistributions ( $ token , $ event , array $ dates ) { $ distributions = [ ] ; foreach ( $ dates as $ date ) { $ key = $ this -> generateEntryKey ( $ token , $ event , $ date ) ; $ partials = $ this -> doRedisQuery ( function ( ) use ( $ key ) { $ this -> redis -> hgetall ( $ key . '_distr' ) ; } , [ ] ) ; foreach ( $ partials as $ key => $ value ) { $ distributions [ $ key ] = isset ( $ partialTotals [ $ key ] ) ? $ distributions [ $ key ] + $ value : $ value ; } } arsort ( $ distributions ) ; return $ distributions ; }
Get distributions given an event and a set of dates .
45,530
private function addBeaconMetricUnique ( EntryInterface $ entry , $ entryKey ) { $ this -> doRedisQuery ( function ( ) use ( $ entry , $ entryKey ) { $ this -> redis -> pfAdd ( $ entryKey . '_unique' , $ entry -> getValue ( ) ) ; } ) ; return $ this ; }
Add beacon unique nb given the key entry .
45,531
private function addBeaconMetricTotal ( $ entryKey ) { $ this -> doRedisQuery ( function ( ) use ( $ entryKey ) { $ this -> redis -> incr ( $ entryKey . '_total' ) ; } ) ; return $ this ; }
Add beacon total nb given the key entry .
45,532
private function addAccumulativeEntry ( EntryInterface $ entry , $ entryKey ) { $ this -> doRedisQuery ( function ( ) use ( $ entry , $ entryKey ) { $ this -> redis -> incrby ( $ entryKey . '_accum' , ( int ) $ entry -> getValue ( ) ) ; } ) ; return $ this ; }
Add accumulative metric .
45,533
private function addDistributedEntry ( EntryInterface $ entry , $ entryKey ) { $ this -> doRedisQuery ( function ( ) use ( $ entry , $ entryKey ) { $ this -> redis -> hincrby ( $ entryKey . '_distr' , $ entry -> getValue ( ) , 1 ) ; } ) ; return $ this ; }
Add distributed metric .
45,534
public function save ( $ data ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ entity ) { $ this -> manager -> persist ( $ entity ) ; } } else { $ this -> manager -> persist ( $ data ) ; } $ this -> manager -> flush ( $ data ) ; return $ data ; }
Save the instance into database . Given data can be a single object or an array of objects .
45,535
public function remove ( $ data ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ entity ) { $ this -> manager -> remove ( $ entity ) ; } } else { $ this -> manager -> remove ( $ data ) ; } $ this -> manager -> flush ( $ data ) ; return $ data ; }
Remove the instance from the database . Given data can be a single object or an array of objects .
45,536
public function setFactory ( \ Elcodi \ Component \ Core \ Factory \ Abstracts \ AbstractFactory $ factory ) { $ this -> factory = $ factory ; return $ this ; }
Sets Factory .
45,537
public function setOptions ( Collection $ options ) { if ( $ options -> isEmpty ( ) ) { $ this -> options = $ options ; } else { $ this -> options -> clear ( ) ; } foreach ( $ options as $ option ) { $ this -> addOption ( $ option ) ; } return $ this ; }
Sets this variant option values .
45,538
public function addOption ( ValueInterface $ option ) { if ( ! $ this -> product instanceof ProductInterface ) { throw new \ LogicException ( 'Cannot add options to a Variant before setting a parent Product' ) ; } $ this -> options -> add ( $ option ) ; $ this -> product -> addAttribute ( $ option -> getAttribute ( ) ) ; return $ this ; }
Adds an option to this variant .
45,539
public function addAttribute ( AttributeInterface $ attribute ) { if ( ! $ this -> attributes -> contains ( $ attribute ) ) { $ this -> attributes -> add ( $ attribute ) ; } return $ this ; }
Adds an attribute if not already in the collection .
45,540
public function convertMoney ( MoneyInterface $ money , CurrencyInterface $ currencyTo ) { $ currencyFrom = $ money -> getCurrency ( ) ; $ amount = $ money -> getAmount ( ) ; return $ this -> convertCurrency ( $ currencyFrom , $ currencyTo , $ amount ) ; }
Given an amount convert it to desired Currency .
45,541
private function convertCurrency ( CurrencyInterface $ currencyFrom , CurrencyInterface $ currencyTo , $ amount ) { if ( $ currencyFrom -> getIso ( ) == $ currencyTo -> getIso ( ) ) { return Money :: create ( $ amount , $ currencyFrom ) ; } $ exchangeRate = $ this -> exchangeRateCalculator -> calculateExchangeRate ( $ currencyFrom , $ currencyTo ) ; return Money :: create ( $ amount * $ exchangeRate , $ currencyTo ) ; }
Convert amount between two currencies .
45,542
public function execute ( $ hookName , array $ context = [ ] , $ content = '' ) { $ event = new EventAdapter ( $ context , $ content ) ; $ this -> eventDispatcher -> dispatch ( $ hookName , $ event ) ; return $ event -> getContent ( ) ; }
Dispatches all listeners and filters related to a hook .
45,543
public function dispatchPaymentCollectionEvent ( CartInterface $ cart = null ) { $ event = new PaymentCollectionEvent ( $ cart ) ; $ this -> eventDispatcher -> dispatch ( ElcodiPaymentEvents :: PAYMENT_COLLECT , $ event ) ; return $ event -> getPaymentMethods ( ) ; }
Dispatch payment methods collection .
45,544
public function create ( ) { $ now = $ this -> now ( ) ; $ zeroPrice = $ this -> createZeroAmountMoney ( ) ; $ classNamespace = $ this -> getEntityNamespace ( ) ; $ coupon = new $ classNamespace ( ) ; $ coupon -> setType ( ElcodiCouponTypes :: TYPE_AMOUNT ) -> setPrice ( $ zeroPrice ) -> setAbsolutePrice ( $ zeroPrice ) -> setMinimumPurchase ( $ zeroPrice ) -> setEnforcement ( ElcodiCouponTypes :: ENFORCEMENT_MANUAL ) -> setUsed ( 0 ) -> setCount ( 0 ) -> setPriority ( 0 ) -> setStackable ( false ) -> setEnabled ( false ) -> setCreatedAt ( $ now ) -> setValidFrom ( $ now ) ; return $ coupon ; }
Creates an instance of a simple coupon .
45,545
public function createOrderLinesByCartLines ( OrderInterface $ order , Collection $ cartLines ) { $ orderLines = new ArrayCollection ( ) ; foreach ( $ cartLines as $ cartLine ) { $ orderLine = $ this -> createOrderLineByCartLine ( $ order , $ cartLine ) ; $ cartLine -> setOrderLine ( $ orderLine ) ; $ orderLines -> add ( $ orderLine ) ; } return $ orderLines ; }
Given a set of CartLines return a set of OrderLines .
45,546
public function createOrderLineByCartLine ( OrderInterface $ order , CartLineInterface $ cartLine ) { $ orderLine = ( $ cartLine -> getOrderLine ( ) instanceof OrderLineInterface ) ? $ cartLine -> getOrderLine ( ) : $ this -> orderLineFactory -> create ( ) ; $ orderLine -> setOrder ( $ order ) -> setPurchasable ( $ cartLine -> getPurchasable ( ) ) -> setQuantity ( $ cartLine -> getQuantity ( ) ) -> setPurchasableAmount ( $ cartLine -> getPurchasableAmount ( ) ) -> setAmount ( $ cartLine -> getAmount ( ) ) -> setHeight ( $ cartLine -> getHeight ( ) ) -> setWidth ( $ cartLine -> getWidth ( ) ) -> setDepth ( $ cartLine -> getDepth ( ) ) -> setWeight ( $ cartLine -> getWeight ( ) ) ; $ this -> orderLineEventDispatcher -> dispatchOrderLineOnCreatedEvent ( $ order , $ cartLine , $ orderLine ) ; return $ orderLine ; }
Given a cart line creates a new order line .
45,547
public function getAvailableStates ( $ startStateName ) { return array_filter ( $ this -> transitionChain -> getTransitions ( ) , function ( Transition $ transition ) use ( $ startStateName ) { return $ transition -> getStart ( ) -> getName ( ) === $ startStateName ; } ) ; }
Get available states given a start state .
45,548
public function calculateExchangeRate ( CurrencyInterface $ currencyFrom , CurrencyInterface $ currencyTo ) { $ currencyFromIso = $ currencyFrom -> getIso ( ) ; $ currencyToIso = $ currencyTo -> getIso ( ) ; if ( $ currencyFromIso == $ currencyToIso ) { return 1.0 ; } return $ this -> calculateExchangeRateBetweenIsos ( $ currencyFromIso , $ currencyToIso ) ; }
Calculates the exchange rate .
45,549
protected function calculateExchangeRateBetweenIsos ( $ currencyFromIso , $ currencyToIso ) { $ currencyExchangeRates = $ this -> currencyManager -> getExchangeRateList ( ) ; if ( $ this -> defaultExchangeCurrencyIso == $ currencyFromIso && isset ( $ currencyExchangeRates [ $ currencyToIso ] ) ) { $ exchangeRate = $ currencyExchangeRates [ $ currencyToIso ] [ 'rate' ] ; } elseif ( $ this -> defaultExchangeCurrencyIso == $ currencyToIso && isset ( $ currencyExchangeRates [ $ currencyFromIso ] ) ) { $ exchangeRate = 1 / $ currencyExchangeRates [ $ currencyFromIso ] [ 'rate' ] ; } elseif ( isset ( $ currencyExchangeRates [ $ currencyFromIso ] ) && isset ( $ currencyExchangeRates [ $ currencyToIso ] ) ) { $ exchangeRate = 1 / $ currencyExchangeRates [ $ currencyFromIso ] [ 'rate' ] * $ currencyExchangeRates [ $ currencyToIso ] [ 'rate' ] ; } else { throw new CurrencyNotConvertibleException ( ) ; } return $ exchangeRate ; }
Calculates the exchange rate between ISOs .
45,550
public function getInterface ( $ implementation ) { return isset ( $ this -> interfaces [ $ implementation ] ) ? $ this -> interfaces [ $ implementation ] : false ; }
Get interface given implementation .
45,551
public function validateStackableCoupon ( CartInterface $ cart , CouponInterface $ coupon ) { $ cartCoupons = $ this -> cartCouponRepository -> findBy ( [ 'cart' => $ cart , ] ) ; if ( 0 == count ( $ cartCoupons ) ) { return ; } $ appliedCouponsCanBeStacked = array_reduce ( $ cartCoupons , function ( $ previousCouponsAreStackable , CartCouponInterface $ cartCoupon ) { return $ previousCouponsAreStackable && $ cartCoupon -> getCoupon ( ) -> getStackable ( ) ; } , true ) ; if ( $ coupon -> getStackable ( ) && $ appliedCouponsCanBeStacked ) { return ; } throw new CouponNotStackableException ( ) ; }
Check if this coupon can be applied when other coupons had previously been applied .
45,552
public function getActiveZones ( ) { $ zones = $ this -> createQueryBuilder ( 'z' ) -> where ( 'z.enabled = :enabled' ) -> setParameters ( [ 'enabled' => true , ] ) -> getQuery ( ) -> getArrayResult ( ) ; return new ArrayCollection ( $ zones ) ; }
Find active zones .
45,553
public function dispatchOrderPreCreatedEvent ( CartInterface $ cart ) { $ orderPreCreatedEvent = new OrderPreCreatedEvent ( $ cart ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: ORDER_PRECREATED , $ orderPreCreatedEvent ) ; }
Event dispatched just before a Cart is converted to an Order .
45,554
public function dispatchOrderOnCreatedEvent ( CartInterface $ cart , OrderInterface $ order ) { $ orderPreCreatedEvent = new OrderOnCreatedEvent ( $ cart , $ order ) ; $ this -> eventDispatcher -> dispatch ( ElcodiCartEvents :: ORDER_ONCREATED , $ orderPreCreatedEvent ) ; return $ this ; }
Event dispatched when a Cart is being converted to an Order .
45,555
public function getCountryInfo ( ) { $ hierarchy = $ this -> getAddressHierarchy ( $ this -> address ) ; foreach ( $ hierarchy as $ location ) { if ( 'country' == $ location -> getType ( ) ) { return $ location ; } } return null ; }
Gets the country info .
45,556
public function getContext ( ) { $ context = [ ] ; foreach ( $ this -> contextProviders as $ contextProvider ) { $ context [ ] = $ contextProvider -> getContext ( ) ; } return empty ( $ context ) ? $ context : call_user_func_array ( 'array_merge' , $ context ) ; }
Get provided context .
45,557
public function dispatchOnUserRegisteredEvent ( AbstractUserInterface $ user ) { $ event = new UserRegisterEvent ( $ user ) ; $ this -> eventDispatcher -> dispatch ( ElcodiUserEvents :: ABSTRACTUSER_REGISTER , $ event ) ; return $ this ; }
Dispatch user created event .
45,558
public function dispatchOnCustomerRegisteredEvent ( CustomerInterface $ customer ) { $ event = new CustomerRegisterEvent ( $ customer ) ; $ this -> eventDispatcher -> dispatch ( ElcodiUserEvents :: CUSTOMER_REGISTER , $ event ) ; return $ this ; }
Dispatch customer created event .
45,559
public function dispatchOnAdminUserRegisteredEvent ( AdminUserInterface $ adminUser ) { $ event = new AdminUserRegisterEvent ( $ adminUser ) ; $ this -> eventDispatcher -> dispatch ( ElcodiUserEvents :: ADMINUSER_REGISTER , $ event ) ; return $ this ; }
Dispatch admin user created event .
45,560
public function findByOptionIds ( ProductInterface $ product , array $ optionsSearchedIds = [ ] ) { sort ( $ optionsSearchedIds ) ; foreach ( $ product -> getVariants ( ) as $ variant ) { $ optionsConfiguredIds = array_map ( function ( ValueInterface $ option ) { return $ option -> getId ( ) ; } , $ variant -> getOptions ( ) -> toArray ( ) ) ; sort ( $ optionsConfiguredIds ) ; if ( $ optionsSearchedIds == $ optionsConfiguredIds ) { return $ variant ; } } return null ; }
Given a Product and an array of integer representing the IDs of a Value Entity returns the Variant that is associated with the options matching the IDs if any .
45,561
public function getZonesFromAddress ( AddressInterface $ address ) { return $ this -> zoneRepository -> getActiveZones ( ) -> filter ( function ( ZoneInterface $ zone ) use ( $ address ) { return $ this -> zoneMatcher -> isAddressContainedInZone ( $ address , $ zone ) ; } ) ; }
Get all zones where the address is included in .
45,562
public function createResponseFromPage ( PageInterface $ page = null , $ path = '' ) { if ( ! ( $ page instanceof PageInterface ) || $ page -> getType ( ) !== ElcodiPageTypes :: TYPE_REGULAR ) { throw new NotFoundHttpException ( 'Page not found' ) ; } $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! ( $ request instanceof Request ) ) { throw new RuntimeException ( 'Request object not found' ) ; } if ( $ page -> getPath ( ) && $ path !== $ page -> getPath ( ) ) { return new RedirectResponse ( $ this -> urlGenerator -> generate ( $ this -> pageRenderRoute , [ 'id' => $ page -> getId ( ) , 'path' => $ page -> getPath ( ) , ] ) , 301 ) ; } $ response = $ this -> createResponseInstance ( $ page ) ; if ( ! $ response -> isNotModified ( $ request ) ) { $ response -> setContent ( $ this -> renderPage ( $ page ) ) ; $ response -> headers -> set ( 'Content-Type' , 'text/html' ) ; } return $ response ; }
Render a page given the found instance .
45,563
private function createResponseInstance ( PageInterface $ page ) { $ response = new Response ( ) ; $ response -> setLastModified ( $ page -> getUpdatedAt ( ) ) -> setPublic ( ) ; return $ response ; }
Creates response instance .
45,564
private function renderPage ( PageInterface $ page ) { if ( $ this -> pageRenderer && $ this -> pageRenderer -> supports ( $ page ) ) { return $ this -> pageRenderer -> render ( $ page ) ; } return $ page -> getContent ( ) ; }
Renders page content .
45,565
public function updateLastLogin ( InteractiveLoginEvent $ event ) { $ user = $ event -> getAuthenticationToken ( ) -> getUser ( ) ; if ( $ user instanceof LastLoginInterface ) { $ now = $ this -> dateTimeFactory -> create ( ) ; $ user -> setLastLoginAt ( $ now ) ; $ this -> objectManagerProvider -> getManagerByEntityNamespace ( get_class ( $ user ) ) -> flush ( $ user ) ; } return $ this ; }
Update last login date .
45,566
public function getPluginConfiguration ( $ pluginPath ) { $ yaml = new Parser ( ) ; $ specificationFilePath = $ pluginPath . '/plugin.yml' ; if ( ! file_exists ( $ specificationFilePath ) ) { return [ ] ; } $ parsedConfiguration = $ yaml -> parse ( file_get_contents ( $ specificationFilePath ) ) ; if ( ! is_array ( $ parsedConfiguration ) ) { return [ ] ; } $ processor = new Processor ( ) ; $ pluginConfiguration = $ processor -> processConfiguration ( new PluginConfigurationTree ( ) , $ parsedConfiguration ) ; return $ pluginConfiguration ; }
Given a Bundle path return a new PluginConfiguration instance .
45,567
public function listCommentsAction ( $ context , $ source ) { $ comments = $ this -> commentCache -> load ( $ source , $ context ) ; return new Response ( json_encode ( $ comments ) ) ; }
List comments .
45,568
private function findComment ( $ commentId , $ authorToken ) { $ comment = $ this -> commentRepository -> findOneBy ( [ 'id' => $ commentId , 'authorToken' => $ authorToken , ] ) ; if ( ! ( $ comment instanceof CommentInterface ) ) { throw new EntityNotFoundException ( 'Comment not found' ) ; } return $ comment ; }
Find comment .
45,569
public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ language = new $ classNamespace ( ) ; $ language -> setEnabled ( false ) ; return $ language ; }
Creates an instance of a simple language .
45,570
public function setAmount ( MoneyInterface $ amount ) { $ this -> amount = $ amount -> getAmount ( ) ; $ this -> amountCurrency = $ amount -> getCurrency ( ) ; return $ this ; }
Set amount .
45,571
public function printConvertMoney ( MoneyInterface $ money = null , CurrencyInterface $ targetCurrency = null ) { if ( ! ( $ money instanceof MoneyInterface ) ) { return '' ; } if ( ! ( $ targetCurrency instanceof CurrencyInterface ) ) { $ targetCurrency = $ this -> currencyWrapper -> get ( ) ; } $ moneyConverted = $ this -> currencyConverter -> convertMoney ( $ money , $ targetCurrency ) ; return $ this -> printMoney ( $ moneyConverted ) ; }
Return a formatted price given an Money object and the target currency .
45,572
public function printMoney ( MoneyInterface $ money = null ) { if ( ! ( $ money instanceof MoneyInterface ) ) { return '' ; } if ( ! ( $ money -> getCurrency ( ) instanceof CurrencyInterface ) ) { return $ money -> getAmount ( ) ; } $ moneyFormatter = new NumberFormatter ( $ this -> locale -> getIso ( ) , NumberFormatter :: CURRENCY ) ; return $ moneyFormatter -> formatCurrency ( $ money -> getAmount ( ) / 100 , $ money -> getCurrency ( ) -> getIso ( ) ) ; }
Return a formatted price given an Money object .
45,573
public function printMoneyFromValue ( $ value ) { $ targetCurrency = $ this -> currencyWrapper -> get ( ) ; $ money = Money :: create ( $ value , $ targetCurrency ) ; return $ this -> printMoney ( $ money ) ; }
Return a formatted price given the price in an integer format .
45,574
public function getLanguagesWithMasterLanguagePromoted ( ) { $ languages = $ this -> languageManager -> getLanguages ( ) -> toArray ( ) ; $ masterLocale = $ this -> masterLocale -> getIso ( ) ; $ index = array_search ( $ masterLocale , $ languages ) ; if ( false !== $ index ) { $ mainLanguage = $ languages [ $ index ] ; unset ( $ languages [ $ index ] ) ; array_unshift ( $ languages , $ mainLanguage ) ; } return new ArrayCollection ( $ languages ) ; }
Return all languages with the master one promoted to the first position .
45,575
public function create ( ) { $ classNamespace = $ this -> getEntityNamespace ( ) ; $ stateLine = new $ classNamespace ( ) ; $ stateLine -> setCreatedAt ( $ this -> now ( ) ) ; return $ stateLine ; }
Creates an instance of StateLine entity .
45,576
public function initialize ( ) { setlocale ( LC_ALL , $ this -> locale -> getIso ( ) . '.' . $ this -> encoding ) ; $ this -> localeInfo = localeconv ( ) ; return $ this ; }
Initialize locale .
45,577
public function getCountryCode ( ) { $ localeIso = $ this -> locale -> getIso ( ) ; if ( isset ( $ this -> localeCountryAssociations [ $ localeIso ] ) ) { return Locale :: create ( $ this -> localeCountryAssociations [ $ localeIso ] ) ; } $ regionLocale = \ Locale :: getRegion ( $ localeIso ) ; return $ regionLocale ? Locale :: create ( $ regionLocale ) : $ this -> locale ; }
Returns the ISO code of the country according to locale .
45,578
public function addComment ( $ source , $ context , $ content , $ authorToken , $ authorName , $ authorEmail , CommentInterface $ parent = null ) { $ comment = $ this -> commentDirector -> create ( ) -> setId ( round ( microtime ( true ) * 1000 ) ) -> setParent ( $ parent ) -> setSource ( $ source ) -> setAuthorToken ( $ authorToken ) -> setAuthorName ( $ authorName ) -> setAuthorEmail ( $ authorEmail ) -> setContent ( $ content ) -> setContext ( $ context ) ; $ this -> commentDirector -> save ( $ comment ) ; $ this -> commentEventDispatcher -> dispatchCommentOnAddEvent ( $ comment ) ; return $ comment ; }
Add comment into source .
45,579
public function removeComment ( CommentInterface $ comment ) { $ this -> commentEventDispatcher -> dispatchCommentPreRemoveEvent ( $ comment ) ; $ this -> commentDirector -> save ( $ comment ) ; $ this -> commentEventDispatcher -> dispatchCommentOnRemoveEvent ( $ comment ) ; return $ this ; }
Remove a comment .
45,580
public function create ( $ token , $ event , $ uniqueId , $ type , DateTime $ createdAt ) { return new Entry ( $ token , $ event , $ uniqueId , $ type , $ createdAt ) ; }
Create entry .
45,581
public function loadCartPurchasablesAmount ( CartInterface $ cart ) { $ currency = $ this -> currencyWrapper -> get ( ) ; $ purchasableAmount = Money :: create ( 0 , $ currency ) ; foreach ( $ cart -> getCartLines ( ) as $ cartLine ) { $ cartLine = $ this -> loadCartLinePrices ( $ cartLine ) ; $ convertedPurchasableAmount = $ this -> currencyConverter -> convertMoney ( $ cartLine -> getPurchasableAmount ( ) , $ currency ) ; $ purchasableAmount = $ purchasableAmount -> add ( $ convertedPurchasableAmount -> multiply ( $ cartLine -> getQuantity ( ) ) ) ; } $ cart -> setPurchasableAmount ( $ purchasableAmount ) ; }
Load cart purchasables prices .
45,582
public function loadCartTotalAmount ( CartInterface $ cart ) { $ currency = $ this -> currencyWrapper -> get ( ) ; $ finalAmount = clone $ cart -> getPurchasableAmount ( ) ; $ shippingAmount = $ cart -> getShippingAmount ( ) ; if ( $ shippingAmount instanceof MoneyInterface ) { $ convertedShippingAmount = $ this -> currencyConverter -> convertMoney ( $ shippingAmount , $ currency ) ; $ finalAmount = $ finalAmount -> add ( $ convertedShippingAmount ) ; } $ couponAmount = $ cart -> getCouponAmount ( ) ; if ( $ couponAmount instanceof MoneyInterface ) { $ convertedCouponAmount = $ this -> currencyConverter -> convertMoney ( $ couponAmount , $ currency ) ; $ finalAmount = $ finalAmount -> subtract ( $ convertedCouponAmount ) ; } $ cart -> setAmount ( $ finalAmount ) ; }
Load cart total price .
45,583
private function loadCartLinePrices ( CartLineInterface $ cartLine ) { $ purchasable = $ cartLine -> getPurchasable ( ) ; $ purchasablePrice = $ purchasable -> getPrice ( ) ; if ( $ purchasable -> getReducedPrice ( ) -> getAmount ( ) > 0 ) { $ purchasablePrice = $ purchasable -> getReducedPrice ( ) ; } $ cartLine -> setPurchasableAmount ( $ purchasablePrice ) ; $ cartLine -> setAmount ( $ purchasablePrice -> multiply ( $ cartLine -> getQuantity ( ) ) ) ; return $ cartLine ; }
Loads CartLine prices . This method does not consider Coupon .
45,584
public function dispatchInitializationEvents ( MachineInterface $ machine , $ object , StateLineStack $ stateLineStack ) { $ this -> eventDispatcher -> dispatch ( str_replace ( '{machine_id}' , $ machine -> getId ( ) , ElcodiStateTransitionMachineEvents :: INITIALIZATION ) , InitializationEvent :: create ( $ object , $ stateLineStack ) ) ; }
Throw initialization events .
45,585
public function dispatchTransitionEvents ( MachineInterface $ machine , $ object , StateLineStack $ stateLineStack , Transition $ transition ) { $ this -> eventDispatcher -> dispatch ( ElcodiStateTransitionMachineEvents :: ALL_TRANSITIONS , TransitionEvent :: create ( $ object , $ stateLineStack , $ transition ) ) ; $ this -> eventDispatcher -> dispatch ( str_replace ( [ '{machine_id}' , '{state_name}' , ] , [ $ machine -> getId ( ) , $ transition -> getStart ( ) -> getName ( ) , ] , ElcodiStateTransitionMachineEvents :: TRANSITION_FROM_STATE ) , TransitionEvent :: create ( $ object , $ stateLineStack , $ transition ) ) ; $ this -> eventDispatcher -> dispatch ( str_replace ( [ '{machine_id}' , '{state_name}' , ] , [ $ machine -> getId ( ) , $ transition -> getFinal ( ) -> getName ( ) , ] , ElcodiStateTransitionMachineEvents :: TRANSITION_TO_STATE ) , TransitionEvent :: create ( $ object , $ stateLineStack , $ transition ) ) ; $ this -> eventDispatcher -> dispatch ( str_replace ( [ '{machine_id}' , '{transition_name}' , ] , [ $ machine -> getId ( ) , $ transition -> getName ( ) , ] , ElcodiStateTransitionMachineEvents :: TRANSITION ) , TransitionEvent :: create ( $ object , $ stateLineStack , $ transition ) ) ; }
Throw transition events .
45,586
public function evaluateRequired ( $ required , $ locale ) { return ( boolean ) $ required ? ! $ this -> fallback || ( $ this -> masterLocale === $ locale ) : false ; }
Check the require value .
45,587
public function resolveDimensions ( $ newWidth , $ newHeight , $ type ) { $ this -> dstX = 0 ; $ this -> dstY = 0 ; $ this -> dstWidth = $ newWidth ; $ this -> dstHeight = $ newHeight ; $ this -> dstFrameX = $ newWidth ; $ this -> dstFrameY = $ newHeight ; $ this -> srcX = 0 ; $ this -> srcY = 0 ; $ this -> srcWidth = $ this -> originalWidth ; $ this -> srcHeight = $ this -> originalHeight ; if ( $ type == ElcodiMediaImageResizeTypes :: NO_RESIZE ) { $ this -> dstWidth = $ this -> originalWidth ; $ this -> dstHeight = $ this -> originalHeight ; $ this -> dstFrameX = $ this -> originalWidth ; $ this -> dstFrameY = $ this -> originalHeight ; } elseif ( in_array ( $ type , [ ElcodiMediaImageResizeTypes :: INSET , ElcodiMediaImageResizeTypes :: INSET_FILL_WHITE , ElcodiMediaImageResizeTypes :: OUTBOUNDS_FILL_WHITE , ElcodiMediaImageResizeTypes :: OUTBOUND_CROP , ] ) ) { $ newAspectRatio = $ newWidth / $ newHeight ; if ( $ newAspectRatio == $ this -> originalAspectRatio ) { $ height = $ newHeight ; $ width = $ newWidth ; } elseif ( ( $ newAspectRatio > $ this -> originalAspectRatio ) ^ ( in_array ( $ type , [ ElcodiMediaImageResizeTypes :: OUTBOUNDS_FILL_WHITE , ElcodiMediaImageResizeTypes :: OUTBOUND_CROP , ] ) ) ) { $ height = $ newHeight ; $ width = $ newHeight * $ this -> originalAspectRatio ; } else { $ width = $ newWidth ; $ height = $ newWidth / $ this -> originalAspectRatio ; } $ changeRatio = $ height / $ this -> originalHeight ; if ( $ type == ElcodiMediaImageResizeTypes :: OUTBOUND_CROP ) { $ this -> srcX = ( ( $ width - $ newWidth ) / 2 ) / $ changeRatio ; $ this -> srcY = ( ( $ height - $ newHeight ) / 2 ) / $ changeRatio ; $ this -> srcWidth = $ newWidth / $ changeRatio ; $ this -> srcHeight = $ newHeight / $ changeRatio ; } if ( $ type == ElcodiMediaImageResizeTypes :: INSET_FILL_WHITE ) { $ this -> dstX = ( $ newWidth - $ width ) / 2 ; $ this -> dstY = ( $ newHeight - $ height ) / 2 ; } if ( in_array ( $ type , [ ElcodiMediaImageResizeTypes :: INSET , ElcodiMediaImageResizeTypes :: INSET_FILL_WHITE , ElcodiMediaImageResizeTypes :: OUTBOUNDS_FILL_WHITE , ] ) ) { $ this -> dstWidth = $ width ; $ this -> dstHeight = $ height ; } if ( in_array ( $ type , [ ElcodiMediaImageResizeTypes :: INSET , ElcodiMediaImageResizeTypes :: OUTBOUNDS_FILL_WHITE , ] ) ) { $ this -> dstFrameX = $ width ; $ this -> dstFrameY = $ height ; } } return $ this ; }
Resolve dimensions .
45,588
public function tryAutomaticCoupons ( CartInterface $ cart ) { if ( $ cart -> getCartLines ( ) -> isEmpty ( ) ) { return ; } $ automaticCoupons = $ this -> getNonAppliedAutomaticCoupons ( $ cart ) ; foreach ( $ automaticCoupons as $ coupon ) { try { $ this -> cartCouponManager -> addCoupon ( $ cart , $ coupon ) ; } catch ( AbstractCouponException $ e ) { } } }
Method subscribed to PreCartLoad event .
45,589
private function getNonAppliedAutomaticCoupons ( CartInterface $ cart ) { $ automaticCoupons = $ this -> couponRepository -> findBy ( [ 'enforcement' => ElcodiCouponTypes :: ENFORCEMENT_AUTOMATIC , ] ) ; $ loadedAutomaticCoupons = $ this -> cartCouponManager -> getCoupons ( $ cart ) ; return array_udiff ( $ automaticCoupons , $ loadedAutomaticCoupons , function ( CouponInterface $ a , CouponInterface $ b ) { return $ a -> getId ( ) != $ b -> getId ( ) ; } ) ; }
Get current cart automatic coupons .
45,590
public function getRelatedPurchasablesFromArray ( array $ purchasables , $ limit ) { $ categories = [ ] ; foreach ( $ purchasables as $ purchasable ) { $ category = $ purchasable -> getPrincipalCategory ( ) ; if ( $ category instanceof CategoryInterface && ! in_array ( $ category , $ categories ) ) { $ categories [ ] = $ category ; } } if ( empty ( $ categories ) ) { return [ ] ; } return $ this -> purchasableRepository -> createQueryBuilder ( 'p' ) -> where ( 'p.principalCategory IN(:categories)' ) -> andWhere ( 'p NOT IN(:purchasables)' ) -> andWhere ( 'p.enabled = :enabled' ) -> setParameters ( [ 'categories' => $ categories , 'purchasables' => $ purchasables , 'enabled' => true , ] ) -> setMaxResults ( $ limit ) -> getQuery ( ) -> getResult ( ) ; }
Given a Collection of Purchasables return a collection of related purchasables .
45,591
protected function getCountriesFromInput ( InputInterface $ input ) { $ countries = $ input -> getOption ( 'country' ) ; if ( ! is_array ( $ countries ) || empty ( $ countries ) ) { throw new InvalidArgumentException ( 'You need to specify minimum a Country. eg: --country=FR' ) ; } return $ countries ; }
Get a country list from an input object or throw an Exception if none is properly defined .
45,592
protected function deleteCountry ( InputInterface $ input , OutputInterface $ output , $ countryCode ) { $ noInteraction = $ input -> getOption ( 'no-interaction' ) ; $ country = $ this -> locationDirector -> findOneBy ( [ 'code' => $ countryCode , ] ) ; if ( $ country instanceof LocationInterface ) { if ( ! $ noInteraction && ! $ this -> confirmRemoval ( $ input , $ output , $ countryCode , $ output ) ) { return $ this ; } $ this -> dropCountry ( $ country , $ output ) ; } else { $ this -> printMessage ( $ output , 'Geo' , 'Country ' . $ countryCode . ' not found in your database' ) ; } return $ this ; }
Ensure deletion of a country .
45,593
private function confirmRemoval ( InputInterface $ input , OutputInterface $ output , $ countryCode ) { $ questionHelper = $ this -> getHelper ( 'question' ) ; $ message = "<question>Country with code '$countryCode' will be dropped. Continue?</question>" ; return $ questionHelper -> ask ( $ input , $ output , new ConfirmationQuestion ( $ message , false ) ) ; }
Asks to confirm the location removal .
45,594
private function dropCountry ( LocationInterface $ location , OutputInterface $ output ) { $ countryCode = $ location -> getCode ( ) ; $ this -> startStopWatch ( 'drop_location' ) ; $ this -> locationDirector -> remove ( $ location ) ; $ stopWatchEvent = $ this -> stopStopWatch ( 'drop_location' ) ; $ this -> printMessage ( $ output , 'Geo' , 'Country ' . $ countryCode . ' dropped in ' . $ stopWatchEvent -> getDuration ( ) . ' milliseconds' ) ; return $ this ; }
Drops the country and its relations .
45,595
public function setFieldValue ( $ fieldName , $ fieldValue ) { if ( ! $ this -> hasField ( $ fieldName ) ) { throw new RuntimeException ( 'Field "' . $ fieldName . '" not found in Plugin Configuration' ) ; } $ this -> configuration [ 'fields' ] [ $ fieldName ] [ 'data' ] = $ fieldValue ; return $ this ; }
Get field element .
45,596
public function merge ( PluginConfiguration $ newPluginConfiguration ) { $ newPluginConfiguration = clone $ newPluginConfiguration ; $ fields = $ newPluginConfiguration -> getFields ( ) ; foreach ( $ fields as $ fieldName => $ field ) { if ( $ this -> hasField ( $ fieldName ) ) { $ newPluginConfiguration -> setFieldValue ( $ fieldName , $ this -> getFieldValue ( $ fieldName ) ) ; } } $ this -> setConfiguration ( $ newPluginConfiguration -> getConfiguration ( ) ) ; return $ this ; }
Merge this configuration instance with a new one and saves the result in this instance .
45,597
public function setPrincipalImage ( \ Elcodi \ Component \ Media \ Entity \ Interfaces \ ImageInterface $ principalImage = null ) { $ this -> principalImage = $ principalImage ; return $ this ; }
Set the principalImage .
45,598
public function getEntriesFromLastDays ( $ days ) { $ from = new DateTime ( ) ; $ from -> modify ( '-' . $ days . ' days' ) ; return $ this -> createQueryBuilder ( 'e' ) -> where ( 'e.createdAt >= :from' ) -> setParameters ( [ 'from' => $ from , ] ) -> getQuery ( ) -> getResult ( ) ; }
Load entries from last X days .
45,599
public function preUpdate ( PreUpdateEventArgs $ eventArgs ) { $ entity = $ eventArgs -> getEntity ( ) ; if ( $ entity instanceof CategoryInterface ) { $ this -> removeParentCategoryForRootCategory ( $ entity ) ; } return $ this ; }
Pre update event listener .