class ReviewManager implements ReviewManagerInterface, BasicEntityManagerInterface, JQGridInterface

Class ReviewManager is injected as alligator.review_manager service. ReviewManager handles the logic for managed entity.

Traits

Trait JQGridManagerTrait

Constants

EMAIL_TEMPLATE

Properties

protected ReviewRepository $repository
protected ReviewEventContainer $eventContainer

Methods

mixed
searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

No description

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

No description

mixed
getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

No description

__construct(ReviewRepository $repository, ReviewEventContainer $eventContainer)

ReviewManager constructor.

array
getReviewWithSelectById(int $reviewId)

Find id, review content and approved status for review that match provided id

saveReview(Review $review)

Persist new review, and send mail to all admins and review author

updateProductRatingsForReview(Review $review)

Update product rating and dispatch event to update rating on product

saveReviewFromCommand(Review $review)

Persist new review

sendMails()

Send mails to user and admins

bool
deleteReviews(array $array)

Remove reviews from provided array of reviews

editReview(Review $review)

Update existing review

getDBProduct(Product $product)

Find product for provided id

array
findReviewsByProductSlug(string $slug, int $page, bool $isCountSearch = false)

Find all reviews for product that match provided slug

mixed
searchReviewsForProductEditBackend(int $productId, int $page, int|null $userId = null, DateTime $dateFrom = null, DateTime $dateTo = null)

Find all reviews that match provided criteria

array
getReviewsForDashboard(int $number, bool $approved)

Find provided number of reviews

mixed
getSidebarReviewsHtml(string $theme)

Retrieve sidebar reviews from cache

mixed
generateSidebarReviewsHtml(string $theme)

Set sidebar reviews to cache

string
getSidebarReviewsHtmlFromCache()

Retrieve cached sidebar reviews

setSidebarHtmlToCache(String $sidebarReviewsHtml)

Set cached sidebar reviews

dispatchReviewEditEvent(String $theme)

Dispatch event to re-cache sidebar reviews

array
getTicketsForAdmin()

Find all tickets

array
getReviewTotalForProduct(Product $product)

Retrieve number of ratings and average average rating for provided product

bool
updateMultipleProductsRatings(float $newRating, array $brandsArray)

Update rating for product in provided brand

Details

in JQGridManagerTrait at line 26
mixed searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

array $searchParams
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

mixed

in JQGridManagerTrait at line 40
mixed findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

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

Return Value

mixed

in JQGridManagerTrait at line 53
mixed getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

Parameters

array|null $searchParams
array|null $sortParams
array|null $additionalParams
JQGridWrapper|null $jqGridWrapper

Return Value

mixed

at line 52
__construct(ReviewRepository $repository, ReviewEventContainer $eventContainer)

ReviewManager constructor.

Parameters

ReviewRepository $repository
ReviewEventContainer $eventContainer

at line 65
array getReviewWithSelectById(int $reviewId)

Find id, review content and approved status for review that match provided id

Parameters

int $reviewId

Return Value

array

at line 77
Review saveReview(Review $review)

Persist new review, and send mail to all admins and review author

Parameters

Review $review

Return Value

Review

at line 95
updateProductRatingsForReview(Review $review)

Update product rating and dispatch event to update rating on product

Parameters

Review $review

at line 134
Review saveReviewFromCommand(Review $review)

Persist new review

Parameters

Review $review

Return Value

Review

at line 142
sendMails()

Send mails to user and admins

at line 166
bool deleteReviews(array $array)

Remove reviews from provided array of reviews

Parameters

array $array int $array

Return Value

bool

Exceptions

Exception

at line 180
Review editReview(Review $review)

Update existing review

Parameters

Review $review

Return Value

Review

at line 199
Product getDBProduct(Product $product)

Find product for provided id

Parameters

Product $product

Return Value

Product

Exceptions

NoResultException
NonUniqueResultException

at line 213
array findReviewsByProductSlug(string $slug, int $page, bool $isCountSearch = false)

Find all reviews for product that match provided slug

Parameters

string $slug
int $page
bool $isCountSearch

Return Value

array

at line 229
mixed searchReviewsForProductEditBackend(int $productId, int $page, int|null $userId = null, DateTime $dateFrom = null, DateTime $dateTo = null)

Find all reviews that match provided criteria

Parameters

int $productId
int $page
int|null $userId
DateTime $dateFrom
DateTime $dateTo

Return Value

mixed

at line 242
array getReviewsForDashboard(int $number, bool $approved)

Find provided number of reviews

Parameters

int $number
bool $approved

Return Value

array

at line 265
mixed getSidebarReviewsHtml(string $theme)

Retrieve sidebar reviews from cache

Parameters

string $theme

Return Value

mixed

Exceptions

Error

at line 286
mixed generateSidebarReviewsHtml(string $theme)

Set sidebar reviews to cache

Parameters

string $theme

Return Value

mixed

Exceptions

Error

at line 314
string getSidebarReviewsHtmlFromCache()

Retrieve cached sidebar reviews

Return Value

string

at line 324
setSidebarHtmlToCache(String $sidebarReviewsHtml)

Set cached sidebar reviews

Parameters

String $sidebarReviewsHtml

at line 334
dispatchReviewEditEvent(String $theme)

Dispatch event to re-cache sidebar reviews

Parameters

String $theme

at line 344
array getTicketsForAdmin()

Find all tickets

Return Value

array

at line 358
array getReviewTotalForProduct(Product $product)

Retrieve number of ratings and average average rating for provided product

Parameters

Product $product

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 371
bool updateMultipleProductsRatings(float $newRating, array $brandsArray)

Update rating for product in provided brand

Parameters

float $newRating
array $brandsArray

Return Value

bool