diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
index d135cda39..6a377f361 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
@@ -209,22 +209,24 @@ class CRUDController extends AbstractController
* This method:
*
* 1. Launch `onPreIndex`
- * x. check acl. If it does return a response instance, return it
- * x. launch `onPostCheckACL`. If it does return a response instance, return it
- * 1. count the items, using `countEntities`
- * 2. build a paginator element from the the number of entities ;
- * 3. Launch `onPreIndexQuery`. If it does return a response instance, return it
- * 3. build a query, using `queryEntities`
- * x. fetch the results, using `getQueryResult`
- * x. Launch `onPostIndexFetchQuery`. If it does return a response instance, return it
- * 4. create default parameters:
+ * 2. check acl. If it does return a response instance, return it
+ * 3. launch `onPostCheckACL`. If it does return a response instance, return it
+ * 4. count the items, using `countEntities`
+ * 5. build a paginator element from the the number of entities ;
+ * 6. Launch `onPreIndexQuery`. If it does return a response instance, return it
+ * 7. fetch the results, using `getQueryResult`
+ *
+ * Internally, this build a query, using `queryEntities`
+ *
+ * 8. Launch `onPostIndexFetchQuery`. If it does return a response instance, return it
+ * 9. create default parameters:
*
* The default parameters are:
*
* * entities: the list en entities ;
* * crud_name: the name of the crud ;
* * paginator: a paginator element ;
- * 5. Launch rendering, the parameter is fetch using `getTemplateFor`
+ * 10. Launch rendering, the parameter is fetch using `getTemplateFor`
* The parameters may be personnalized using `generateTemplateParameter`.
*
* @param string $action
@@ -259,16 +261,7 @@ class CRUDController extends AbstractController
return $response;
}
- $query = $this->queryEntities($action, $request, $paginator);
-
- $response = $this->onPostIndexBuildQuery($action, $request, $totalItems,
- $paginator, $query);
-
- if ($response instanceof Response) {
- return $response;
- }
-
- $entities = $this->getQueryResult($action, $request, $totalItems, $paginator, $query);
+ $entities = $this->getQueryResult($action, $request, $totalItems, $paginator);
$response = $this->onPostIndexFetchQuery($action, $request, $totalItems,
$paginator, $entities);
@@ -393,11 +386,12 @@ class CRUDController extends AbstractController
* @param Request $request
* @param int $totalItems
* @param PaginatorInterface $paginator
- * @param mixed $query
* @return mixed
*/
- protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query)
+ protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator)
{
+ $query = $this->queryEntities($action, $request, $paginator);
+
return $query->getQuery()->getResult();
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig
index 46828a49e..1fb35dd55 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig
@@ -1,5 +1,5 @@
-
+
{% block index_header %}
{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}
{% endblock index_header %}
@@ -32,17 +32,20 @@
{% endif %}
-
+{% block pagination %}
+
+{% endblock %}
{% block list_actions %}
{% endblock list_actions %}
diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php
index 91c80dab7..83df22991 100644
--- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php
+++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php
@@ -2,6 +2,11 @@
namespace Chill\ThirdPartyBundle\Controller;
+use Chill\MainBundle\CRUD\Controller\AbstractCRUDController;
+use Chill\MainBundle\CRUD\Controller\CRUDController;
+use Chill\MainBundle\Pagination\PaginatorInterface;
+use Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface;
+use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
@@ -16,12 +21,7 @@ use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\MainBundle\Pagination\PaginatorFactory;
-/**
- * Routes for operations on ThirdParties.
- *
- * @Route("/{_locale}/thirdparty/thirdparty")
- */
-class ThirdPartyController extends Controller
+final class ThirdPartyController extends CRUDController
{
/**
*
@@ -41,37 +41,33 @@ class ThirdPartyController extends Controller
*/
protected $paginatorFactory;
+ protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository;
+
public function __construct(
AuthorizationHelper $authorizationHelper,
TranslatorInterface $translator,
- PaginatorFactory $paginatorFactory
+ PaginatorFactory $paginatorFactory,
+ ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository
) {
$this->authorizationHelper = $authorizationHelper;
$this->translator = $translator;
$this->paginatorFactory = $paginatorFactory;
+ $this->thirdPartyACLAwareRepository = $thirdPartyACLAwareRepository;
}
-
- /**
- * @Route("/index", name="chill_3party_3party_index")
- */
- public function indexAction()
+ protected function countEntities(string $action, Request $request): int
{
- $this->denyAccessUnlessGranted(ThirdPartyVoter::SHOW);
- $repository = $this->getDoctrine()->getManager()
- ->getRepository(ThirdParty::class);
-
- $nbThirdParties = $repository->count([]); //$repository->countByMemberOfCenters($centers);
- $pagination = $this->paginatorFactory->create($nbThirdParties);
-
- $thirdParties = $repository->findAll();
-
- return $this->render('ChillThirdPartyBundle:ThirdParty:index.html.twig', array(
- 'third_parties' => $thirdParties,
- 'pagination' => $pagination
- ));
+ return $this->thirdPartyACLAwareRepository->countThirdParties(ThirdPartyVoter::SHOW);
}
+ protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator)
+ {
+ return $this->thirdPartyACLAwareRepository
+ ->listThirdParties(ThirdPartyVoter::class, ['name' => 'ASC'], $paginator->getItemsPerPage(),
+ $paginator->getCurrentPageFirstItemNumber());
+ }
+
+
/**
* @Route("/new", name="chill_3party_3party_new")
*/
diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php
index 5ebac821b..b6fa70130 100644
--- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php
+++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php
@@ -2,6 +2,9 @@
namespace Chill\ThirdPartyBundle\DependencyInjection;
+use Chill\ThirdPartyBundle\Controller\ThirdPartyController;
+use Chill\ThirdPartyBundle\Entity\ThirdParty;
+use Chill\ThirdPartyBundle\Form\ThirdPartyType;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
@@ -37,6 +40,7 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
$loader->load('services/menu.yaml');
$loader->load('services/fixtures.yaml');
$loader->load('services/serializer.yaml');
+ $loader->load('services/repository.yaml');
}
public function prepend(ContainerBuilder $container)
@@ -54,6 +58,25 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
'@ChillThirdPartyBundle/config/routes.yaml'
)
],
+ 'cruds' => [
+ [
+ 'class' => ThirdParty::class,
+ 'controller' => ThirdPartyController::class,
+ 'name' => '3party_3party',
+ 'base_path' => '/3party/3party',
+ 'form_class' => ThirdPartyType::class,
+ 'actions' => [
+ 'index' => [
+ 'template' => '@ChillThirdParty/ThirdParty/index.html.twig',
+ 'role' => ThirdPartyVoter::SHOW,
+ ],
+ 'new' => [
+ 'role' => ThirdPartyVoter::CREATE,
+ ]
+ ]
+
+ ]
+ ],
'apis' => [
[
'class' => \Chill\ThirdPartyBundle\Entity\ThirdParty::class,
diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php
index 21d74f17e..38ee0e5be 100644
--- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php
+++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php
@@ -40,7 +40,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
* center.
*
* @ORM\Table(name="chill_3party.third_party")
- * @ORM\Entity(repositoryClass="Chill\ThirdPartyBundle\Repository\ThirdPartyRepository")
+ * @ORM\Entity
* @DiscriminatorMap(typeProperty="type", mapping={
* "thirdparty"=ThirdParty::class
* })
diff --git a/src/Bundle/ChillThirdPartyBundle/Menu/MenuBuilder.php b/src/Bundle/ChillThirdPartyBundle/Menu/MenuBuilder.php
index 654c47e86..e52ba66e1 100644
--- a/src/Bundle/ChillThirdPartyBundle/Menu/MenuBuilder.php
+++ b/src/Bundle/ChillThirdPartyBundle/Menu/MenuBuilder.php
@@ -37,13 +37,13 @@ class MenuBuilder implements LocalMenuBuilderInterface
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
-
+
/**
*
* @var TranslatorInterface
*/
protected $translator;
-
+
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator
@@ -52,15 +52,15 @@ class MenuBuilder implements LocalMenuBuilderInterface
$this->translator = $translator;
}
-
+
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if ($this->authorizationChecker->isGranted(ThirdPartyVoter::SHOW)) {
$menu
->addChild(
- $this->translator->trans('Third parties'),
+ $this->translator->trans('Third parties'),
[
- 'route' => 'chill_3party_3party_index',
+ 'route' => 'chill_crud_3party_3party_index',
])
->setExtras([
'order' => 112
diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php
index ff21d18c7..46f52d8b6 100644
--- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php
+++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php
@@ -2,22 +2,52 @@
namespace Chill\ThirdPartyBundle\Repository;
+use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
+use Doctrine\ORM\QueryBuilder;
+use Symfony\Component\Security\Core\Security;
-/**
- * @Author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
- */
-class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface
+final class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface
{
+ private Security $security;
+ private AuthorizationHelper $authorizationHelper;
+ private ThirdPartyRepository $thirdPartyRepository;
- public function findByThirdparty(
- ThirdParty $thirdparty,
- string $role,
- ?array $orderBy = [],
- int $limit = null,
- int $offset = null
+ public function __construct(Security $security, AuthorizationHelper $authorizationHelper, ThirdPartyRepository $thirdPartyRepository)
+ {
+ $this->security = $security;
+ $this->authorizationHelper = $authorizationHelper;
+ $this->thirdPartyRepository = $thirdPartyRepository;
+ }
+
+ public function listThirdParties(
+ string $role,
+ ?array $orderBy = [],
+ ?int $limit = null,
+ ?int $offset = null
): array {
+ $qb = $this->buildQuery($role);
- // TODO: Implement findByThirdparty() method.
+ foreach ($orderBy as $sort => $direction) {
+ $qb->addOrderBy('tp.'.$sort, $direction);
+ }
+
+ $qb->setFirstResult($offset)
+ ->setMaxResults($limit);
+
+ return $qb->getQuery()->getResult();
+ }
+
+ public function countThirdParties(
+ string $role
+ ): int {
+ $qb = $this->buildQuery($role);
+ $qb->select('count(tp)');
+
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+ public function buildQuery(): QueryBuilder {
+ return $this->thirdPartyRepository->createQueryBuilder('tp');
}
}
diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepositoryInterface.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepositoryInterface.php
index 263a1312c..23c92e7f7 100644
--- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepositoryInterface.php
@@ -6,8 +6,16 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
interface ThirdPartyACLAwareRepositoryInterface
{
- public function findByThirdparty(
- ThirdParty $thirdparty,
+ public function countThirdParties(string $role): int;
+
+ /**
+ * @param string $role
+ * @param array|null $orderBy
+ * @param int|null $limit
+ * @param int|null $offset
+ * @return array|ThirdParty[]
+ */
+ public function listThirdParties(
string $role,
?array $orderBy = [],
int $limit = null,
diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
index 65845b744..f91501c59 100644
--- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
+++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
@@ -2,23 +2,26 @@
namespace Chill\ThirdPartyBundle\Repository;
+use Doctrine\ORM\EntityManagerInterface;
+use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Query;
-use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
-use Doctrine\Persistence\ManagerRegistry;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
+use Doctrine\Persistence\ObjectRepository;
-class ThirdPartyRepository extends ServiceEntityRepository
+final class ThirdPartyRepository implements ObjectRepository
{
- public function __construct(ManagerRegistry $registry)
+ private EntityRepository $repository;
+
+ public function __construct(EntityManagerInterface $em)
{
- parent::__construct($registry, ThirdParty::class);
+ $this->repository = $em->getRepository(ThirdParty::class);
}
/**
* count amongst parties associated to $centers, with $terms parameters
- *
+ *
* @param array $centers
* @param type $terms
* @return int
@@ -27,24 +30,24 @@ class ThirdPartyRepository extends ServiceEntityRepository
{
$qb = $this->buildQuery($centers, $terms);
$qb->select('COUNT(tp)');
-
+
return $qb->getQuery()->getSingleScalarResult();
}
-
+
/**
* Search amongst parties associated to $centers, with $terms parameters
- *
+ *
* Different format for return:
* - ['entity']: return the entity hydrated as objects
- * - ['array', [ DQL ]: return objects hydrated as entity, with
+ * - ['array', [ DQL ]: return objects hydrated as entity, with
* an array describing the fields as DQL.
- *
+ *
* supported terms:
- *
+ *
* - name or _default: containing the name (name LIKE %string%)
* - is_active: is active = true / false
* - types: an array of types
- *
+ *
* @param array $centers
* @param int $firstResult
* @param int $maxResults
@@ -74,43 +77,43 @@ class ThirdPartyRepository extends ServiceEntityRepository
break;
default:
throw new \DomainException("This return format is invalid");
- }
+ }
$qb->setFirstResult($firstResult)
->setMaxResults($maxResults);
-
+
return $qb->getQuery()->getResult();
}
-
+
protected function createMemberOfCentersQuery($centers): QueryBuilder
{
$qb = $this->createQueryBuilder('tp');
-
+
$or = $qb->expr()->orX();
-
+
foreach ($centers as $center) {
$or->add($qb->expr()->isMemberOf(':center_'.$center->getId(), 'tp.centers'));
$qb->setParameter('center_'.$center->getId(), $center);
}
-
+
$qb->where($or);
-
+
return $qb;
}
-
+
protected function buildQuery($centers, $terms): QueryBuilder
{
$qb = $this->createMemberOfCentersQuery($centers);
$this->setNameCondition($qb, $terms);
$this->setTypesCondition($qb, $terms);
$this->setIsActiveCondition($qb, $terms);
-
+
return $qb;
}
-
+
/**
- * Add parameters to filter by containing $terms["name"] or
+ * Add parameters to filter by containing $terms["name"] or
* $terms["_default"]
- *
+ *
* @param QueryBuilder $qb
* @param array $terms
*/
@@ -125,7 +128,7 @@ class ThirdPartyRepository extends ServiceEntityRepository
$qb->setParameter('name', '%'.$term.'%');
}
}
-
+
protected function setTypesCondition(QueryBuilder $qb, array $terms)
{
if (\array_key_exists('types', $terms)) {
@@ -137,14 +140,55 @@ class ThirdPartyRepository extends ServiceEntityRepository
$qb->andWhere($orx);
}
}
-
+
protected function setIsActiveCondition(QueryBuilder $qb, array $terms)
{
if (\array_key_exists('is_active', $terms)) {
$qb->andWhere(
- $terms['is_active'] ? $qb->expr()->eq('tp.active', "'TRUE'") :
+ $terms['is_active'] ? $qb->expr()->eq('tp.active', "'TRUE'") :
$qb->expr()->eq('tp.active', "'FALSE'")
);
}
}
+
+ public function find($id): ?ThirdParty
+ {
+ return $this->repository->find($id);
+ }
+
+ /**
+ * @return array|ThirdParty[]
+ */
+ public function findAll(): array
+ {
+ return $this->repository->findAll();
+ }
+
+ /**
+ * @param array $criteria
+ * @param array|null $orderBy
+ * @param null $limit
+ * @param null $offset
+ * @return array|ThirdParty[]
+ */
+ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
+ {
+ return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
+ }
+
+ public function findOneBy(array $criteria): ?ThirdParty
+ {
+ return $this->repository->findOneBy($criteria);
+ }
+
+ public function getClassName(): string
+ {
+ return ThirdParty::class;
+ }
+
+ public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
+ {
+ return $this->repository->createQueryBuilder($alias, $indexBy);
+ }
+
}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/page/index/chillthirdparty.scss
similarity index 100%
rename from src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss
rename to src/Bundle/ChillThirdPartyBundle/Resources/public/page/index/chillthirdparty.scss
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js b/src/Bundle/ChillThirdPartyBundle/Resources/public/page/index/index.js
similarity index 100%
rename from src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js
rename to src/Bundle/ChillThirdPartyBundle/Resources/public/page/index/index.js
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
index 1cd1a6257..a7ddb0f3c 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
@@ -2,108 +2,107 @@
{% block title 'List of third parties'|trans %}
+{% set third_parties = entities %}
+
{% block content %}
-
-
-
+ {% embed '@ChillMain/CRUD/_index.html.twig' %}
+ {% block index_header %}
+
{{ 'List of third parties'|trans }}
+ {% endblock %}
-
{{ 'List of third parties'|trans }}
+ {% block table_entities %}
+
+ {#
+
+
- {% if third_parties|length == 0 %}
-
{{ 'No third parties'|trans }}
- {% else %}
+ {% if third_parties|length == 0 %}
+
{{ 'No third parties'|trans }}
+ {% else %}
-
- outils de filtrage
-
+
+ outils de filtrage
+
+
-
-
-
+ #}
+
+
-
- {{ pagination.totalItems }} {{ 'third parties'|trans }}
-
+
+ {{ paginator.totalItems }} {{ 'third parties'|trans }}
+
-
-
-
-
- {{ 'Name'|trans }}
-
-
- {{ 'Category'|trans }}
-
-
- {{ 'Address'|trans }}
-
-
- {{ 'thirdparty.UpdatedAt.short'|trans }}
-
-
-
-
-
-
- {% for tp in third_parties %}
-
- {{ (tp.active ? '' : '')|raw }}
- {{ tp.name }}
- {% set types = [] %}
- {% for t in tp.types %}
- {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
- {% endfor %}
- {{ types|join(', ') }}
-
- {{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
-
-
- {% if tp.updatedAt != null %}
- {{ tp.updatedAt|format_date('short') }}
- {% else %}
- {{ tp.createdAt|format_date('short') }}
- {% endif %}
-
-
-
- {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
-
-
-
- {% endif %}
- {% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
-
-
-
- {% endif %}
-
-
-
- {% endfor %}
-
-
-
- {% if third_parties|length < pagination.getTotalItems %}
- {{ chill_pagination(pagination, 'long') }}
- {% endif %}
-
- {% endif %}
-
-
-
-
-
-
+
+
+
+
+ {{ 'Name'|trans }}
+
+
+ {{ 'Category'|trans }}
+
+
+ {{ 'Address'|trans }}
+
+
+ {{ 'thirdparty.UpdatedAt.short'|trans }}
+
+
+
+
+
+
+ {% for tp in third_parties %}
+
+ {{ (tp.active ? '' : '')|raw }}
+ {{ tp.name }}
+ {% set types = [] %}
+ {% for t in tp.types %}
+ {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
+ {% endfor %}
+ {{ types|join(', ') }}
+
+ {{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
+
+
+ {% if tp.updatedAt != null %}
+ {{ tp.updatedAt|format_date('short') }}
+ {% else %}
+ {{ tp.createdAt|format_date('short') }}
+ {% endif %}
+
+
+
+ {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
+
+
+
+ {% endif %}
+ {% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
+
+
+
+ {% endif %}
+
+
+
+ {% endfor %}
+
+
+
+
+
+ {% endblock %}
+ {% block actions_before %}
+
+ {{ chill_items_per_page(paginator) }}
+
+ {% endblock %}
+ {% endembed %}
+{% endblock %}
+
+{% block css %}
+ {{ encore_entry_link_tags('page_3party_3party_index') }}
{% endblock %}
diff --git a/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js b/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
index a31f8c5fc..c508cbc0c 100644
--- a/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
+++ b/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
@@ -1,9 +1,12 @@
module.exports = function(encore, entries)
{
- entries.push(__dirname + '/Resources/public/chill/index.js');
-
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillThirdPartyAssets: __dirname + '/Resources/public'
});
+
+ encore.addEntry(
+ 'page_3party_3party_index',
+ __dirname + '/Resources/public/page/index/index.js'
+ );
};
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services.yaml b/src/Bundle/ChillThirdPartyBundle/config/services.yaml
index 438ed3ff0..8f9420a67 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services.yaml
@@ -6,8 +6,3 @@ services:
tags:
- { name: 'serializer.normalizer', priority: 64 }
- Chill\ThirdPartyBundle\Repository\:
- autowire: true
- resource: '../Repository/'
- tags:
- - { name: 'doctrine.repository_service' }
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
index 14742d406..f10b58314 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
@@ -1,7 +1,5 @@
services:
- Chill\ThirdPartyBundle\Controller\ThirdPartyController:
- arguments:
- $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
- $translator: '@Symfony\Component\Translation\TranslatorInterface'
- $paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory'
- tags: ['controller.service_arguments']
\ No newline at end of file
+ Chill\ThirdPartyBundle\Controller\:
+ resource: './../Controller'
+ autowire: true
+ autoconfigure: true
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml
new file mode 100644
index 000000000..9d04f86b2
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml
@@ -0,0 +1,8 @@
+---
+services:
+ Chill\ThirdPartyBundle\Repository\:
+ autowire: true
+ autoconfigure: true
+ resource: '../Repository/'
+
+ Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface: '@Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepository'