Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e2a65c

Browse files
committed
Merge branch '2.4'
* 2.4: (35 commits) Update validators.ro.xlf add non-standard port to HTTP_HOST fixed attribute "source-language" for translations [Process] clarify idle timeout [Security] fix DI for SimpleFormAuthenticationListener Update PluralizationRules.php Update validators.pt_BR.xlf Translated remaining items (57-72) Updated Vietnamese translation allow null value in fragment handler added missing dot in translation updated Arabic translations Update validators.id.xlf [Validator] Translate validator messages into Brazilian Portuguese Added more Swedish validator translations Update validators.ca.xlf fixed typos in Welsh translation Added missing Croatian translations [Form] fixed allow render 0 and 0.0 numeric input values Fixed validators.nl.xlf ...Conflicts:src/Symfony/Bridge/Twig/composer.json
2 parents78d49fb +07de761 commit2e2a65c

File tree

60 files changed

+1128
-131
lines changed

Some content is hidden

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

60 files changed

+1128
-131
lines changed

‎.travis.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ services: mongodb
1515

1616
before_script:
1717
-sudo apt-get install parallel
18-
-sh -c 'if [$(php -r "echo (int) defined('HHVM_VERSION');") -eq 0]; then echo "" >>"~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"; fi;'
19-
-sh -c 'if [$(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
20-
-sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
21-
-sh -c 'if [$(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
22-
-sh -c 'if [$(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
18+
-sh -c 'if ["$TRAVIS_PHP_VERSION" != "hhvm"]; then echo "" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;'
19+
-sh -c 'if ["$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
20+
-sh -c 'if ["$TRAVIS_PHP_VERSION" != "hhvm" ] && [$(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
21+
-sh -c 'if ["$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
22+
-sh -c 'if ["$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
2323
-COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
2424

2525
script:

‎src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,18 @@ public function getEntitiesByIds($identifier, array $values)
8181
$parameter ='ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier;
8282
$where =$qb->expr()->in($alias.'.'.$identifier,':'.$parameter);
8383

84+
// Guess type
85+
$entity =current($qb->getRootEntities());
86+
$metadata =$qb->getEntityManager()->getClassMetadata($entity);
87+
if (in_array($metadata->getTypeOfField($identifier),array('integer','bigint','smallint'))) {
88+
$parameterType = Connection::PARAM_INT_ARRAY;
89+
}else {
90+
$parameterType = Connection::PARAM_STR_ARRAY;
91+
}
92+
8493
return$qb->andWhere($where)
8594
->getQuery()
86-
->setParameter($parameter,$values,Connection::PARAM_STR_ARRAY)
95+
->setParameter($parameter,$values,$parameterType)
8796
->getResult();
8897
}
8998
}

‎src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
namespaceSymfony\Bridge\Doctrine\Tests\Form\ChoiceList;
1313

1414
useSymfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
15+
useSymfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
16+
useDoctrine\DBAL\Connection;
1517

16-
class ORMQueryBuilderLoaderTestextends\PHPUnit_Framework_TestCase
18+
class ORMQueryBuilderLoaderTestextendsDoctrineOrmTestCase
1719
{
1820
/**
1921
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
@@ -32,4 +34,43 @@ public function testClosureRequiresTheEntityManager()
3234

3335
newORMQueryBuilderLoader($closure);
3436
}
37+
38+
publicfunctiontestIdentifierTypeIsStringArray()
39+
{
40+
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity', Connection::PARAM_STR_ARRAY);
41+
}
42+
43+
publicfunctiontestIdentifierTypeIsIntegerArray()
44+
{
45+
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', Connection::PARAM_INT_ARRAY);
46+
}
47+
48+
protectedfunctioncheckIdentifierType($classname,$expectedType)
49+
{
50+
$em =$this->createTestEntityManager();
51+
52+
$query =$this->getMockBuilder('QueryMock')
53+
->setMethods(array('setParameter','getResult','getSql','_doExecute'))
54+
->getMock();
55+
56+
$query->expects($this->once())
57+
->method('setParameter')
58+
->with('ORMQueryBuilderLoader_getEntitiesByIds_id',array(),$expectedType)
59+
->will($this->returnValue($query));
60+
61+
$qb =$this->getMockBuilder('Doctrine\ORM\QueryBuilder')
62+
->setConstructorArgs(array($em))
63+
->setMethods(array('getQuery'))
64+
->getMock();
65+
66+
$qb->expects($this->once())
67+
->method('getQuery')
68+
->will($this->returnValue($query));
69+
70+
$qb->select('e')
71+
->from($classname,'e');
72+
73+
$loader =newORMQueryBuilderLoader($qb);
74+
$loader->getEntitiesByIds('id',array());
75+
}
3576
}

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,23 @@ public function testAssociatedEntity()
330330
$this->assertEquals(1,$violationsList->count());
331331
}
332332

333+
publicfunctiontestAssociatedEntityWithNull()
334+
{
335+
$entityManagerName ="foo";
336+
$em = DoctrineTestHelper::createTestEntityManager();
337+
$this->createSchema($em);
338+
$validator =$this->createValidator($entityManagerName,$em,'Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity',array('single'),null,'findBy',false);
339+
340+
$associated =newAssociationEntity();
341+
$associated->single =null;
342+
343+
$em->persist($associated);
344+
$em->flush();
345+
346+
$violationsList =$validator->validate($associated);
347+
$this->assertEquals(0,$violationsList->count());
348+
}
349+
333350
/**
334351
* @group GH-1635
335352
*/

‎src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function validate($entity, Constraint $constraint)
8989
return;
9090
}
9191

