Charly пре 3 година
родитељ
комит
0b4012f138
3 измењених фајлова са 50 додато и 5 уклоњено
  1. +12
    -5
      Repository/Reminder/ReminderStore.php
  2. +6
    -0
      Repository/Site/NewsRepositoryQuery.php
  3. +32
    -0
      Repository/Site/NewsStore.php

+ 12
- 5
Repository/Reminder/ReminderStore.php Прегледај датотеку

@@ -46,8 +46,12 @@ class ReminderStore extends AbstractStore implements ReminderStoreInterface
}

// findByUser
public function getByUser(UserInterface $user): array
public function getByUser(UserInterface $user, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}

$query = $this->query->create();

$query
@@ -61,12 +65,15 @@ class ReminderStore extends AbstractStore implements ReminderStoreInterface

// findByEasyAdminConfigAndUser
public function getByEasyAdminConfigAndUser(
$crudAction,
$crudControllerFqcn,
string $crudAction,
string $crudControllerFqcn,
UserInterface $user,
$entityId = null
int $entityId = null,
$query = null
): array {
$query = $this->query->create();
if (is_null($query)) {
$query = $this->query->create();
}

$query
->filterByUser($user)

+ 6
- 0
Repository/Site/NewsRepositoryQuery.php Прегледај датотеку

@@ -3,10 +3,16 @@
namespace Lc\SovBundle\Repository\Site;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\StatusRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class NewsRepositoryQuery extends AbstractRepositoryQuery implements NewsRepositoryQueryInterface
{
use StatusRepositoryQueryTrait;
use MerchantRepositoryQueryTrait;

public function __construct(NewsRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);

+ 32
- 0
Repository/Site/NewsStore.php Прегледај датотеку

@@ -12,4 +12,36 @@ class NewsStore extends AbstractStore implements NewsStoreInterface
{
$this->query = $query;
}

//findLatests
public function getLatests(int $maxResults = 0, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}
$query
->filterIsOnline()
->orderBy('.date', 'DESC');

if ($maxResults) {
$query
->limit($maxResults);
}

return $query->find();
}

public function findLatests($maxResults = 0)
{
$result = $this->findByMerchantQuery()
->orderBy('e.date', 'DESC');

$result->andWhere('e.status = 1');

if ($maxResults) {
$result->setMaxResults($maxResults);
}

return $result->getQuery()->getResult();
}
}

Loading…
Откажи
Сачувај