Skip to content

Commit

Permalink
Merge branch '1.12.x'
Browse files Browse the repository at this point in the history
* 1.12.x:
  Add number-aware underscore naming strategy
  Use XMLBundle in container tests
  [DoctrineDataCollector] Handle runnable flag
  Fix deprecation failures around doctrine:mapping:import command
  Deprecated alias for common interfaces
  • Loading branch information
alcaeus committed Nov 19, 2019
2 parents f4262c8 + a374f3b commit 8282627
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 13 deletions.
2 changes: 2 additions & 0 deletions DataCollector/DoctrineDataCollector.php
Expand Up @@ -137,6 +137,8 @@ public function collect(Request $request, Response $response, Throwable $excepti
foreach ($this->data['queries'] as &$queries) {
foreach ($queries as &$query) {
$query['params'] = $this->cloneVar($query['params']);
// To be removed when the required minimum version of symfony/doctrine-bridge is >= 4.4
$query['runnable'] = $query['runnable'] ?? true;
}
}

Expand Down
4 changes: 4 additions & 0 deletions Resources/config/orm.xml
Expand Up @@ -137,6 +137,10 @@
<!-- naming strategy -->
<service id="doctrine.orm.naming_strategy.default" class="%doctrine.orm.naming_strategy.default.class%" public="false" />
<service id="doctrine.orm.naming_strategy.underscore" class="%doctrine.orm.naming_strategy.underscore.class%" public="false" />
<service id="doctrine.orm.naming_strategy.underscore_number_aware" class="%doctrine.orm.naming_strategy.underscore.class%" public="false">
<argument type="constant">CASE_LOWER</argument>
<argument>true</argument>
</service>

<!-- quote strategy -->
<service id="doctrine.orm.quote_strategy.default" class="%doctrine.orm.quote_strategy.default.class%" public="false" />
Expand Down
15 changes: 9 additions & 6 deletions Resources/views/Collector/db.html.twig
Expand Up @@ -246,9 +246,10 @@
<div class="text-small font-normal">
<a href="#" {{ profiler_markup_version == 1 ? 'onclick="return toggleRunnableQuery(this);"' }} class="sf-toggle link-inverse" data-toggle-selector="#formatted-query-{{ i }}-{{ loop.parent.loop.index }}" data-toggle-alt-content="Hide formatted query">View formatted query</a>

&nbsp;&nbsp;

<a href="#" {{ profiler_markup_version == 1 ? 'onclick="return toggleRunnableQuery(this);"' }} class="sf-toggle link-inverse" data-toggle-selector="#original-query-{{ i }}-{{ loop.parent.loop.index }}" data-toggle-alt-content="Hide runnable query">View runnable query</a>
{% if query.runnable %}
&nbsp;&nbsp;
<a href="#" {{ profiler_markup_version == 1 ? 'onclick="return toggleRunnableQuery(this);"' }} class="sf-toggle link-inverse" data-toggle-selector="#original-query-{{ i }}-{{ loop.parent.loop.index }}" data-toggle-alt-content="Hide runnable query">View runnable query</a>
{% endif %}

{% if query.explainable %}
&nbsp;&nbsp;
Expand All @@ -265,9 +266,11 @@
{{ query.sql|doctrine_pretty_query }}
</div>

<div id="original-query-{{ i }}-{{ loop.parent.loop.index }}" class="sql-runnable hidden">
{{ (query.sql ~ ';')|doctrine_replace_query_parameters(query.params)|doctrine_pretty_query(highlight_only = true) }}
</div>
{% if query.runnable %}
<div id="original-query-{{ i }}-{{ loop.parent.loop.index }}" class="sql-runnable hidden">
{{ (query.sql ~ ';')|doctrine_replace_query_parameters(query.params)|doctrine_pretty_query(highlight_only = true) }}
</div>
{% endif %}

{% if query.explainable %}
<div id="explain-{{ i }}-{{ loop.parent.loop.index }}" class="sql-explain"></div>
Expand Down
3 changes: 3 additions & 0 deletions Tests/Command/ImportMappingDoctrineCommandTest.php
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Kernel;

/**
* @group legacy
*/
class ImportMappingDoctrineCommandTest extends TestCase
{
/** @var ImportMappingTestingKernel|null */
Expand Down
2 changes: 1 addition & 1 deletion Tests/ContainerTest.php
Expand Up @@ -35,7 +35,7 @@ protected function setUp()

public function testContainer()
{
$container = $this->createYamlBundleTestContainer();
$container = $this->createXmlBundleTestContainer();

$this->assertInstanceOf(DbalLogger::class, $container->get('doctrine.dbal.logger'));
$this->assertInstanceOf(DoctrineDataCollector::class, $container->get('data_collector.doctrine'));
Expand Down
12 changes: 6 additions & 6 deletions Tests/TestCase.php
Expand Up @@ -25,12 +25,12 @@ protected function setUp()
$this->markTestSkipped('Doctrine is not available.');
}

public function createYamlBundleTestContainer()
public function createXmlBundleTestContainer()
{
$container = new ContainerBuilder(new ParameterBag([
'kernel.name' => 'app',
'kernel.debug' => false,
'kernel.bundles' => ['YamlBundle' => 'Fixtures\Bundles\YamlBundle\YamlBundle'],
'kernel.bundles' => ['XmlBundle' => 'Fixtures\Bundles\XmlBundle\XmlBundle'],
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
Expand Down Expand Up @@ -62,10 +62,10 @@ public function createYamlBundleTestContainer()
'entity_managers' => [
'default' => [
'mappings' => [
'YamlBundle' => [
'type' => 'yml',
'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine',
'prefix' => 'Fixtures\Bundles\YamlBundle\Entity',
'XmlBundle' => [
'type' => 'xml',
'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine',
'prefix' => 'Fixtures\Bundles\XmlBundle\Entity',
],
],
],
Expand Down
6 changes: 6 additions & 0 deletions UPGRADE-1.12.md
Expand Up @@ -9,3 +9,9 @@ configuring caches through it has been deprecated. If you are using anything
other than the `pool` or `id` cache types, please update your configuration to
either use symfony/cache through the `pool` type or configure your cache
services manually and use the `service` type.

Service aliases
---------------

* Deprecated the `Symfony\Bridge\Doctrine\RegistryInterface` and `Doctrine\Bundle\DoctrineBundle\Registry` service alias, use `Doctrine\Common\Persistence\ManagerRegistry` instead.
* Deprecated the `Doctrine\Common\Persistence\ObjectManager` service alias, use `Doctrine\ORM\EntityManagerInterface` instead.

0 comments on commit 8282627

Please sign in to comment.