92-
if ($class->hasAssociation($fieldName)) {
92+
if (null !==$criteria[$fieldName] &&$class->hasAssociation($fieldName)) {
9393
/* Ensure the Proxy is initialized before using reflection to
9494
* read its identifiers. This is necessary because the wrapped
9595
* getter methods in the Proxy are being bypassed.

‎src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getFunctions()
3030
);
3131
}
3232

33-
privatefunctioncreateExpression($expression)
33+
publicfunctioncreateExpression($expression)
3434
{
3535
returnnewExpression($expression);
3636
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Bridge\Twig\Tests\Extension;
13+
14+
useSymfony\Bridge\Twig\Extension\ExpressionExtension;
15+
useSymfony\Component\ExpressionLanguage\Expression;
16+
17+
class ExpressionExtensionTestextends \PHPUnit_Framework_TestCase
18+
{
19+
protected$helper;
20+
21+
publicfunctiontestExpressionCreation()
22+
{
23+
$template ="{{ expression('1 == 1') }}";
24+
$twig =new \Twig_Environment(new \Twig_Loader_String(),array('debug' =>true,'cache' =>false,'autoescape' =>true,'optimizations' =>0));
25+
$twig->addExtension(newExpressionExtension());
26+
27+
$output =$twig->render($template);
28+
$this->assertEquals('1 == 1',$output);
29+
}
30+
}

‎src/Symfony/Bridge/Twig/composer.json‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php":">=5.3.3",
2020
"symfony/security-csrf":"~2.4",
21-
"twig/twig":"~1.11"
21+
"twig/twig":"~1.12"
2222
},
2323
"require-dev": {
2424
"symfony/form":"~2.2",
@@ -29,7 +29,8 @@
2929
"symfony/yaml":"~2.0",
3030
"symfony/security":"~2.4",
3131
"symfony/stopwatch":"~2.2",
32-
"symfony/console":"~2.2"
32+
"symfony/console":"~2.2",
33+
"symfony/expression-language":"~2.4"
3334
},
3435
"suggest": {
3536
"symfony/form":"For using the FormExtension",
@@ -39,7 +40,8 @@
3940
"symfony/translation":"For using the TranslationExtension",
4041
"symfony/yaml":"For using the YamlExtension",
4142
"symfony/security":"For using the SecurityExtension",
42-
"symfony/stopwatch":"For using the StopwatchExtension"
43+
"symfony/stopwatch":"For using the StopwatchExtension",
44+
"symfony/expression":"For using the ExpressionExtension"
4345
},
4446
"autoload": {
4547
"psr-0": {"Symfony\\Bridge\\Twig\\":"" }

‎src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
useSymfony\Component\HttpFoundation\RedirectResponse;
1616
useSymfony\Component\HttpFoundation\Request;
1717
useSymfony\Component\HttpFoundation\Response;
18+
useSymfony\Component\HttpKernel\Exception\HttpException;
1819
useSymfony\Component\Routing\Generator\UrlGeneratorInterface;
1920

2021
/**
@@ -39,11 +40,13 @@ class RedirectController extends ContainerAware
3940
* @param Boolean|array $ignoreAttributes Whether to ignore attributes or an array of attributes to ignore
4041
*
4142
* @return Response A Response instance
43+
*
44+
* @throws HttpException In case the route name is empty
4245
*/
4346
publicfunctionredirectAction(Request$request,$route,$permanent =false,$ignoreAttributes =false)
4447
{
4548
if ('' ==$route) {
46-
returnnewResponse(null,$permanent ?410 :404);
49+
thrownewHttpException($permanent ?410 :404);
4750
}
4851

4952
$attributes =array();
@@ -75,11 +78,13 @@ public function redirectAction(Request $request, $route, $permanent = false, $ig
7578
* @param integer|null $httpsPort The HTTPS port (null to keep the current one for the same scheme or the configured port in the container)
7679
*
7780
* @return Response A Response instance
81+
*
82+
* @throws HttpException In case the path is empty
7883
*/
7984
publicfunctionurlRedirectAction(Request$request,$path,$permanent =false,$scheme =null,$httpPort =null,$httpsPort =null)
8085
{
8186
if ('' ==$path) {
82-
returnnewResponse(null,$permanent ?410 :404);
87+
thrownewHttpException($permanent ?410 :404);
8388
}
8489

8590
$statusCode =$permanent ?301 :302;
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
<input type="<?phpechoisset($type) ?$view->escape($type) :'text'?>"<?phpecho$view['form']->block($form,'widget_attributes')?><?phpif (!empty($value)):?> value="<?phpecho$view->escape($value)?>"<?phpendif?> />
1+
<input
2+
type="<?phpechoisset($type) ?$view->escape($type) :'text'?>"
3+
<?phpecho$view['form']->block($form,'widget_attributes')?>
4+
<?phpif (!empty($value) ||is_numeric($value)):?> value="<?phpecho$view->escape($value)?>"<?phpendif?>
5+
/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp