apply php linter
This commit is contained in:
parent
5e392d469a
commit
d3f27d97ad
|
@ -83,7 +83,7 @@ class DateRangeAnalytic
|
|||
$datas[$index]['mobileViews'] += $entity->getMobileViews();
|
||||
}
|
||||
|
||||
uasort($datas, function($a, $b) {
|
||||
uasort($datas, function ($a, $b) {
|
||||
if ($a['views'] > $b['views']) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class DateRangeAnalytic
|
|||
$datas[$index]['uris'][$path] += $entity->getViews();
|
||||
}
|
||||
|
||||
uasort($datas, function($a, $b) {
|
||||
uasort($datas, function ($a, $b) {
|
||||
if ($a['views'] > $b['views']) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace App\Core\Bundle;
|
||||
|
||||
use App\Core\DependencyInjection\CoreExtension;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class CoreBundle extends Bundle
|
||||
{
|
||||
|
|
|
@ -5,13 +5,13 @@ namespace App\Core\Cache;
|
|||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\HttpClient\Exception\ClientException;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\HttpClient\Exception\ClientException;
|
||||
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
/**
|
||||
* class SymfonyCacheManager.
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace App\Core\Controller\Dashboard;
|
||||
|
||||
use App\Core\Controller\Admin\AdminController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class DashboardAdminController extends AdminController
|
||||
{
|
||||
|
|
|
@ -102,11 +102,11 @@ class RedirectAdminController extends CrudController
|
|||
'attr' => ['class' => 'col-6'],
|
||||
])
|
||||
->setField('index', 'Enabled', Field\ButtonField::class, [
|
||||
'property_builder' => function(EntityInterface $entity) {
|
||||
'property_builder' => function (EntityInterface $entity) {
|
||||
return $entity->getIsEnabled() ? 'Yes' : 'No';
|
||||
},
|
||||
'attr' => ['class' => 'col-1'],
|
||||
'button_attr_builder' => function(EntityInterface $entity) {
|
||||
'button_attr_builder' => function (EntityInterface $entity) {
|
||||
return ['class' => 'btn btn-sm btn-'.($entity->getIsEnabled() ? 'success' : 'primary')];
|
||||
},
|
||||
])
|
||||
|
|
|
@ -36,7 +36,7 @@ class NavigationSettingAdminController extends AdminController
|
|||
$lastRequestId = sprintf('setting_request_%s_%s', get_class($entity), $entity->getId());
|
||||
$lastRequest = $session->get($lastRequestId);
|
||||
|
||||
if ($lastRequest !== null && !$request->isMethod('POST')) {
|
||||
if (null !== $lastRequest && !$request->isMethod('POST')) {
|
||||
$fakeRequest = Request::create(
|
||||
uri: $request->getUri(),
|
||||
method: 'POST',
|
||||
|
|
|
@ -56,7 +56,7 @@ class SettingAdminController extends AdminController
|
|||
$lastRequestId = sprintf('setting_request_%s_%s', get_class($entity), $entity->getId());
|
||||
$lastRequest = $session->get($lastRequestId);
|
||||
|
||||
if ($lastRequest !== null && !$request->isMethod('POST')) {
|
||||
if (null !== $lastRequest && !$request->isMethod('POST')) {
|
||||
$fakeRequest = Request::create(
|
||||
uri: $request->getUri(),
|
||||
method: 'POST',
|
||||
|
|
|
@ -67,7 +67,7 @@ class NavigationAdminController extends CrudController
|
|||
}
|
||||
|
||||
#[Route(path: '/admin/site/navigation/sort/{page}', name: 'admin_site_navigation_sort', methods: ['POST'], requirements: ['page' => '\d+'])]
|
||||
public function sort(RepositoryQuery $query, EntityManager $entityManager, Request $request, Session $session, int $page = 1, ): Response
|
||||
public function sort(RepositoryQuery $query, EntityManager $entityManager, Request $request, Session $session, int $page = 1): Response
|
||||
{
|
||||
return $this->doSort($page, $query, $entityManager, $request, $session);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Core\Controller\Site;
|
||||
|
||||
use App\Core\Controller\Admin\AdminController;
|
||||
use App\Core\Entity\Site\Node;
|
||||
use App\Core\Entity\Site\Node as Entity;
|
||||
use App\Core\Entity\Site\Page\Page;
|
||||
|
@ -14,15 +13,15 @@ use App\Core\Form\Site\NodeType as EntityType;
|
|||
use App\Core\Manager\EntityManager;
|
||||
use App\Core\Repository\Site\NodeRepository;
|
||||
use App\Core\Site\ControllerLocator;
|
||||
use App\Core\Site\RoleLocator;
|
||||
use App\Core\Site\PageLocator;
|
||||
use App\Core\Site\RoleLocator;
|
||||
use App\Core\Sitemap\SitemapBuilder;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
#[Route(path: '/admin/site/node')]
|
||||
class NodeAdminController extends AbstractController
|
||||
|
@ -145,7 +144,7 @@ class NodeAdminController extends AbstractController
|
|||
|
||||
$page = $entity->getPage();
|
||||
|
||||
if ($page !== null) {
|
||||
if (null !== $page) {
|
||||
$pageConfiguration = $pageLocator->getPages()[get_class($page)] ?? null;
|
||||
} else {
|
||||
$pageConfiguration = null;
|
||||
|
|
|
@ -5,19 +5,19 @@ namespace App\Core\Controller\Site;
|
|||
use App\Core\Controller\Admin\Crud\CrudController;
|
||||
use App\Core\Crud\CrudConfiguration;
|
||||
use App\Core\Crud\Field;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Core\Entity\Site\Page\Page as Entity;
|
||||
use App\Core\Event\Page\PageEditEvent;
|
||||
use App\Core\Form\Site\Page\Filter\PageFilterType as FilterType;
|
||||
use App\Core\Form\Site\Page\PageType as Type;
|
||||
use App\Core\Manager\EntityManager;
|
||||
use App\Core\Repository\Site\Page\PageRepositoryQuery as RepositoryQuery;
|
||||
use App\Core\Site\PageLocator;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Core\Event\Page\PageEditEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
|
||||
class PageAdminController extends CrudController
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ class PageAdminController extends CrudController
|
|||
}],
|
||||
'attr' => ['class' => 'col-6'],
|
||||
])
|
||||
->setBatchAction('index', 'delete', 'Delete', function(EntityInterface $entity, EntityManager $manager) {
|
||||
->setBatchAction('index', 'delete', 'Delete', function (EntityInterface $entity, EntityManager $manager) {
|
||||
$manager->delete($entity);
|
||||
})
|
||||
;
|
||||
|
|
|
@ -17,7 +17,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class UserAdminController extends CrudController
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ class CrudConfiguration
|
|||
return self::$self;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setPageTitle(string $page, string $title): self
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ class CrudConfiguration
|
|||
return $this->pageTitles[$page] ?? $default;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setPageRoute(string $page, string $route): self
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ class CrudConfiguration
|
|||
return $this->pageRouteParams[$page] ?? [];
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setForm(string $context, string $form): self
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ class CrudConfiguration
|
|||
return $this->formOptions[$context] ?? [];
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setAction(string $page, string $action, bool|callable $enabled): self
|
||||
{
|
||||
|
@ -140,8 +140,7 @@ class CrudConfiguration
|
|||
string $action,
|
||||
string $label,
|
||||
callable $callback
|
||||
): self
|
||||
{
|
||||
): self {
|
||||
$this->setBatchAction($page, $action, $label, $callback);
|
||||
$this->batchActions[$page][$action]['isGlobal'] = true;
|
||||
|
||||
|
@ -153,8 +152,7 @@ class CrudConfiguration
|
|||
string $action,
|
||||
string $label,
|
||||
callable $callback
|
||||
): self
|
||||
{
|
||||
): self {
|
||||
if (!isset($this->batchActions[$page])) {
|
||||
$this->batchActions[$page] = [];
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ class CrudConfiguration
|
|||
$this->batchActions[$page][$action] = [
|
||||
'label' => $label,
|
||||
'callback' => $callback,
|
||||
'isGlobal' => false
|
||||
'isGlobal' => false,
|
||||
];
|
||||
|
||||
return $this;
|
||||
|
@ -183,7 +181,7 @@ class CrudConfiguration
|
|||
return !empty($this->batchActions[$page]);
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setActionTitle(string $page, string $action, string $title): self
|
||||
{
|
||||
|
@ -201,7 +199,7 @@ class CrudConfiguration
|
|||
return $this->actionTitles[$page][$action] ?? $default;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setView(string $context, string $view): self
|
||||
{
|
||||
|
@ -249,7 +247,7 @@ class CrudConfiguration
|
|||
return $this->viewDatas[$context][$name] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setField(string $context, string $label, string $field, array $options): self
|
||||
{
|
||||
|
@ -277,7 +275,7 @@ class CrudConfiguration
|
|||
return $this;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setMaxPerPage(string $page, int $max): self
|
||||
{
|
||||
|
@ -291,7 +289,7 @@ class CrudConfiguration
|
|||
return $this->maxPerPage[$page] ?? $default;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setDoubleClick(string $page, bool $enabled): self
|
||||
{
|
||||
|
@ -305,7 +303,7 @@ class CrudConfiguration
|
|||
return $this->doubleClick[$page] ?? false;
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setI18n(array $locales, string $defaultLocale): self
|
||||
{
|
||||
|
@ -330,7 +328,7 @@ class CrudConfiguration
|
|||
return !empty($this->locales);
|
||||
}
|
||||
|
||||
/* -- */
|
||||
// --
|
||||
|
||||
public function setDefaultSort(string $context, string $label, string $direction = 'asc'): self
|
||||
{
|
||||
|
|
|
@ -51,8 +51,8 @@ abstract class Field
|
|||
$resolver->setAllowedTypes('href_attr', ['array', 'callable']);
|
||||
$resolver->setAllowedTypes('raw', 'boolean');
|
||||
$resolver->setAllowedTypes('property_builder', ['null', 'callable']);
|
||||
$resolver->setAllowedValues('sort', function($value) {
|
||||
if ($value === null) {
|
||||
$resolver->setAllowedValues('sort', function ($value) {
|
||||
if (null === $value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace App\Core\Entity\Analytic;
|
||||
|
||||
use App\Core\Entity\Site\Node;
|
||||
use App\Repository\Entity\Analytic\NodeViewRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Core\Entity\Site\Node;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'analytic_referer')]
|
||||
#[ORM\Entity(repositoryClass: ViewRepository::class)]
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace App\Core\Entity\Analytic;
|
||||
|
||||
use App\Core\Entity\Site\Node;
|
||||
use App\Repository\Entity\Analytic\NodeViewRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Core\Entity\Site\Node;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'analytic_view')]
|
||||
#[ORM\Entity(repositoryClass: ViewRepository::class)]
|
||||
|
|
|
@ -43,7 +43,7 @@ class Navigation implements EntityInterface
|
|||
protected $locale = 'en';
|
||||
|
||||
#[ORM\Column(type: 'string', length: 7, nullable: true)]
|
||||
protected $color = null;
|
||||
protected $color;
|
||||
|
||||
#[ORM\Column(type: 'integer', nullable: true)]
|
||||
protected $sortOrder;
|
||||
|
|
|
@ -5,13 +5,12 @@ namespace App\Core\Entity\Site\Page;
|
|||
use App\Core\Doctrine\Timestampable;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Core\Entity\Site\Node;
|
||||
use App\Core\File\FileAttribute;
|
||||
use App\Core\Repository\Site\Page\PageRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use App\Core\File\FileAttribute;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PageRepository::class)]
|
||||
#[ORM\DiscriminatorColumn(name: 'class_key', type: 'string')]
|
||||
|
@ -89,7 +88,7 @@ class Page implements EntityInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Block[]
|
||||
* @return Block[]|Collection
|
||||
*/
|
||||
public function getBlocks(): Collection
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class PasswordRequestEvent extends Event
|
||||
{
|
||||
const EVENT = 'account_event.password_request';
|
||||
public const EVENT = 'account_event.password_request';
|
||||
|
||||
protected User $user;
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class EntityManagerEvent extends Event
|
||||
{
|
||||
const CREATE_EVENT = 'entity_manager_event.create';
|
||||
const UPDATE_EVENT = 'entity_manager_event.update';
|
||||
const DELETE_EVENT = 'entity_manager_event.delete';
|
||||
const PRE_CREATE_EVENT = 'entity_manager_event.pre_create';
|
||||
const PRE_UPDATE_EVENT = 'entity_manager_event.pre_update';
|
||||
const PRE_DELETE_EVENT = 'entity_manager_event.pre_delete';
|
||||
public const CREATE_EVENT = 'entity_manager_event.create';
|
||||
public const UPDATE_EVENT = 'entity_manager_event.update';
|
||||
public const DELETE_EVENT = 'entity_manager_event.delete';
|
||||
public const PRE_CREATE_EVENT = 'entity_manager_event.pre_create';
|
||||
public const PRE_UPDATE_EVENT = 'entity_manager_event.pre_update';
|
||||
public const PRE_DELETE_EVENT = 'entity_manager_event.pre_delete';
|
||||
|
||||
protected EntityInterface $entity;
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Core\Event\Page;
|
||||
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use App\Core\Entity\Site\Page\Page;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* class PageEditEvent.
|
||||
|
@ -12,7 +12,7 @@ use App\Core\Entity\Site\Page\Page;
|
|||
*/
|
||||
class PageEditEvent extends Event
|
||||
{
|
||||
const FORM_INIT_EVENT = 'page_edit_event.form_init';
|
||||
public const FORM_INIT_EVENT = 'page_edit_event.form_init';
|
||||
|
||||
protected Page $page;
|
||||
protected array $pageBuilderOptions = [];
|
||||
|
|
|
@ -11,8 +11,8 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class NavigationSettingEvent extends Event
|
||||
{
|
||||
const INIT_EVENT = 'navigation_setting_event.init';
|
||||
const FORM_INIT_EVENT = 'navigation_setting_event.form_init';
|
||||
public const INIT_EVENT = 'navigation_setting_event.init';
|
||||
public const FORM_INIT_EVENT = 'navigation_setting_event.form_init';
|
||||
|
||||
protected $data;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class SettingEvent extends Event
|
||||
{
|
||||
const INIT_EVENT = 'setting_event.init';
|
||||
const FORM_INIT_EVENT = 'setting_event.form_init';
|
||||
public const INIT_EVENT = 'setting_event.init';
|
||||
public const FORM_INIT_EVENT = 'setting_event.form_init';
|
||||
|
||||
protected $data;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class TaskInitEvent extends Event
|
||||
{
|
||||
const INIT_EVENT = 'task_event.init';
|
||||
public const INIT_EVENT = 'task_event.init';
|
||||
|
||||
protected array $tasks = [];
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
*/
|
||||
class TaskRunRequestedEvent extends Event
|
||||
{
|
||||
const RUN_REQUEST_EVENT = 'task_event.run_request';
|
||||
public const RUN_REQUEST_EVENT = 'task_event.run_request';
|
||||
|
||||
protected string $task;
|
||||
protected InputBag $parameters;
|
||||
|
|
|
@ -6,7 +6,6 @@ use App\Core\Ab\AbContainer;
|
|||
use App\Core\Ab\AbTest;
|
||||
use App\Core\Entity\Site\Node;
|
||||
use App\Core\Event\Ab\AbTestEvent;
|
||||
use App\Core\Repository\Site\NodeRepository;
|
||||
use App\Core\Site\SiteRequest;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
|
@ -70,6 +69,16 @@ class AbListener
|
|||
}
|
||||
}
|
||||
|
||||
public function onKernelResponse(ResponseEvent $event)
|
||||
{
|
||||
$cookies = $event->getRequest()->attributes->get('ab_test_cookies', []);
|
||||
|
||||
foreach ($cookies as $name => $value) {
|
||||
$cookie = Cookie::create($name, $value['value'], time() + $value['duration']);
|
||||
$event->getResponse()->headers->setCookie($cookie);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCookieName(): string
|
||||
{
|
||||
return 'ab_test_'.$this->getAbTestCode();
|
||||
|
@ -96,14 +105,4 @@ class AbListener
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onKernelResponse(ResponseEvent $event)
|
||||
{
|
||||
$cookies = $event->getRequest()->attributes->get('ab_test_cookies', []);
|
||||
|
||||
foreach ($cookies as $name => $value) {
|
||||
$cookie = Cookie::create($name, $value['value'], time() + $value['duration']);
|
||||
$event->getResponse()->headers->setCookie($cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
namespace App\Core\EventListener;
|
||||
|
||||
use App\Core\Repository\RedirectRepositoryQuery;
|
||||
use App\Core\Router\RedirectBuilder;
|
||||
use App\Core\Router\RedirectMatcher;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use App\Core\Router\RedirectBuilder;
|
||||
|
||||
/**
|
||||
* class RedirectListener.
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace App\Core\EventSubscriber\Site;
|
|||
|
||||
use App\Core\Site\SiteRequest;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use function Symfony\Component\String\u;
|
||||
|
||||
class ForcedDomainEventSubscriber implements EventSubscriberInterface
|
||||
|
@ -38,7 +38,8 @@ class ForcedDomainEventSubscriber implements EventSubscriberInterface
|
|||
->replace(
|
||||
'://'.$this->siteRequest->getDomain(),
|
||||
'://'.$navigation->getDomain()
|
||||
);
|
||||
)
|
||||
;
|
||||
|
||||
$event->getResponse()->headers->set('Location', $uri);
|
||||
$event->getResponse()->setStatusCode(Response::HTTP_MOVED_PERMANENTLY);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Core\Factory;
|
||||
|
||||
use App\Core\Factory\FactoryInterface;
|
||||
use App\Core\Entity\Redirect as Entity;
|
||||
|
||||
class RedirectFactory implements FactoryInterface
|
||||
|
|
|
@ -6,7 +6,6 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
|
||||
class FilePickerType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
|
||||
namespace App\Core\Form\Filter;
|
||||
|
||||
use App\Core\Entity\Redirect;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class RedirectFilterType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -4,12 +4,12 @@ namespace App\Core\Form;
|
|||
|
||||
use App\Core\Entity\Redirect;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
|
||||
class RedirectType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -6,12 +6,12 @@ use App\Core\Entity\Site\Navigation;
|
|||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ColorType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ColorType;
|
||||
|
||||
class NavigationType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Core\Form\Site\Page;
|
||||
|
||||
use App\Core\Entity\Site\Page\Block;
|
||||
use App\Core\Form\FileManager\FilePickerType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use App\Core\Entity\Site\Page\Block;
|
||||
|
||||
class FilePickerBlockType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -6,10 +6,10 @@ use App\Core\Entity\Site\Navigation;
|
|||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
class PageFilterType extends AbstractType
|
||||
{
|
||||
|
|
|
@ -11,8 +11,8 @@ use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
|
|||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use function Symfony\Component\String\u;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use function Symfony\Component\String\u;
|
||||
|
||||
class MakeCrudController extends AbstractMaker
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@ use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
|
|||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use function Symfony\Component\String\u;
|
||||
|
||||
class MakeFactory extends AbstractMaker
|
||||
{
|
||||
|
|
|
@ -8,11 +8,11 @@ use Symfony\Bundle\MakerBundle\DependencyBuilder;
|
|||
use Symfony\Bundle\MakerBundle\Generator;
|
||||
use Symfony\Bundle\MakerBundle\InputConfiguration;
|
||||
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class MakePage extends AbstractMaker
|
||||
|
@ -92,7 +92,8 @@ class MakePage extends AbstractMaker
|
|||
|
||||
$this->writeSuccessMessage($io);
|
||||
$io->text('Register the page in <comment>config/packages/app.yaml</comment>: ');
|
||||
$io->text(<<< EOF
|
||||
$io->text(
|
||||
<<< EOF
|
||||
|
||||
core:
|
||||
site:
|
||||
|
@ -100,10 +101,18 @@ core:
|
|||
{$pageClassNameDetails->getFullName()}:
|
||||
name: {$pageClassNameDetails->getShortName()}
|
||||
templates:
|
||||
- {name: "Default", file: "${templatePath}"}
|
||||
- {name: "Default", file: "{$templatePath}"}
|
||||
|
||||
EOF
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public function configureDependencies(DependencyBuilder $dependencies)
|
||||
{
|
||||
$dependencies->addClassDependency(
|
||||
Annotation::class,
|
||||
'doctrine/annotations'
|
||||
);
|
||||
}
|
||||
|
||||
private function askForNextBlock(ConsoleStyle $io, array $blocks, bool $isFirstField)
|
||||
|
@ -183,12 +192,4 @@ EOF
|
|||
$io->writeln(sprintf(' * <comment>%s</comment>', $type));
|
||||
}
|
||||
}
|
||||
|
||||
public function configureDependencies(DependencyBuilder $dependencies)
|
||||
{
|
||||
$dependencies->addClassDependency(
|
||||
Annotation::class,
|
||||
'doctrine/annotations'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Core\Notification;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Twig\Environment as TwigEnvironment;
|
||||
use App\Entity\User;
|
||||
|
||||
/**
|
||||
* class MailNotifier.
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method Referer|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Referer|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|Referer find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|Referer findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Referer[] findAll()
|
||||
* @method Referer[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Core\Repository\Analytic;
|
||||
|
||||
use App\Core\Repository\Analytic\RefererRepository as Repository;
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
|
||||
class RefererRepositoryQuery extends RepositoryQuery
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method View|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method View|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|View find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|View findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method View[] findAll()
|
||||
* @method View[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Core\Repository\Analytic;
|
||||
|
||||
use App\Core\Repository\Analytic\ViewRepository as Repository;
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
|
||||
class ViewRepositoryQuery extends RepositoryQuery
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method FileInformation|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method FileInformation|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|FileInformation find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|FileInformation findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method FileInformation[] findAll()
|
||||
* @method FileInformation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method NavigationSetting|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method NavigationSetting|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|NavigationSetting find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|NavigationSetting findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method NavigationSetting[] findAll()
|
||||
* @method NavigationSetting[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method Redirect|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Redirect|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|Redirect find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|Redirect findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Redirect[] findAll()
|
||||
* @method Redirect[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
namespace App\Core\Repository;
|
||||
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use App\Core\Repository\RedirectRepository as Repository;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
|
||||
class RedirectRepositoryQuery extends RepositoryQuery
|
||||
{
|
||||
|
|
|
@ -98,6 +98,17 @@ abstract class RepositoryQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return $this
|
||||
->select(sprintf('COUNT(%s.id) as total', $this->id))
|
||||
->query
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getOneOrNullResult()['total']
|
||||
;
|
||||
}
|
||||
|
||||
protected function addForcedFilterHandler(string $name): self
|
||||
{
|
||||
if (!in_array($name, $this->forcedFilterHandlers)) {
|
||||
|
@ -131,15 +142,4 @@ abstract class RepositoryQuery
|
|||
protected function filterHandler(string $name, $value)
|
||||
{
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return $this
|
||||
->select(sprintf('COUNT(%s.id) as total', $this->id))
|
||||
->query
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getOneOrNullResult()['total']
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method Setting|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Setting|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method null|Setting find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method null|Setting findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Setting[] findAll()
|
||||
* @method Setting[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
|
|
|
@ -32,9 +32,9 @@ class NodeRepository extends NestedTreeRepository
|
|||
;
|
||||
}
|
||||
|
||||
return $query->getQuery()
|
||||
return null !== $query->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getOneOrNullResult() !== null
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
<?= "<?php\n" ?>
|
||||
<?php echo "<?php\n"; ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
namespace <?php echo $namespace; ?>;
|
||||
|
||||
use App\Core\Controller\Admin\Crud\CrudController;
|
||||
use App\Core\Crud\CrudConfiguration;
|
||||
use App\Core\Crud\Field;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Core\Manager\EntityManager;
|
||||
use <?= $entity ?> as Entity;
|
||||
use <?= $factory ?> as Factory;
|
||||
use <?= $form ?> as Type;
|
||||
use <?= $repository_query ?> as RepositoryQuery;
|
||||
use <?php echo $entity; ?> as Entity;
|
||||
use <?php echo $factory; ?> as Factory;
|
||||
use <?php echo $form; ?> as Type;
|
||||
use <?php echo $repository_query; ?> as RepositoryQuery;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class <?= $class_name; ?> extends CrudController
|
||||
class <?php echo $class_name; ?> extends CrudController
|
||||
{
|
||||
protected ?CrudConfiguration $configuration = null;
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/{page}', name: 'admin_<?= $route; ?>_index', methods: ['GET'], requirements: ['page' => '\d+'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/{page}', name: 'admin_<?php echo $route; ?>_index', methods: ['GET'], requirements: ['page' => '\d+'])]
|
||||
public function index(RepositoryQuery $query, Request $request, Session $session, int $page = 1): Response
|
||||
{
|
||||
return $this->doIndex($page, $query, $request, $session);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/new', name: 'admin_<?= $route; ?>_new', methods: ['GET', 'POST'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/new', name: 'admin_<?php echo $route; ?>_new', methods: ['GET', 'POST'])]
|
||||
public function new(Factory $factory, EntityManager $entityManager, Request $request): Response
|
||||
{
|
||||
return $this->doNew($factory->create(), $entityManager, $request);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/show/{entity}', name: 'admin_<?= $route; ?>_show', methods: ['GET'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/show/{entity}', name: 'admin_<?php echo $route; ?>_show', methods: ['GET'])]
|
||||
#[IsGranted('show', 'entity')]
|
||||
public function show(Entity $entity): Response
|
||||
{
|
||||
return $this->doShow($entity);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/filter', name: 'admin_<?= $route; ?>_filter', methods: ['GET'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/filter', name: 'admin_<?php echo $route; ?>_filter', methods: ['GET'])]
|
||||
public function filter(Session $session): Response
|
||||
{
|
||||
return $this->doFilter($session);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/edit/{entity}', name: 'admin_<?= $route; ?>_edit', methods: ['GET', 'POST'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/edit/{entity}', name: 'admin_<?php echo $route; ?>_edit', methods: ['GET', 'POST'])]
|
||||
#[IsGranted('edit', 'entity')]
|
||||
public function edit(Entity $entity, EntityManager $entityManager, Request $request): Response
|
||||
{
|
||||
return $this->doEdit($entity, $entityManager, $request);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/inline_edit/{entity}/{context}/{label}', name: 'admin_<?= $route; ?>_inline_edit', methods: ['GET', 'POST'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/inline_edit/{entity}/{context}/{label}', name: 'admin_<?php echo $route; ?>_inline_edit', methods: ['GET', 'POST'])]
|
||||
#[IsGranted('edit', 'entity')]
|
||||
public function inlineEdit(string $context, string $label, Entity $entity, EntityManager $entityManager, Request $request): Response
|
||||
{
|
||||
return $this->doInlineEdit($context, $label, $entity, $entityManager, $request);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/sort/{page}', name: 'admin_<?= $route; ?>_sort', methods: ['POST'], requirements: ['page' => '\d+'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/sort/{page}', name: 'admin_<?php echo $route; ?>_sort', methods: ['POST'], requirements: ['page' => '\d+'])]
|
||||
public function sort(RepositoryQuery $query, EntityManager $entityManager, Request $request, Session $session, int $page = 1): Response
|
||||
{
|
||||
return $this->doSort($page, $query, $entityManager, $request, $session);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/batch/{page}', name: 'admin_<?= $route; ?>_batch', methods: ['POST'], requirements: ['page' => '\d+'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/batch/{page}', name: 'admin_<?php echo $route; ?>_batch', methods: ['POST'], requirements: ['page' => '\d+'])]
|
||||
public function batch(RepositoryQuery $query, EntityManager $entityManager, Request $request, Session $session, int $page = 1): Response
|
||||
{
|
||||
return $this->doBatch($page, $query, $entityManager, $request, $session);
|
||||
}
|
||||
|
||||
#[Route(path: '/admin/<?= $route; ?>/delete/{entity}', name: 'admin_<?= $route; ?>_delete', methods: ['DELETE', 'POST'])]
|
||||
#[Route(path: '/admin/<?php echo $route; ?>/delete/{entity}', name: 'admin_<?php echo $route; ?>_delete', methods: ['DELETE', 'POST'])]
|
||||
#[IsGranted('delete', 'entity')]
|
||||
public function delete(Entity $entity, EntityManager $entityManager, Request $request): Response
|
||||
{
|
||||
|
@ -86,26 +86,26 @@ class <?= $class_name; ?> extends CrudController
|
|||
}
|
||||
|
||||
return $this->configuration = CrudConfiguration::create()
|
||||
->setPageTitle('index', 'List of <?= $entity; ?>')
|
||||
->setPageTitle('index', 'List of <?php echo $entity; ?>')
|
||||
->setPageTitle('edit', 'Edition of {id}')
|
||||
->setPageTitle('new', 'New <?= $entity; ?>')
|
||||
->setPageTitle('new', 'New <?php echo $entity; ?>')
|
||||
->setPageTitle('show', 'View of {id}')
|
||||
|
||||
->setPageRoute('index', 'admin_<?= $route; ?>_index')
|
||||
->setPageRoute('new', 'admin_<?= $route; ?>_new')
|
||||
->setPageRoute('edit', 'admin_<?= $route; ?>_edit')
|
||||
->setPageRoute('inline_edit', 'admin_<?= $route; ?>_inline_edit')
|
||||
->setPageRoute('show', 'admin_<?= $route; ?>_show')
|
||||
->setPageRoute('sort', 'admin_<?= $route; ?>_sort')
|
||||
->setPageRoute('batch', 'admin_<?= $route; ?>_batch')
|
||||
->setPageRoute('delete', 'admin_<?= $route; ?>_delete')
|
||||
->setPageRoute('filter', 'admin_<?= $route; ?>_filter')
|
||||
->setPageRoute('index', 'admin_<?php echo $route; ?>_index')
|
||||
->setPageRoute('new', 'admin_<?php echo $route; ?>_new')
|
||||
->setPageRoute('edit', 'admin_<?php echo $route; ?>_edit')
|
||||
->setPageRoute('inline_edit', 'admin_<?php echo $route; ?>_inline_edit')
|
||||
->setPageRoute('show', 'admin_<?php echo $route; ?>_show')
|
||||
->setPageRoute('sort', 'admin_<?php echo $route; ?>_sort')
|
||||
->setPageRoute('batch', 'admin_<?php echo $route; ?>_batch')
|
||||
->setPageRoute('delete', 'admin_<?php echo $route; ?>_delete')
|
||||
->setPageRoute('filter', 'admin_<?php echo $route; ?>_filter')
|
||||
|
||||
->setForm('edit', Type::class)
|
||||
->setForm('new', Type::class)
|
||||
|
||||
->setView('form', 'admin/<?= $route; ?>_admin/_form.html.twig')
|
||||
->setView('show_entity', 'admin/<?= $route; ?>_admin/_show.html.twig')
|
||||
->setView('form', 'admin/<?php echo $route; ?>_admin/_form.html.twig')
|
||||
->setView('show_entity', 'admin/<?php echo $route; ?>_admin/_show.html.twig')
|
||||
|
||||
// ->setForm('filter', Type::class)
|
||||
|
||||
|
@ -149,6 +149,6 @@ class <?= $class_name; ?> extends CrudController
|
|||
|
||||
protected function getSection(): string
|
||||
{
|
||||
return '<?= $route; ?>';
|
||||
return '<?php echo $route; ?>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?= "<?php\n" ?>
|
||||
<?php echo "<?php\n"; ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
namespace <?php echo $namespace; ?>;
|
||||
|
||||
use App\Core\Factory\FactoryInterface;
|
||||
use <?= $entity ?> as Entity;
|
||||
use <?php echo $entity; ?> as Entity;
|
||||
|
||||
class <?= $class_name; ?> implements FactoryInterface
|
||||
class <?php echo $class_name; ?> implements FactoryInterface
|
||||
{
|
||||
public function create(): Entity
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?= "<?php\n" ?>
|
||||
<?php echo "<?php\n"; ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
namespace <?php echo $namespace; ?>;
|
||||
|
||||
use App\Core\Entity\Site\Page\Page;
|
||||
use App\Core\Entity\Site\Page as BlockEntity;
|
||||
|
@ -9,28 +9,28 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
#[ORM\Entity]
|
||||
class <?= $class_name; ?> extends Page
|
||||
class <?php echo $class_name; ?> extends Page
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
<?php if (count($blocks)): ?> $builder
|
||||
<?php foreach ($blocks as $block): ?>
|
||||
->add('<?= $block['name'] ?>', <?= $block['type'] ?>)
|
||||
<?php endforeach; ?>
|
||||
<?php if (count($blocks)) { ?> $builder
|
||||
<?php foreach ($blocks as $block) { ?>
|
||||
->add('<?php echo $block['name']; ?>', <?php echo $block['type']; ?>)
|
||||
<?php } ?>
|
||||
;
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
<?php foreach ($blocks as $block): ?>
|
||||
public function set<?= $block['camelCase'] ?>(BlockEntity\Block $block)
|
||||
<?php foreach ($blocks as $block) { ?>
|
||||
public function set<?php echo $block['camelCase']; ?>(BlockEntity\Block $block)
|
||||
{
|
||||
return $this->setBlock($block);
|
||||
}
|
||||
|
||||
public function get<?= $block['camelCase'] ?>()
|
||||
public function get<?php echo $block['camelCase']; ?>()
|
||||
{
|
||||
return $this->getBlock('<?= $block['name'] ?>'<?php if ($block['class']): ?>, <?= $block['class'] ?><?php endif; ?>);
|
||||
return $this->getBlock('<?php echo $block['name']; ?>'<?php if ($block['class']) { ?>, <?php echo $block['class']; ?><?php } ?>);
|
||||
}
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php } ?>
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?= "<?php\n" ?>
|
||||
<?php echo "<?php\n"; ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
namespace <?php echo $namespace; ?>;
|
||||
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use <?= $repository; ?> as Repository;
|
||||
use <?php echo $repository; ?> as Repository;
|
||||
|
||||
class <?= $class_name; ?> extends RepositoryQuery
|
||||
class <?php echo $class_name; ?> extends RepositoryQuery
|
||||
{
|
||||
public function __construct(Repository $repository, PaginatorInterface $paginator)
|
||||
{
|
||||
parent::__construct($repository, '<?= $id; ?>', $paginator);
|
||||
parent::__construct($repository, '<?php echo $id; ?>', $paginator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Core\Twig\Extension;
|
||||
|
||||
use App\Core\Ab\AbContainer;
|
||||
use App\Core\Ab\AbTestInterface;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
use App\Core\Ab\AbTestInterface;
|
||||
|
||||
class AbTestExtension extends AbstractExtension
|
||||
{
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
namespace App\Core\Twig\Extension;
|
||||
|
||||
use App\Core\String\StringBuilder;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\Environment;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class EditorJsExtension extends AbstractExtension
|
||||
{
|
||||
|
@ -68,23 +67,23 @@ class EditorJsExtension extends AbstractExtension
|
|||
$data = json_decode(json_encode($data), true);
|
||||
}
|
||||
|
||||
if ($data === null) {
|
||||
if (null === $data) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($allowedBlocks === null) {
|
||||
if (null === $allowedBlocks) {
|
||||
$allowedBlocks = $this->defaultAllowedBlocks;
|
||||
}
|
||||
|
||||
$blocks = $data['blocks'] ?? [];
|
||||
$renders = '';
|
||||
|
||||
$blocks = array_filter($data['blocks'] ?? [], function($block) use ($allowedBlocks) {
|
||||
$blocks = array_filter($data['blocks'] ?? [], function ($block) use ($allowedBlocks) {
|
||||
return isset($block['type']) && in_array($block['type'], $allowedBlocks);
|
||||
});
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
$renders.= $this->twig->render($this->views[$block['type']], $block['data'] ?? []);
|
||||
$renders .= $this->twig->render($this->views[$block['type']], $block['data'] ?? []);
|
||||
}
|
||||
|
||||
return $renders;
|
||||
|
|
|
@ -4,10 +4,10 @@ namespace App\Core\Twig\Extension;
|
|||
|
||||
use App\Core\FileManager\FsFileManager;
|
||||
use App\Core\Repository\FileInformationRepositoryQuery;
|
||||
use App\Core\String\FileInformationBuilder;
|
||||
use function Symfony\Component\String\u;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use App\Core\String\FileInformationBuilder;
|
||||
|
||||
class FileInformationExtension extends AbstractExtension
|
||||
{
|
||||
|
@ -17,8 +17,7 @@ class FileInformationExtension extends AbstractExtension
|
|||
FileInformationBuilder $fileInfoBuilder,
|
||||
FsFileManager $fsManager,
|
||||
FileInformationRepositoryQuery $query
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->fileInfoBuilder = $fileInfoBuilder;
|
||||
$this->fsManager = $fsManager;
|
||||
$this->query = $query;
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
namespace App\Core\Twig\Extension;
|
||||
|
||||
use App\Core\String\StringBuilder;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\Environment;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class GrapesJsExtension extends AbstractExtension
|
||||
{
|
||||
|
|
|
@ -164,8 +164,8 @@ class RoutingExtension extends AbstractExtension
|
|||
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
|
||||
);
|
||||
|
||||
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 &&
|
||||
(!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
|
||||
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2
|
||||
&& (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
|
||||
) {
|
||||
return ['html'];
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Core\Twig\Extension;
|
||||
|
||||
use App\Core\Setting\SettingManager;
|
||||
use App\Core\Setting\NavigationSettingManager;
|
||||
use App\Core\Setting\SettingManager;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
namespace App\Core\Twig\Extension;
|
||||
|
||||
use App\Core\Site\SiteRequest;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use App\Core\String\UrlBuilder;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use App\Core\String\UrlBuilder;
|
||||
|
||||
class UrlExtension extends AbstractExtension
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue