backports murph-skeleton
This commit is contained in:
parent
6c205e7d67
commit
27461c6245
|
@ -7,6 +7,8 @@ use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\BufferedOutput;
|
use Symfony\Component\Console\Output\BufferedOutput;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class SymfonyCacheManager.
|
* class SymfonyCacheManager.
|
||||||
|
@ -16,10 +18,14 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
class SymfonyCacheManager
|
class SymfonyCacheManager
|
||||||
{
|
{
|
||||||
protected KernelInterface $kernel;
|
protected KernelInterface $kernel;
|
||||||
|
protected HttpClientInterface $httpClient;
|
||||||
|
protected UrlGeneratorInterface $urlGenerator;
|
||||||
|
|
||||||
public function __construct(KernelInterface $kernel)
|
public function __construct(KernelInterface $kernel, HttpClientInterface $httpClient, UrlGeneratorInterface $urlGenerator)
|
||||||
{
|
{
|
||||||
$this->kernel = $kernel;
|
$this->kernel = $kernel;
|
||||||
|
$this->httpClient = $httpClient;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cleanRouting()
|
public function cleanRouting()
|
||||||
|
@ -31,9 +37,14 @@ class SymfonyCacheManager
|
||||||
->name('url_*.php*')
|
->name('url_*.php*')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
$pingUrl = $this->urlGenerator->generate('_ping', [], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
unlink((string) $file->getPathname());
|
unlink((string) $file->getPathname());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hack: used to regenerate cache of url generator
|
||||||
|
$this->httpClient->request('POST', $pingUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cleanAll()
|
public function cleanAll()
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Core\Controller\Admin;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
abstract class AdminController extends AbstractController
|
abstract class AdminController extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -28,4 +29,12 @@ abstract class AdminController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getSection(): string;
|
abstract protected function getSection(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/_ping", name="_ping")
|
||||||
|
*/
|
||||||
|
public function ping()
|
||||||
|
{
|
||||||
|
return $this->json(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class NodeAdminController extends AdminController
|
||||||
$pageLocator
|
$pageLocator
|
||||||
);
|
);
|
||||||
|
|
||||||
$entityManager->update($entity);
|
$entityManager->create($entity);
|
||||||
|
|
||||||
$this->addFlash('success', 'The data has been saved.');
|
$this->addFlash('success', 'The data has been saved.');
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,11 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
|
||||||
return $entity instanceof Node;
|
return $entity instanceof Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onPreCreate(EntityManagerEvent $event)
|
||||||
|
{
|
||||||
|
return $this->onPreUpdate($event);
|
||||||
|
}
|
||||||
|
|
||||||
public function onPreUpdate(EntityManagerEvent $event)
|
public function onPreUpdate(EntityManagerEvent $event)
|
||||||
{
|
{
|
||||||
if (!$this->support($event->getEntity())) {
|
if (!$this->support($event->getEntity())) {
|
||||||
|
|
|
@ -115,7 +115,6 @@ class SiteRouteLoader extends Loader
|
||||||
}
|
}
|
||||||
|
|
||||||
$route = new Route($url, $defaults, $requirements, [], $host);
|
$route = new Route($url, $defaults, $requirements, [], $host);
|
||||||
//$route->setHost($navigation->getDomain());
|
|
||||||
|
|
||||||
$routes->add($node->getRouteName(), $route);
|
$routes->add($node->getRouteName(), $route);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue