class OrderRepository extends EntityRepository

Class OrderRepository is injected as alligator.order_repository service. OrderRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait
Class AvailabilityChangeRepositoryTrait

Constants

ALIAS

Alias for entity

USER_ALIAS

Alias for user entity

PRODUCT_ALIAS

Alias for product entity

COMPANY_ALIAS

Alias for company entity

ADDRESS_ALIAS

Alias for address entity

ORDER_ITEM_ALIAS

Alias for order item entity

SHIPPING_ALIAS

Alias for shipping entity

PRODUCT_ATTRIBUTE_VALUES_ALIAS

Alias for product attribute value entity

ATTRIBUTE_VALUE_ALIAS

Alias for attribute value entity

ATTRIBUTE_ALIAS

Alias for attribute entity

ADJUSTMENTS_ALIAS

Alias for adjustment entity

USERNAME_PARAM

JOIN_WITH_USER

JOIN_WITH_SHIPPING

JOIN_WITH_PRODUCT_ATTRIBUTE_VALUES

JOIN_WITH_ATTRIBUTE_VALUE

JOIN_WITH_ATTRIBUTE

JOIN_WITH_ADDRESS

JOIN_WITH_ORDER_ITEM

JOIN_USER_WITH_COMPANY

JOIN_USER_WITH_ADDRESS

JOIN_WITH_ADJUSTMENTS

DATE_PARAM_FROM

DATE_PARAM_TO

ABANDONED_CART

ORDER_STATE_PARAM

ORDER_PK_QUERY_PART

DATE_BETWEEN_WITH_STRING_PARAM

TABLE_NAME

JOIN_WITH_GROUP_PRODUCT

JOIN_WITH_GROUP_SIMPLE_PRODUCT_AGGREGATION

JOIN_WITH_SIMPLE_PRODUCT

USER_NOT_BOUGHT_QUERY_CACHE

Methods

jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

array
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

productLimitDataDQL(QueryBuilder $qb, array $limitData)

No description

string
productLimitDataSQL(string $productAlias, array $limitData, bool $addAnd = true)

No description

brandLimitDataDQL(QueryBuilder $qb, array $limitData, string $brandAlias = null)

No description

static Closure
retrieveWhereClosure()

No description

static Closure
__construct($em, ClassMetadata $class)

{@inheritdoc}

array
getBestSellerThatAreNotBoughtByUser(int|null $userId, int $numberOfProducts, array|null $limitData = null)

Find all products that user hasn't bought

Order|Proxy|null|object
getReference(int $id, string $class = Order::class)

Retrieve reference for provided class and id

saveOrder(Order $order)

Persist new order

editOrder(Order $order)

Update existing order

Order|object|null
findOrderByPK(Order $order)

Find order by id

Order|object|null
getDBOrder(Order $order)

Find order by id

Order|object|null
findOrderByIdNew(int $orderId)

Find order by id

Order|object|null
findOrderByTransId(int $transId)

Find order by transaction id

getDBOrderWithoutProxies(Order $order)

Find order with all relationships

mixed
findOrdersForReport(array $params)

Find order with all relationships by criteria(start and end date, user and state)

array
findOrdersWithoutAbandonedCart(mixed $user, mixed $forLiveSale = false, mixed $number = 0)

Find all orders without abandoned carts

array
findAbandonedCarts()

Find all orders that have state abandoned cart

array
getOrderIdErpCodes()

Find id and erp code of all orders

array
getAllOrderIds()

Find id of all orders

array
loadOrderStatisticsInLast14Days(string|null $currency = null)

Retrieve data for statistics

array|null
loadOrderDetailsGraphData(string $date)

Retrieve data for statistics

array
loadGraphDataForInterval(string $dateFrom, string $dateTo, string|null $currency = null)

Retrieve data for statistics

array
getOrdersForDashboard(int $number)

Find provided number of finished orders for dashboard

array
getOrdersForDashboardByCurrency(string|null $currency = null, int $number = 5, array|null $params = null)

Find all finished orders by currency for dashboard

boolean
deleteOrders(array $orders)

Remove provided order

array
getOrdersArray(array $array)

Find all orders that match provided ids

array
getAmountByTypeOfPayment(array|null $searchParams, int|null $userId = null)

Retrieve summary of payment depending on payment type

startTransaction()

start db transaction

commitTransaction()

commit db transaction

rollbackTransaction()

rollback db transaction

completeOrder(Order $order)

Complete order that match provided ids

setStatus(Order $order, String $status)

Update status of orders that match provided ids

array
getPendingOrders()

Find all orders in state pending or processing

getDBOrderForDetails(int $id)

Find order with relationships by id

mixed
getAbandonedCartsForPagination(int $userId, int $page, int $offset)

Retrieve orders in abandoned cart state with pagination

array
getOrdersForPagination(int $userId, int $page, int $offset, bool $hidePending = true)

JQGrid function

mixed
countAbandonedCartsByUserForPagination(int $userId)

JQGrid function

array
countOrdersByUserForPagination(int $userId, bool $hidePending = true)

JQGrid function

getOrderForSocket(int $id)

Find order by id

Order|Proxy|null|object
getOrderReference(int $orderId)

Retrieve reference for order

getOrderByToken(string $token)

Find order by token

Order|null
getLastOrderForUser(User $user)

Find last order for provided user

Order|null
getLastUnfinishedOrderForUser(User $user, mixed $sessionId = null)

Find last unfinished order for provided user

mixed
getCompleteOrder(int $id)

Find order by id

mixed
getNumberOfSalesOfProduct(int $productId)

Retrieve number of sales for provided product

bool
setOrderCurrency(Order $order)

Update currency and currency ratio for provided order

bool
setOrderLocale(Order $order)

Update locale for provided order

array
getOrderForGoogleAnalytics(int $orderId)

Get order with custom information - used to send data to Google Analytics

array
getOrdersSummary(int $id)

Retrieve summary for order

generateNewOrderFromBackend(array $additionalData)

Create and persist new order with provided currency and locale

Address|null
getAddressFromOrderDB(Order $order)

Find address for order

array
getAllGroupProductsForOrder(int $orderId)

Find all group products in order

bool
updateCouponCode(int $orderId, string $code)

Update coupon code for order

setToCache(string $key, mixed $object)

Set parameter to cache

deleteFromCache(string $key)

Delete parameter from cache

array
getAllOrdersIds()

Retrieve id of all orders

array
getAllUnfinishedBankOrdersBeforeDate(DateTime $currentDate)

Get all unfinished orders that are in state "payment_bank"

saveChanges()

Flushes all changes to objects that have been queued up to now to the database

array
getUnsyncedErpOrderIds()

Retrieve id of all orders that are synchronized with erp

array
getOrdersForIds(array $ids)

Find all orders that match provided ids

deleteQueryCache(string $key)

Delete parameter from cache

Details

in JQGridTrait at line 27
jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 42
jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 61
array findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

Parameters

int $page
int $offset
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

in JQGridTrait at line 94
array searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

Parameters

array $searchParams
array $sortParams
bool $isCountSearch
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

productLimitDataDQL(QueryBuilder $qb, array $limitData)

Parameters

QueryBuilder $qb
array $limitData

string productLimitDataSQL(string $productAlias, array $limitData, bool $addAnd = true)

Parameters

string $productAlias
array $limitData
bool $addAnd

Return Value

string

brandLimitDataDQL(QueryBuilder $qb, array $limitData, string $brandAlias = null)

Parameters

QueryBuilder $qb
array $limitData
string $brandAlias

at line 131
static Closure retrieveWhereClosure()

Return Value

Closure

at line 152
static Closure retrieveDoCustomSearchOptions()

Return Value

Closure

at line 177
__construct($em, ClassMetadata $class)

{@inheritdoc}

Parameters

$em
ClassMetadata $class

at line 204
array getBestSellerThatAreNotBoughtByUser(int|null $userId, int $numberOfProducts, array|null $limitData = null)

Find all products that user hasn't bought

Parameters

int|null $userId
int $numberOfProducts
array|null $limitData

Return Value

array

Exceptions

NonUniqueResultException

at line 272
Order|Proxy|null|object getReference(int $id, string $class = Order::class)

Retrieve reference for provided class and id

Parameters

int $id
string $class

Return Value

Order|Proxy|null|object

at line 284
Order saveOrder(Order $order)

Persist new order

Parameters

Order $order

Return Value

Order

at line 303
Order editOrder(Order $order)

Update existing order

Parameters

Order $order

Return Value

Order

at line 322
Order|object|null findOrderByPK(Order $order)

Find order by id

Parameters

Order $order

Return Value

Order|object|null

at line 334
Order|object|null getDBOrder(Order $order)

Find order by id

Parameters

Order $order

Return Value

Order|object|null

at line 346
Order|object|null findOrderByIdNew(int $orderId)

Find order by id

Parameters

int $orderId

Return Value

Order|object|null

at line 358
Order|object|null findOrderByTransId(int $transId)

Find order by transaction id

Parameters

int $transId

Return Value

Order|object|null

at line 376
Order getDBOrderWithoutProxies(Order $order)

Find order with all relationships

Parameters

Order $order

Return Value

Order

Exceptions

NonUniqueResultException

at line 412
mixed findOrdersForReport(array $params)

Find order with all relationships by criteria(start and end date, user and state)

Parameters

array $params

Return Value

mixed

at line 473
array findOrdersWithoutAbandonedCart(mixed $user, mixed $forLiveSale = false, mixed $number = 0)

Find all orders without abandoned carts

Parameters

mixed $user
mixed $forLiveSale
mixed $number

Return Value

array

at line 497
array findAbandonedCarts()

Find all orders that have state abandoned cart

Return Value

array

at line 509
array getOrderIdErpCodes()

Find id and erp code of all orders

Return Value

array

at line 524
array getAllOrderIds()

Find id of all orders

Return Value

array

at line 543
array loadOrderStatisticsInLast14Days(string|null $currency = null)

Retrieve data for statistics

Parameters

string|null $currency

Return Value

array

at line 579
array|null loadOrderDetailsGraphData(string $date)

Retrieve data for statistics

Parameters

string $date

Return Value

array|null

at line 635
array loadGraphDataForInterval(string $dateFrom, string $dateTo, string|null $currency = null)

Retrieve data for statistics

Parameters

string $dateFrom
string $dateTo
string|null $currency

Return Value

array

at line 674
array getOrdersForDashboard(int $number)

Find provided number of finished orders for dashboard

Parameters

int $number Number of orders to retrieve

Return Value

array

at line 706
array getOrdersForDashboardByCurrency(string|null $currency = null, int $number = 5, array|null $params = null)

Find all finished orders by currency for dashboard

Parameters

string|null $currency
int $number
array|null $params

Return Value

array

at line 749
boolean deleteOrders(array $orders)

Remove provided order

Parameters

array $orders

Return Value

boolean

at line 771
array getOrdersArray(array $array)

Find all orders that match provided ids

Parameters

array $array

Return Value

array

at line 790
array getAmountByTypeOfPayment(array|null $searchParams, int|null $userId = null)

Retrieve summary of payment depending on payment type

Parameters

array|null $searchParams
int|null $userId

Return Value

array

at line 920
startTransaction()

start db transaction

at line 928
commitTransaction()

commit db transaction

at line 936
rollbackTransaction()

rollback db transaction

at line 948
completeOrder(Order $order)

Complete order that match provided ids

Parameters

Order $order

Exceptions

DBALException

at line 964
setStatus(Order $order, String $status)

Update status of orders that match provided ids

Parameters

Order $order
String $status

Exceptions

DBALException

at line 977
array getPendingOrders()

Find all orders in state pending or processing

Return Value

array

at line 997
Order getDBOrderForDetails(int $id)

Find order with relationships by id

Parameters

int $id

Return Value

Order

Exceptions

NoResultException
NonUniqueResultException

at line 1033
mixed getAbandonedCartsForPagination(int $userId, int $page, int $offset)

Retrieve orders in abandoned cart state with pagination

Parameters

int $userId
int $page
int $offset

Return Value

mixed

at line 1064
array getOrdersForPagination(int $userId, int $page, int $offset, bool $hidePending = true)

JQGrid function

Parameters

int $userId
int $page
int $offset
bool $hidePending

Return Value

array

at line 1106
mixed countAbandonedCartsByUserForPagination(int $userId)

JQGrid function

Parameters

int $userId

Return Value

mixed

Exceptions

NonUniqueResultException

at line 1126
array countOrdersByUserForPagination(int $userId, bool $hidePending = true)

JQGrid function

Parameters

int $userId
bool $hidePending

Return Value

array

at line 1153
Order getOrderForSocket(int $id)

Find order by id

Parameters

int $id

Return Value

Order

Exceptions

NoResultException
NonUniqueResultException

at line 1174
Order|Proxy|null|object getOrderReference(int $orderId)

Retrieve reference for order

Parameters

int $orderId

Return Value

Order|Proxy|null|object

Exceptions

ORMException

at line 1186
Order getOrderByToken(string $token)

Find order by token

Parameters

string $token

Return Value

Order

at line 1210
Order|null getLastOrderForUser(User $user)

Find last order for provided user

Parameters

User $user

Return Value

Order|null

Exceptions

NonUniqueResultException

at line 1231
Order|null getLastUnfinishedOrderForUser(User $user, mixed $sessionId = null)

Find last unfinished order for provided user

Parameters

User $user
mixed $sessionId

Return Value

Order|null

Exceptions

NonUniqueResultException

at line 1258
mixed getCompleteOrder(int $id)

Find order by id

Parameters

int $id

Return Value

mixed

Exceptions

NonUniqueResultException

at line 1287
mixed getNumberOfSalesOfProduct(int $productId)

Retrieve number of sales for provided product

Parameters

int $productId

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

at line 1306
bool setOrderCurrency(Order $order)

Update currency and currency ratio for provided order

Parameters

Order $order

Return Value

bool

at line 1327
bool setOrderLocale(Order $order)

Update locale for provided order

Parameters

Order $order

Return Value

bool

at line 1348
array getOrderForGoogleAnalytics(int $orderId)

Get order with custom information - used to send data to Google Analytics

Parameters

int $orderId

Return Value

array

at line 1395
array getOrdersSummary(int $id)

Retrieve summary for order

Parameters

int $id

Return Value

array

at line 1419
Order generateNewOrderFromBackend(array $additionalData)

Create and persist new order with provided currency and locale

Parameters

array $additionalData

Return Value

Order

Exceptions

ORMException
OptimisticLockException

at line 1442
Address|null getAddressFromOrderDB(Order $order)

Find address for order

Parameters

Order $order

Return Value

Address|null

Exceptions

NonUniqueResultException

at line 1462
array getAllGroupProductsForOrder(int $orderId)

Find all group products in order

Parameters

int $orderId

Return Value

array

at line 1510
bool updateCouponCode(int $orderId, string $code)

Update coupon code for order

Parameters

int $orderId
string $code

Return Value

bool

at line 1528
setToCache(string $key, mixed $object)

Set parameter to cache

Parameters

string $key
mixed $object

at line 1538
deleteFromCache(string $key)

Delete parameter from cache

Parameters

string $key

at line 1548
array getAllOrdersIds()

Retrieve id of all orders

Return Value

array

at line 1563
array getAllUnfinishedBankOrdersBeforeDate(DateTime $currentDate)

Get all unfinished orders that are in state "payment_bank"

Parameters

DateTime $currentDate

Return Value

array

at line 1578
saveChanges()

Flushes all changes to objects that have been queued up to now to the database

at line 1588
array getUnsyncedErpOrderIds()

Retrieve id of all orders that are synchronized with erp

Return Value

array

at line 1606
array getOrdersForIds(array $ids)

Find all orders that match provided ids

Parameters

array $ids

Return Value

array

at line 1623
deleteQueryCache(string $key)

Delete parameter from cache

Parameters

string $key