8000 Merge branch '2.5' into 2.6 · symfony/symfony@f31f5a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit f31f5a9

Browse files
committed
Merge branch '2.5' into 2.6
* 2.5: [Bridge] [Propel] minor improvements to the Propel bridge. [FrameworkBundle] Allow custom services for validator mapping cache.
2 parents c90edd9 + 0ec80c6 commit f31f5a9

File tree

15 files changed

+83
-67
lines changed

15 files changed

+83
-67
lines changed

src/Symfony/Bridge/Propel1/DataCollector/PropelDataCollector.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PropelDataCollector extends DataCollector
2626
/**
2727
* Propel logger.
2828
*
29-
* @var \Symfony\Bridge\Propel1\Logger\PropelLogger
29+
* @var PropelLogger
3030
*/
3131
private $logger;
3232

@@ -63,17 +63,17 @@ public function collect(Request $request, Response $response, \Exception $except
6363
/**
6464
* Returns the collector name.
6565
*
66-
* @return string The collector name.
66+
* @return string
6767
*/
6868
public function getName()
6969
{
7070
return 'propel';
7171
}
7272

7373
/**
74-
* Returns queries.
74+
* Returns the collected stats for all executed SQL queries.
7575
*
76-
* @return array Queries
76+
* @return array
7777
*/
7878
public function getQueries()
7979
{
@@ -83,17 +83,17 @@ public function getQueries()
8383
/**
8484
* Returns the query count.
8585
*
86-
* @return int The query count
86+
* @return int
8787
*/
8888
public function getQueryCount()
8989
{
9090
return $this->data['querycount'];
9191
}
9292

9393
/**
94-
* Returns the total time of queries.
94+
* Returns the total time spent on running all queries.
9595
*
96-
* @return float The total time of queries
96+
* @return float
9797
*/
9898
public function getTime()
9999
{
@@ -106,9 +106,9 @@ public function getTime()
106106
}
107107

108108
/**
109-
* Creates an array of Build objects.
109+
* Computes the stats of all executed SQL queries.
110110
*
111-
* @return array An array of Build objects
111+
* @return array
112112
*/
113113
private function buildQueries()
114114
{
@@ -136,9 +136,9 @@ private function buildQueries()
136136
}
137137

138138
/**
139-
* Count queries.
139+
* Returns the total count of SQL queries.
140140
*
141-
* @return int The number of queries.
141+
* @return int
142142
*/
143143
private function countQueries()
144144
{

src/Symfony/Bridge/Propel1/DependencyInjection/Security/UserProvider/PropelFactory.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class PropelFactory implements UserProviderFactoryInterface
2626
private $key;
2727
private $providerId;
2828

29+
/**
30+
* Constructor.
31+
*
32+
* @param string $key
33+
* @param string $providerId
34+
*/
2935
public function __construct($key, $providerId)
3036
{
3137
$this->key = $key;
@@ -38,7 +44,7 @@ public function create(ContainerBuilder $container, $id, $config)
3844
->setDefinition($id, new DefinitionDecorator($this->providerId))
3945
->addArgument($config['class'])
4046
->addArgument($config['property'])
41-
;
47+
;
4248
}
4349

4450
public function getKey()
@@ -50,9 +56,14 @@ public function addConfiguration(NodeDefinition $node)
5056
{
5157
$node
5258
->children()
53-
->scalarNode('class')->isRequired()->cannotBeEmpty()->end()
54-
->scalarNode('property')->defaultNull()->end()
59+
->scalarNode('class')
60+
->isRequired()
61+
->cannotBeEmpty()
62+
->end()
63+
->scalarNode('property')
64+
->defaultNull()
65+
->end()
5566
->end()
56-
;
67+
;
5768
}
5869
}

src/Symfony/Bridge/Propel1/Form/Type/ModelType.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,29 @@ class ModelType extends AbstractType
5555
*/
5656
private $propertyAccessor;
5757

58+
/**
59+
* Constructor.
60+
*
61+
* @param PropertyAccessorInterface|null $propertyAccessor
62+
*/
5863
public function __construct(PropertyAccessorInterface $propertyAccessor = null)
5964
{
6065
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
6166
}
6267

68+
/**
69+
* {@inheritdoc}
70+
*/
6371
public function buildForm(FormBuilderInterface $builder, array $options)
6472
{
6573
if ($options['multiple']) {
6674
$builder->addViewTransformer(new CollectionToArrayTransformer(), true);
6775
}
6876
}
6977

78+
/**
79+
* {@inheritdoc}
80+
*/
7081
public function setDefaultOptions(OptionsResolverInterface $resolver)
7182
{
7283
$propertyAccessor = $this->propertyAccessor;
@@ -99,11 +110,17 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
99110
));
100111
}
101112

113+
/**
114+
* {@inheritdoc}
115+
*/
102116
public function getParent()
103117
{
104118
return 'choice';
105119
}
106120

121+
/**
122+
* {@inheritdoc}
123+
*/
107124
public function getName()
108125
{
109126
return 'model';

src/Symfony/Bridge/Propel1/Form/Type/TranslationCollectionType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4040
$builder->addEventSubscriber($listener);
4141
}
4242

43+
/**
44+
* {@inheritdoc}
45+
*/
4346
public function getParent()
4447
{
4548
return 'collection';

src/Symfony/Bridge/Propel1/Tests/DataCollector/PropelDataCollectorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,19 @@ public function testCollectWithMultipleData()
8585
private function createCollector($queries)
8686
{
8787
$config = $this->getMock('\PropelConfiguration');
88+
8889
$config
8990
->expects($this->any())
9091
->method('getParameter')
9192
->will($this->returnArgument(1))
92-
;
93+
;
9394

9495
$logger = $this->getMock('\Symfony\Bridge\Propel1\Logger\PropelLogger');
9596
$logger
9697
->expects($this->any())
9798
->method('getQueries')
9899
->will($this->returnValue($queries))
99-
;
100+
;
100101

101102
return new PropelDataCollector($logger, $config);
102103
}

src/Symfony/Bridge/Propel1/Tests/Fixtures/Column.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
class Column extends \ColumnMap
1515
{
1616
private $name;
17-
18-
protected $type;
17+
private $type;
1918

2019
public function __construct($name, $type)
2120
{
@@ -36,13 +35,13 @@ public function isText()
3635
}
3736

3837
switch ($this->type) {
39-
case \PropelColumnTypes::CHAR:
40-
case \PropelColumnTypes::VARCHAR:
41-
case \PropelColumnTypes::LONGVARCHAR:
42-
case \PropelColumnTypes::BLOB:
43-
case \PropelColumnTypes::CLOB:
44-
case \PropelColumnTypes::CLOB_EMU:
45-
return true;
38+
case \PropelColumnTypes::CHAR:
39+
case \PropelColumnTypes::VARCHAR:
40+
case \PropelColumnTypes::LONGVARCHAR:
41+
case \PropelColumnTypes::BLOB:
42+
case \PropelColumnTypes::CLOB:
43+
case \PropelColumnTypes::CLOB_EMU:
44+
return true;
4645
}
4746

4847
return false;
@@ -55,6 +54,6 @@ public function getSize()
5554

5655
public function isNotNull()
5756
{
58-
return ('id' === $this->name);
57+
return 'id' === $this->name;
5958
}
6059
}

src/Symfony/Bridge/Propel1/Tests/Fixtures/Item.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@
1111

1212
namespace Symfony\Bridge\Propel1\Tests\Fixtures;
1313

14-
use PropelPDO;
15-
1614
class Item implements \Persistent
1715
{
1816
private $id;
19-
2017
private $value;
21-
2218
private $groupName;
23-
2419
private $price;
2520

2621
private $slug;
@@ -106,11 +101,11 @@ public function setDeleted($b)
106101
{
107102
}
108103

109-
public function delete(PropelPDO $con = null)
104+
public function delete(\PropelPDO $con = null)
110105
{
111106
}
112107

113-
public function save(PropelPDO $con = null)
108+
public function save(\PropelPDO $con = null)
114109
{
115110
}
116111
}

src/Symfony/Bridge/Propel1/Tests/Fixtures/TranslatableItem.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@
1111

1212
namespace Symfony\Bridge\Propel1\Tests\Fixtures;
1313

14-
use PropelPDO;
15-
1614
class TranslatableItem implements \Persistent
1715
{
1816
private $id;
19-
2017
private $currentTranslations;
21-
2218
private $groupName;
23-
2419
private $price;
2520

2621
public function __construct($id = null, $translations = array())
@@ -91,15 +86,15 @@ public function setDeleted($b)
9186
{
9287
}
9388

94-
public function delete(PropelPDO $con = null)
89+
public function delete(\PropelPDO $con = null)
9590
{
9691
}
9792

98-
public function save(PropelPDO $con = null)
93+
public function save(\PropelPDO $con = null)
9994
{
10095
}
10196

102-
public function getTranslation($locale = 'de', PropelPDO $con = null)
97+
public function getTranslation($locale = 'de', \PropelPDO $con = null)
10398
{
10499
if (!isset($this->currentTranslations[$locale])) {
105100
$translation = new TranslatableItemI18n();

src/Symfony/Bridge/Propel1/Tests/Fixtures/TranslatableItemI18n.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,12 @@
1111

1212
namespace Symfony\Bridge\Propel1\Tests\Fixtures;
1313

14-
use PropelPDO;
15-
1614
class TranslatableItemI18n implements \Persistent
1715
{
1816
private $id;
19-
2017
private $locale;
21-
2218
private $value;
23-
2419
private $value2;
25-
2620
private $item;
2721

2822
public function __construct($id = null, $locale = null, $value = null)
@@ -84,11 +78,11 @@ public function setDeleted($b)
8478
{
8579
}
8680

87-
public function delete(PropelPDO $con = null)
81+
public function delete(\PropelPDO $con = null)
8882
{
8983
}
9084

91-
public function save(PropelPDO $con = null)
85+
public function save(\PropelPDO $con = null)
9286
{
9387
}
9488

src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ public function testDontAllowInvalidChoiceValues()
249249
*/
250250
public function testEmptyClass()
251251
{
252-
$choiceList = new ModelChoiceList('');
252+
new ModelChoiceList('');
253253
}
254254

255255
/**
256256
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
257257
*/
258258
public 1082A function testInvalidClass()
259259
{
260-
$choiceList = new ModelChoiceList('Foo\Bar\DoesNotExistClass');
260+
new ModelChoiceList('Foo\Bar\DoesNotExistClass');
261261
}
262262

263263
public function testCustomIdentifier()

src/Symfony/Bridge/Propel1/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Propel1\Tests\Form\DataTransformer;
1313

14-
use PropelObjectCollection;
1514
use Symfony\Bridge\Propel1\Form\DataTransformer\CollectionToArrayTransformer;
1615
use Symfony\Bridge\Propel1\Tests\Propel1TestCase;
1716

@@ -26,7 +25,7 @@ protected function setUp()
2625

2726
public function testTransform()
2827
{
29-
$result = $this->transformer->transform(new PropelObjectCollection());
28+
$result = $this->transformer->transform(new \PropelObjectCollection());
3029

3130
$this->assertTrue(is_array($result));
3231
$this->assertCount(0, $result);
@@ -50,7 +49,7 @@ public function testTransformThrowsExceptionIfNotPropelObjectCollection()
5049

5150
public function testTransformWithData()
5251
{
53-
$coll = new PropelObjectCollection();
52+
$coll = new \PropelObjectCollection();
5453
$coll->setData(array('foo', 'bar'));
5554

5655
$result = $this->transformer->transform($coll);

0 commit comments

Comments
 (0)
0