diff --git a/Controller/PanelController.php b/Controller/PanelController.php index 25fb16bd..221ec0c7 100644 --- a/Controller/PanelController.php +++ b/Controller/PanelController.php @@ -9,34 +9,43 @@ */ namespace Propel\Bundle\PropelBundle\Controller; -use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\HttpFoundation\Response; +use Psr\Container\ContainerInterface; +use Twig\Environment; /** * PanelController is designed to display information in the Propel Panel. * * @author William DURAND */ -class PanelController extends ContainerAware +class PanelController { + use ContainerAwareTrait; + + private $twig; + + public function __construct(ContainerInterface $container, Environment $twig) + { + $this->container = $container; + $this->twig = $twig; + } + /** * This method renders the global Propel configuration. */ public function configurationAction() { - $templating = $this->container->get('templating'); + $configuration = $this->container->get('propel.configuration')->getParameters(); - return $templating->renderResponse( - 'PropelBundle:Panel:configuration.html.twig', - array( - 'propel_version' => \Propel::VERSION, - 'configuration' => $this->container->get('propel.configuration')->getParameters(), - 'default_connection' => $this->container->getParameter('propel.dbal.default_connection'), - 'logging' => $this->container->getParameter('propel.logging'), - 'path' => $this->container->getParameter('propel.path'), - 'phing_path' => $this->container->getParameter('propel.phing_path'), - ) - ); + return new Response($this->twig->render('@Propel/Panel/configuration.html.twig', array( + 'propel_version' => \Propel::VERSION, + 'configuration' => $configuration, + 'default_connection' => $this->container->getParameter('propel.dbal.default_connection'), + 'logging' => $this->container->getParameter('propel.logging'), + 'path' => $this->container->getParameter('propel.path'), + 'phing_path' => $this->container->getParameter('propel.phing_path'), + ))); } /** @@ -73,8 +82,8 @@ public function explainAction($token, $connection, $query) return new Response('
This query cannot be explained.
'); } - return $this->container->get('templating')->renderResponse( - 'PropelBundle:Panel:explain.html.twig', + return $this->twig->render( + '@Propel/Panel/explain.html.twig', array( 'data' => $results, 'query' => $query, diff --git a/DataCollector/PropelDataCollector.php b/DataCollector/PropelDataCollector.php index e4e49c22..aa1df7c1 100644 --- a/DataCollector/PropelDataCollector.php +++ b/DataCollector/PropelDataCollector.php @@ -52,7 +52,7 @@ public function __construct(PropelLogger $logger, \PropelConfiguration $propelCo /** * {@inheritdoc} */ - public function collect(Request $request, Response $response, \Exception $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null) { $this->data = array( 'queries' => $this->buildQueries(), diff --git a/DataFixtures/Loader/AbstractDataLoader.php b/DataFixtures/Loader/AbstractDataLoader.php index 3e249b59..69e3c2d9 100644 --- a/DataFixtures/Loader/AbstractDataLoader.php +++ b/DataFixtures/Loader/AbstractDataLoader.php @@ -45,7 +45,7 @@ abstract protected function transformDataToArray($file); /** * {@inheritdoc} */ - public function load($files = array(), $connectionName) + public function load($files = array(), $connectionName = null) { $nbFiles = 0; $this->deletedClasses = array(); diff --git a/DataFixtures/Loader/DataLoaderInterface.php b/DataFixtures/Loader/DataLoaderInterface.php index 3c99496d..cea44709 100644 --- a/DataFixtures/Loader/DataLoaderInterface.php +++ b/DataFixtures/Loader/DataLoaderInterface.php @@ -22,5 +22,5 @@ interface DataLoaderInterface * @param array $files A set of files containing datas to load. * @param string $connectionName The Propel connection name */ - public function load($files = array(), $connectionName); + public function load($files = array(), $connectionName = null); } diff --git a/DataFixtures/Loader/DataWiper.php b/DataFixtures/Loader/DataWiper.php index ff5435cf..64958b26 100644 --- a/DataFixtures/Loader/DataWiper.php +++ b/DataFixtures/Loader/DataWiper.php @@ -20,7 +20,7 @@ class DataWiper extends AbstractDataLoader * @param array $files A set of files containing datas to load. * @param string $connectionName The Propel connection name */ - public function load($files = array(), $connectionName) + public function load($files = array(), $connectionName = null) { $this->deletedClasses = array(); $this->loadMapBuilders($connectionName); diff --git a/Resources/views/Collector/propel.html.twig b/Resources/views/Collector/propel.html.twig index 2e988547..36d7f73d 100644 --- a/Resources/views/Collector/propel.html.twig +++ b/Resources/views/Collector/propel.html.twig @@ -1,4 +1,4 @@ -{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} +{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% block toolbar %} {% if collector.querycount %} @@ -14,7 +14,7 @@ {% set text %}{% endset %} - {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { link: profiler_url } %} + {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { link: profiler_url } %} {% endif %} {% endblock %} @@ -73,33 +73,33 @@ No queries. {% else %} {% for i, query in collector.queries %} - - - - {{ query.sql|format_sql }} - {% if app.request.query.has('query') and app.request.query.get('query') == i %} -
- {% render controller('PropelBundle:Panel:explain', { - 'token': token, - 'panel': 'propel', - 'query': app.request.query.get('query'), - 'connection': app.request.query.get('connection') - }) %} -
- {% endif %} -
- Time: {{ query.time }} - Memory: {{ query.memory }} - Connection: {{ query.connection }} - - {% if app.request.query.get('query', -1) != i %} - - Explain the query + + + + {{ query.sql|format_sql }} + {% if app.request.query.has('query') and app.request.query.get('query') == i %} +
+ {{ render(controller('PropelBundle:Panel:explain', { + 'token': token, + 'panel': 'propel', + 'query': app.request.query.get('query'), + 'connection': app.request.query.get('connection') + })) }} +
{% endif %} -
- - +
+ Time: {{ query.time }} - Memory: {{ query.memory }} - Connection: {{ query.connection }} + + {% if app.request.query.get('query', -1) != i %} + - Explain the query + {% endif %} +
+ + {% endfor %} {% endif %} - {% render controller('PropelBundle:Panel:configuration') %} + {{ render(controller('PropelBundle:Panel:configuration')) }} {% endblock %} diff --git a/Resources/views/Panel/configuration.html.twig b/Resources/views/Panel/configuration.html.twig index e0b2bd0f..2379e21b 100644 --- a/Resources/views/Panel/configuration.html.twig +++ b/Resources/views/Panel/configuration.html.twig @@ -11,6 +11,8 @@ Default connection {{ default_connection }} + + Logging {{ logging ? 'enabled' : 'disabled' }} @@ -57,7 +59,7 @@ @@ -67,7 +69,7 @@ diff --git a/Tests/Command/FixturesLoadCommandTest.php b/Tests/Command/FixturesLoadCommandTest.php index 0e67e1be..ba2fb7e2 100644 --- a/Tests/Command/FixturesLoadCommandTest.php +++ b/Tests/Command/FixturesLoadCommandTest.php @@ -19,6 +19,9 @@ class FixturesLoadCommandTest extends TestCase { protected $command; + protected $fixturesDir; + protected $fixturesFiles; + protected $filesystem; public function setUp(): void { diff --git a/Tests/DataFixtures/Dumper/YamlDataDumperTest.php b/Tests/DataFixtures/Dumper/YamlDataDumperTest.php index dfe1dc61..662ab8be 100644 --- a/Tests/DataFixtures/Dumper/YamlDataDumperTest.php +++ b/Tests/DataFixtures/Dumper/YamlDataDumperTest.php @@ -42,11 +42,11 @@ public function testYamlDump() $expected = <<query->getTableMap()->getColumn($this->getColumnname($identifier))->getPhpName(); } + public function __serialize() + { + return $this->serialize(); + } + /** * {@inheritdoc} */ @@ -249,6 +254,11 @@ public function serialize() )); } + public function __unserialize($serialized) + { + return $this->unserialize($serialized); + } + /** * {@inheritdoc} */ diff --git a/Util/PropelInflector.php b/Util/PropelInflector.php index 5a1ffc6e..fbcad184 100644 --- a/Util/PropelInflector.php +++ b/Util/PropelInflector.php @@ -25,6 +25,6 @@ class PropelInflector */ public static function camelize($word) { - return lcfirst(str_replace(" ", "", ucwords(strtr($word, "_-", " ")))); + return lcfirst(str_replace(" ", "", ucwords(strtr($word ?? '', "_-", " ")))); } } diff --git a/autoload_aliases.php b/autoload_aliases.php index 99abadc6..84caf987 100644 --- a/autoload_aliases.php +++ b/autoload_aliases.php @@ -6,4 +6,4 @@ class_alias(str_replace('Propel\PropelBundle', 'Propel\Bundle\PropelBundle', $cl } } -spl_autoload_register('autoload_propel_aliases', false, true); +spl_autoload_register('autoload_propel_aliases', true, true); diff --git a/composer.json b/composer.json index cba363fb..2bac06c9 100644 --- a/composer.json +++ b/composer.json @@ -16,15 +16,15 @@ }, "require": { - "php": "^7.2", - "propel/propel1": "^1.6", - "symfony/framework-bundle": "^3.0|^4.0", - "symfony/symfony": "^4.0" + "php": "^7.2|^8.3", + "propel/propel1": "1.6.19|dev-symfony-5", + "symfony/framework-bundle": "^3.0|^4.0|^5.0", + "symfony/symfony": "^4.0|^5.0" }, "require-dev": { "ext-sqlite3": "*", - "sensio/framework-extra-bundle": "^4.0", - "fzaninotto/faker": "^1.5", + "sensio/framework-extra-bundle": "^4.0|^5.0", + "fakerphp/faker": "^1.5", "phpunit/phpunit": "^8.5.27", "symfony/phpunit-bridge": "^6" }, @@ -38,5 +38,12 @@ }, "suggest": { "propel/propel-acl-bundle": "For using the Propel ACL implementation" - } + }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/CrossKnowledge/Propel.git", + "packagist.org": false + } + ] }