Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b1c03a

Browse files
Merge branch '4.0'
* 4.0: Fix tests PropertyInfo\DoctrineExtractor - There is bug when indexBy is meta key Fix PercentType error rendering. [minor] SCA [Cache] Inline some hot function calls fixed Silex project's URL fixed deprecations in tests fixed Twig URL [Cache] Add missing `@internal` tag on ProxyTrait fix formatting arguments in plaintext format Fix PSR exception context key Don't assume that file binary exists on *nix OS Fix that ESI/SSI processing can turn a \"private\" response \"public\" [Form] Fixed trimming choice values fix rendering exception stack traces [Routing] Fix loading multiple class annotations for invokable classes
2 parents 48f0afc + 6d9d329 commit 1b1c03a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+433
-122
lines changed

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,19 @@ public function getTypes($class, $property, array $context = array())
9595

9696
if (isset($associationMapping['indexBy'])) {
9797
$indexProperty = $associationMapping['indexBy'];
98+
/** @var ClassMetadataInfo $subMetadata */
9899
$subMetadata = $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
99100
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
100101

102+
if (null === $typeOfField) {
103+
$associationMapping = $subMetadata->getAssociationMapping($indexProperty);
104+
105+
/** @var ClassMetadataInfo $subMetadata */
106+
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
107+
$subMetadata = $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
108+
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
109+
}
110+
101111
$collectionKeyType = $this->getPhpType($typeOfField);
102112
}
103113
}

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function testGetProperties()
6161
'foo',
6262
'bar',
6363
'indexedBar',
64+
'indexedFoo',
6465
),
6566
$this->extractor->getProperties('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy')
6667
);
@@ -141,6 +142,14 @@ public function typesProvider()
141142
new Type(Type::BUILTIN_TYPE_STRING),
142143
new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation')
143144
))),
145+
array('indexedFoo', array(new Type(
146+
Type::BUILTIN_TYPE_OBJECT,
147+
false,
148+
'Doctrine\Common\Collections\Collection',
149+
true,
150+
new Type(Type::BUILTIN_TYPE_STRING),
151+
new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation')
152+
))),
144153
array('simpleArray', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)))),
145154
array('customFoo', null),
146155
array('notMapped', null),

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\ORM\Mapping\Column;
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
17+
use Doctrine\ORM\Mapping\OneToMany;
1718
use Doctrine\ORM\Mapping\ManyToMany;
1819
use Doctrine\ORM\Mapping\ManyToOne;
1920

@@ -45,6 +46,11 @@ class DoctrineDummy
4546
*/
4647
protected $indexedBar;
4748

49+
/**
50+
* @OneToMany(targetEntity="DoctrineRelation", mappedBy="foo", indexBy="foo")
51+
*/
52+
protected $indexedFoo;
53+
4854
/**
4955
* @Column(type="guid")
5056
*/

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\ORM\Mapping\Column;
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
17+
use Doctrine\ORM\Mapping\ManyToOne;
1718

1819
/**
1920
* @Entity
@@ -32,4 +33,10 @@ class DoctrineRelation
3233
* @Column(type="guid")
3334
*/
3435
protected $rguid;
36+
37+
/**
38+
* @Column(type="guid")
39+
* @ManyToOne(targetEntity="DoctrineDummy", inversedBy="indexedFoo")
40+
*/
41+
protected $foo;
3542
}

src/Symfony/Bridge/Twig/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Twig Bridge
22
===========
33

4-
Provides integration for [Twig](http://twig.sensiolabs.org/) with various
4+
Provides integration for [Twig](https://twig.symfony.com/) with various
55
Symfony components.
66

77
Resources

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@
106106
{%- endblock dateinterval_widget %}
107107

108108
{% block percent_widget -%}
109-
<div class="input-group{{ not valid ? ' form-control is-invalid' }}">
110-
{% set valid = true %}
109+
<div class="input-group">
111110
{{- block('form_widget_simple') -}}
112111
<div class="input-group-append">
113112
<span class="input-group-text">%</span>

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ private function findTemplatesInFolder($dir)
9797
private function findTemplatesInBundle(BundleInterface $bundle)
9898
{
9999
$name = $bundle->getName();
100-
$templates = array_merge(
100+
$templates = array_unique(array_merge(
101101
$this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
102102
$this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
103-
);
104-
$templates = array_unique($templates);
103+
));
105104

106105
foreach ($templates as $i => $template) {
107106
$templates[$i] = $template->set('bundle', $name);

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function formatFile($file, $line, $text = null)
157157
$file = trim($file);
158158
$fileStr = $file;
159159
if (0 === strpos($fileStr, $this->rootDir)) {
160-
$fileStr = str_replace($this->rootDir, '', str_replace('\\', '/', $fileStr));
160+
$fileStr = str_replace(array('\\', $this->rootDir), array('/', ''), $fileStr);
161161
$fileStr = htmlspecialchars($fileStr, $flags, $this->charset);
162162
$fileStr = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', htmlspecialchars($this->rootDir, $flags, $this->charset), $fileStr);
163163
}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.txt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if trace.function %}
2-
at {{ trace.class ~ trace.type ~ trace.function }}({{ trace.args|format_args }})
2+
at {{ trace.class ~ trace.type ~ trace.function }}({{ trace.args|format_args_as_text }})
33
{%- endif -%}
44
{% if trace.file|default('') is not empty and trace.line|default('') is not empty %}
55
{{- trace.function ? '\n (' : 'at '}}{{ trace.file|format_file(trace.line)|striptags|replace({ (' at line ' ~ trace.line): '' }) }}:{{ trace.line }}{{ trace.function ? ')' }}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{% if exception.trace|length %}
2-
<pre class="stacktrace">
32
{{ exception.class }}:
43
{% if exception.message is not empty %}
54
{{- exception.message }}
@@ -8,5 +7,4 @@
87
{% for trace in exception.trace %}
98
{{ include('@Twig/Exception/trace.txt.twig', { trace: trace }, with_context = false) }}
109
{% endfor %}
11-
</pre>
1210
{% endif %}

0 commit comments

Comments
 (0)