Merge branch '2.7' into 2.8

* 2.7:
  property constraints can be added in child classes
  added test for staticClassLoader in LazyLoadingMetadatafactory
  spelling fixes
  make sure that null can be the invalid value
  bumped Symfony version to 2.7.25
  updated VERSION for 2.7.24
  update CONTRIBUTORS for 2.7.24
  updated CHANGELOG for 2.7.24
  [FrameworkBundle] Simplify createPackageDefinition
  fix directory resource considers same timestamp not fresh
  return false early from directory resource
This commit is contained in:
Nicolas Grekas 2017-02-14 17:24:56 +01:00
commit 03194300ed
17 changed files with 248 additions and 72 deletions

View File

@ -7,6 +7,22 @@ in 2.7 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1
* 2.7.24 (2017-02-06)
* bug #21063 [Form] Fixed DateType format option for single text widget (HeahDude)
* bug #21430 Casting TableCell value to string. (jaydiablo)
* bug #21359 [FrameworkBundle] fixed custom domain for translations in php templates (robinlehrmann)
* bug #21485 [Process] Non ASCII characters disappearing during the escapeshellarg (GuillaumeVerdon)
* bug #21462 [BrowserKit] ignore invalid cookies expires date format (xabbuh)
* bug #21438 [Console] Fix TableCell issues with decoration (ogizanagi)
* bug #21431 [DoctrineBridge] always check for all fields to be mapped (xabbuh)
* bug #21360 [PropertyAccess] Handle interfaces in the invalid argument exception (fancyweb)
* bug #21401 [Debug] Workaround "null" $context (nicolas-grekas)
* bug #21333 [HttpKernel] Fix ArgumentValueResolver for arguments default null (chalasr)
* bug #20871 [HttpKernel] Give higher priority to adding request formats (akeeman)
* bug #21285 [TwigBundle] do not lose already set method calls (xabbuh)
* bug #21279 #20411 fix Yaml parsing for very long quoted strings (RichardBradley)
* 2.7.23 (2017-01-12)
* bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik)

View File

@ -15,8 +15,8 @@ Symfony is the result of the work of many people who made the code better
- Johannes S (johannes)
- Kris Wallsmith (kriswallsmith)
- Jakub Zalas (jakubzalas)
- Ryan Weaver (weaverryan)
- Kévin Dunglas (dunglas)
- Ryan Weaver (weaverryan)
- Javier Eguiluz (javier.eguiluz)
- Hugo Hamon (hhamon)
- Abdellatif Ait boudad (aitboudad)
@ -26,16 +26,16 @@ Symfony is the result of the work of many people who made the code better
- Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
- Grégoire Pineau (lyrixx)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
- Eriksen Costa (eriksencosta)
- Maxime Steinhausser (ogizanagi)
- Jules Pietri (heah)
- Eriksen Costa (eriksencosta)
- Robin Chalas (chalas_r)
- Jules Pietri (heah)
- Sarah Khalil (saro0h)
- Jonathan Wage (jwage)
- Diego Saint Esteben (dosten)
@ -46,14 +46,14 @@ Symfony is the result of the work of many people who made the code better
- stealth35 (stealth35)
- Alexander Mols (asm89)
- Bulat Shakirzyanov (avalanche123)
- Ener-Getick (energetick)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik
- Ener-Getick (energetick)
- Diego Saint Esteben (dii3g0)
- Roland Franssen (ro0)
- Konstantin Kudryashov (everzet)
- Iltar van der Berg (kjarli)
- Roland Franssen (ro0)
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan)
- Peter Rehm (rpet)
@ -102,18 +102,19 @@ Symfony is the result of the work of many people who made the code better
- Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv)
- Colin Frei
- Jérémy DERUSSÉ (jderusse)
- Adrien Brault (adrienbrault)
- Joshua Thijssen
- Peter Kokot (maastermedia)
- excelwebzone
- Jacob Dreesen (jdreesen)
- Jérémy DERUSSÉ (jderusse)
- Vladimir Reznichenko (kalessil)
- Tomáš Votruba (tomas_votruba)
- David Buchmann (dbu)
- Fabien Pennequin (fabienpennequin)
- Gordon Franke (gimler)
- Tobias Nyholm (tobias)
- Eric GELOEN (gelo)
- David Buchmann (dbu)
- Tugdual Saunier (tucksaun)
- Théo FIDRY (theofidry)
- Robert Schönthal (digitalkaoz)
@ -121,20 +122,20 @@ Symfony is the result of the work of many people who made the code better
- Stefano Sala (stefano.sala)
- Evgeniy (ewgraf)
- Juti Noppornpitak (shiroyuki)
- Tobias Nyholm (tobias)
- Tigran Azatyan (tigranazatyan)
- Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto)
- Sebastiaan Stok (sstok)
- Yonel Ceruto González (yonelceruto)
- Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel)
- Jérémie Augustin (jaugustin)
- Andréia Bohner (andreia)
- Yonel Ceruto González (yonelceruto)
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
- jwdeitch
- Mikael Pajunen
- Joel Wurtz (brouznouf)
- Philipp Wahala (hifi)
- Vyacheslav Pavlov
@ -144,7 +145,6 @@ Symfony is the result of the work of many people who made the code better
- Vincent AUBERT (vincent)
- Rouven Weßling (realityking)
- Teoh Han Hui (teohhanhui)
- Mikael Pajunen
- Clemens Tolboom
- Helmer Aaviksoo
- Hiromi Hishida (77web)
@ -186,6 +186,7 @@ Symfony is the result of the work of many people who made the code better
- Dustin Whittle (dustinwhittle)
- jeff
- John Kary (johnkary)
- James Halsall (jaitsu)
- Justin Hileman (bobthecow)
- Blanchon Vincent (blanchonvincent)
- Chris Wilkinson (thewilkybarkid)
@ -194,6 +195,7 @@ Symfony is the result of the work of many people who made the code better
- Sven Paulus (subsven)
- Rui Marinho (ruimarinho)
- Daniel Espendiller
- SpacePossum
- Dawid Nowak
- Eugene Wissner
- Julien Brochet (mewt)
@ -223,13 +225,12 @@ Symfony is the result of the work of many people who made the code better
- Arjen Brouwer (arjenjb)
- Katsuhiro OGAWA
- Patrick McDougle (patrick-mcdougle)
- James Halsall (jaitsu)
- Alif Rachmawadi
- Kristen Gilden (kgilden)
- SpacePossum
- Pierre-Yves LEBECQ (pylebecq)
- Alex Pott
- Jakub Kucharovic (jkucharovic)
- Uwe Jäger (uwej711)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
- Joseph Rouff (rouffj)
@ -245,6 +246,7 @@ Symfony is the result of the work of many people who made the code better
- Jhonny Lidfors (jhonne)
- Diego Agulló (aeoris)
- jdhoek
- Pavel Batanov (scaytrase)
- Nikita Konstantinov
- Wodor Wodorski
- Thomas Lallement (raziel057)
@ -255,6 +257,7 @@ Symfony is the result of the work of many people who made the code better
- Robert Kiss (kepten)
- Ruben Gonzalez (rubenrua)
- Roumen Damianoff (roumen)
- Adam Prager (padam87)
- Antonio J. García Lagar (ajgarlag)
- Kim Hemsø Rasmussen (kimhemsoe)
- Wouter Van Hecke
@ -277,7 +280,7 @@ Symfony is the result of the work of many people who made the code better
- Andrey Esaulov (andremaha)
- Grégoire Passault (gregwar)
- Ismael Ambrosi (iambrosi)
- Uwe Jäger (uwej711)
- Baptiste Lafontaine
- Aurelijus Valeiša (aurelijus)
- Victor Bocharsky (bocharsky_bw)
- Jan Decavele (jandc)
@ -286,7 +289,6 @@ Symfony is the result of the work of many people who made the code better
- Tiago Ribeiro (fixe)
- Hidde Boomsma (hboomsma)
- John Bafford (jbafford)
- Pavel Batanov (scaytrase)
- Bob den Otter (bopp)
- Adrian Rudnik (kreischweide)
- Francesc Rosàs (frosas)
@ -307,11 +309,11 @@ Symfony is the result of the work of many people who made the code better
- Matthew Lewinski (lewinski)
- Magnus Nordlander (magnusnordlander)
- alquerci
- Adam Prager (padam87)
- Francesco Levorato
- Vitaliy Zakharov (zakharovvi)
- Tobias Sjösten (tobiassjosten)
- Gyula Sallai (salla)
- David Maicher (dmaicher)
- Inal DJAFAR (inalgnu)
- Christian Gärtner (dagardner)
- Tomasz Kowalczyk (thunderer)
@ -347,7 +349,7 @@ Symfony is the result of the work of many people who made the code better
- Tobias Naumann (tna)
- Daniel Beyer
- Shein Alexey
- Baptiste Lafontaine
- Romain Gautier (mykiwi)
- Joe Lencioni
- Daniel Tschinder
- Kai
@ -386,6 +388,8 @@ Symfony is the result of the work of many people who made the code better
- Mihai Stancu
- Olivier Dolbeau (odolbeau)
- Jan Rosier (rosier)
- Thomas Royer (cydonia7)
- Josip Kruslin
- vagrant
- EdgarPE
- Florian Pfitzer (marmelatze)
@ -397,9 +401,9 @@ Symfony is the result of the work of many people who made the code better
- Ariel Ferrandini (aferrandini)
- Dirk Pahl (dirkaholic)
- cedric lombardot (cedriclombardot)
- David Maicher (dmaicher)
- Jonas Flodén (flojon)
- Christian Schmidt
- Amrouche Hamza
- Marcin Sikoń (marphi)
- Dominik Zogg (dominik.zogg)
- Marek Pietrzak
@ -417,6 +421,7 @@ Symfony is the result of the work of many people who made the code better
- Fabrice Bernhard (fabriceb)
- Jérôme Macias (jeromemacias)
- Andrey Astakhov (aast)
- Thomas Calvet
- Fabian Lange (codingfabian)
- Frank Neff (fneff)
- Roman Lapin (memphys)
@ -437,6 +442,7 @@ Symfony is the result of the work of many people who made the code better
- Roy Van Ginneken (rvanginneken)
- ondrowan
- Barry vd. Heuvel (barryvdh)
- Wouter J
- Evan S Kaufman (evanskaufman)
- mcben
- Jérôme Vieilledent (lolautruche)
@ -451,7 +457,9 @@ Symfony is the result of the work of many people who made the code better
- Jakub Škvára (jskvara)
- Andrew Udvare (audvare)
- alexpods
- Arjen van der Meijden
- Michele Locati
- Dariusz Ruminski
- Erik Trapman (eriktrapman)
- De Cock Xavier (xdecock)
- Almog Baku (almogbaku)
@ -494,6 +502,7 @@ Symfony is the result of the work of many people who made the code better
- Benjamin Laugueux (yzalis)
- Zach Badgett (zachbadgett)
- Aurélien Fredouelle
- Jérôme Parmentier (lctrs)
- Pavel Campr (pcampr)
- Johnny Robeson (johnny)
- Disquedur
@ -518,11 +527,11 @@ Symfony is the result of the work of many people who made the code better
- Sinan Eldem
- Alexandre Dupuy (satchette)
- Rob Frawley 2nd
- Andre Rømcke (andrerom)
- Nahuel Cuesta (ncuesta)
- Chris Boden (cboden)
- Asmir Mustafic (goetas)
- Stefan Gehrig (sgehrig)
- Josip Kruslin
- Hany el-Kerdany
- Wang Jingyu
- Åsmund Garfors
@ -551,11 +560,13 @@ Symfony is the result of the work of many people who made the code better
- maxime.steinhausser
- Stefan Warman
- Tristan Maindron (tmaindron)
- Wesley Lancel
- Ke WANG (yktd26)
- Strate
- Miquel Rodríguez Telep (mrtorrent)
- Sergey Kolodyazhnyy (skolodyazhnyy)
- umpirski
- Quentin de Longraye (quentinus95)
- Chris Heng (gigablah)
- Ulumuddin Yunus (joenoez)
- Luc Vieillescazes (iamluc)
@ -580,6 +591,7 @@ Symfony is the result of the work of many people who made the code better
- Disparity
- origaminal
- Matteo Beccati (matteobeccati)
- Kevin (oxfouzer)
- Paweł Wacławczyk (pwc)
- Oleg Zinchenko (cystbear)
- Johannes Klauss (cloppy)
@ -592,7 +604,6 @@ Symfony is the result of the work of many people who made the code better
- develop
- ReenExe
- Mark Sonnabaum
- Thomas Royer (cydonia7)
- Richard Quadling
- jochenvdv
- Arturas Smorgun (asarturas)
@ -608,7 +619,6 @@ Symfony is the result of the work of many people who made the code better
- Martin Hujer (martinhujer)
- Pascal Helfenstein
- Baldur Rensch (brensch)
- Thomas Calvet
- Vladyslav Petrovych
- Alex Xandra Albert Sim
- Carson Full
@ -636,9 +646,7 @@ Symfony is the result of the work of many people who made the code better
- Marc Morera (mmoreram)
- Andrew Hilobok (hilobok)
- Christian Soronellas (theunic)
- Romain Gautier (mykiwi)
- Yosmany Garcia (yosmanyga)
- Wouter J
- Wouter de Wild
- Miroslav Sustek
- Degory Valentine
@ -673,7 +681,6 @@ Symfony is the result of the work of many people who made the code better
- Pierre Vanliefland (pvanliefland)
- Sofiane HADDAG (sofhad)
- frost-nzcr4
- Arjen van der Meijden
- Abhoryo
- Fabian Vogler (fabian)
- Korvin Szanto
@ -718,7 +725,6 @@ Symfony is the result of the work of many people who made the code better
- Simone Di Maulo (toretto460)
- Christian Morgan
- Alexander Miehe (engerim)
- Jérôme Parmentier (lctrs)
- Morgan Auchede (mauchede)
- Don Pinkster
- Maksim Muruev
@ -779,8 +785,8 @@ Symfony is the result of the work of many people who made the code better
- Pieter
- Michael Tibben
- Sander Marechal
- Andre Rømcke (andrerom)
- Radosław Benkel
- jean pasqualini (darkilliant)
- ttomor
- Mei Gwilym (meigwilym)
- Michael H. Arieli (excelwebzone)
@ -790,12 +796,12 @@ Symfony is the result of the work of many people who made the code better
- Sander Coolen (scoolen)
- Nicolas Le Goff (nlegoff)
- Ben Oman
- Andreas Kleemann
- Manuele Menozzi
- Anton Babenko (antonbabenko)
- Irmantas Šiupšinskas (irmantas)
- Danilo Silva
- Zachary Tong (polyfractal)
- Amrouche Hamza
- Hryhorii Hrebiniuk
- Dennis Fridrich (dfridrich)
- mcfedr (mcfedr)
@ -809,6 +815,7 @@ Symfony is the result of the work of many people who made the code better
- boite
- MGDSoft
- Vadim Tyukov (vatson)
- David Wolter (davewww)
- Sortex
- chispita
- Wojciech Sznapka
@ -817,6 +824,7 @@ Symfony is the result of the work of many people who made the code better
- Máximo Cuadros (mcuadros)
- tamirvs
- julien.galenski
- Bob van de Vijver
- Christian Neff
- Per Sandström (per)
- Goran Juric
@ -946,6 +954,7 @@ Symfony is the result of the work of many people who made the code better
- Xavier Coureau
- ConneXNL
- Aharon Perkel
- matze
- Abdul.Mohsen B. A. A
- Benoît Burnichon
- pthompson
@ -1024,7 +1033,6 @@ Symfony is the result of the work of many people who made the code better
- Ahmed TAILOULOUTE (ahmedtai)
- Maxime Veber (nek-)
- Sullivan SENECHAL
- Dariusz Ruminski
- Tadcka
- Beth Binkovitz
- Romain Geissler
@ -1046,6 +1054,7 @@ Symfony is the result of the work of many people who made the code better
- Rafał Muszyński (rafmus90)
- Timothy Anido (xanido)
- Rick Prent
- skalpa
- Martin Eckhardt
- Pieter Jordaan
- Damien Tournoud
@ -1094,7 +1103,6 @@ Symfony is the result of the work of many people who made the code better
- Mephistofeles
- Hoffmann András
- Olivier
- Wesley Lancel
- pscheit
- Zdeněk Drahoš
- Dan Harper
@ -1123,12 +1131,14 @@ Symfony is the result of the work of many people who made the code better
- Leonid Terentyev (li0n)
- ryunosuke
- victoria
- Arjan Keeman
- Francisco Facioni (fran6co)
- Iwan van Staveren (istaveren)
- Dany Maillard (maidmaid)
- Povilas S. (povilas)
- pborreli
- Eric Caron
- Richard Bradley
- 2manypeople
- Wing
- Thomas Bibb
@ -1187,6 +1197,7 @@ Symfony is the result of the work of many people who made the code better
- Andy Stanberry
- Luiz “Felds” Liscia
- Thomas Rothe
- nietonfir
- alefranz
- avi123
- alsar
@ -1247,6 +1258,7 @@ Symfony is the result of the work of many people who made the code better
- Andrey Chernykh
- Edvinas Klovas
- Drew Butler
- Peter Breuls
- Tischoi
- J Bruni
- Alexey Prilipko
@ -1312,6 +1324,7 @@ Symfony is the result of the work of many people who made the code better
- Alan Chen
- Maerlyn
- Even André Fiskvik
- Arjan Keeman
- Erik van Wingerden
- Dane Powell
- Gerrit Drost
@ -1359,6 +1372,7 @@ Symfony is the result of the work of many people who made the code better
- Marcin Szepczynski (szepczynski)
- Cyrille Jouineau (tuxosaurus)
- Yorkie Chadwick (yorkie76)
- GuillaumeVerdon
- Yanick Witschi
- Ondrej Mirtes
- akimsko
@ -1594,6 +1608,7 @@ Symfony is the result of the work of many people who made the code better
- simpson
- drublic
- Andreas Streichardt
- Pascal Hofmann
- smokeybear87
- Gustavo Adrian
- Kevin Weber
@ -1616,7 +1631,6 @@ Symfony is the result of the work of many people who made the code better
- Muharrem Demirci (mdemirci)
- Evgeny Z (meze)
- Nicolas de Marqué (nicola)
- Kevin (oxfouzer)
- Pierre Geyer (ptheg)
- Sam Fleming (sam_fleming)
- Thomas BERTRAND (sevrahk)

View File

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
/** @Entity */
class DoubleNullableNameEntity
{
/** @Id @Column(type="integer") */
protected $id;
/** @Column(type="string", nullable=true) */
public $name;
/** @Column(type="string", nullable=true) */
public $name2;
public function __construct($id, $name, $name2)
{
$this->id = $id;
$this->name = $name;
$this->name2 = $name2;
}
}

View File

@ -18,6 +18,7 @@ use Doctrine\Common\Persistence\ObjectRepository;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNullableNameEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
@ -132,6 +133,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$schemaTool->createSchema(array(
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNullableNameEntity'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity'),
));
@ -215,7 +217,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->assertNoViolation();
}
public function testValidateUniquenessWithIgnoreNull()
public function testValidateUniquenessWithIgnoreNullDisabled()
{
$constraint = new UniqueEntity(array(
'message' => 'myMessage',
@ -264,6 +266,34 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->validator->validate($entity1, $constraint);
}
public function testNoValidationIfFirstFieldIsNullAndNullValuesAreIgnored()
{
$constraint = new UniqueEntity(array(
'message' => 'myMessage',
'fields' => array('name', 'name2'),
'em' => self::EM_NAME,
'ignoreNull' => true,
));
$entity1 = new DoubleNullableNameEntity(1, null, 'Foo');
$entity2 = new DoubleNullableNameEntity(2, null, 'Foo');
$this->validator->validate($entity1, $constraint);
$this->assertNoViolation();
$this->em->persist($entity1);
$this->em->flush();
$this->validator->validate($entity1, $constraint);
$this->assertNoViolation();
$this->validator->validate($entity2, $constraint);
$this->assertNoViolation();
}
public function testValidateUniquenessWithValidCustomErrorPath()
{
$constraint = new UniqueEntity(array(

View File

@ -80,6 +80,8 @@ class UniqueEntityValidator extends ConstraintValidator
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
$criteria = array();
$hasNullValue = false;
foreach ($fields as $fieldName) {
if (!$class->hasField($fieldName) && !$class->hasAssociation($fieldName)) {
throw new ConstraintDefinitionException(sprintf('The field "%s" is not mapped by Doctrine, so it cannot be validated for uniqueness.', $fieldName));
@ -87,6 +89,10 @@ class UniqueEntityValidator extends ConstraintValidator
$fieldValue = $class->reflFields[$fieldName]->getValue($entity);
if (null === $fieldValue) {
$hasNullValue = true;
}
if ($constraint->ignoreNull && null === $fieldValue) {
continue;
}
@ -102,6 +108,11 @@ class UniqueEntityValidator extends ConstraintValidator
}
}
// validation doesn't fail if one of the fields is null and if null values should be ignored
if ($hasNullValue && $constraint->ignoreNull) {
return;
}
// skip validation if there are no criteria (this can happen when the
// "ignoreNull" option is enabled and fields to be checked are null
if (empty($criteria)) {

View File

@ -623,23 +623,14 @@ class FrameworkExtension extends Extension
throw new \LogicException('An asset package cannot have base URLs and base paths.');
}
if (!$baseUrls) {
$package = new DefinitionDecorator('assets.path_package');
return $package
->setPublic(false)
->replaceArgument(0, $basePath)
->replaceArgument(1, $version)
;
}
$package = new DefinitionDecorator('assets.url_package');
return $package
$package = new DefinitionDecorator($baseUrls ? 'assets.url_package' : 'assets.path_package');
$package
->setPublic(false)
->replaceArgument(0, $baseUrls)
->replaceArgument(0, $baseUrls ?: $basePath)
->replaceArgument(1, $version)
;
return $package;
}
private function createVersion(ContainerBuilder $container, $version, $format, $name)

View File

@ -68,7 +68,10 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
return false;
}
$newestMTime = filemtime($this->resource);
if ($timestamp < filemtime($this->resource)) {
return false;
}
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
// if regex filtering is enabled only check matching files
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
@ -81,10 +84,13 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
continue;
}
$newestMTime = max($file->getMTime(), $newestMTime);
// early return if a file's mtime exceeds the passed timestamp
if ($timestamp < $file->getMTime()) {
return false;
}
}
return $newestMTime < $timestamp;
return true;
}
public function serialize()

View File

@ -96,8 +96,10 @@ class DirectoryResourceTest extends \PHPUnit_Framework_TestCase
public function testIsFreshDeleteFile()
{
$resource = new DirectoryResource($this->directory);
$time = time();
sleep(1);
unlink($this->directory.'/tmp.xml');
$this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed');
$this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed');
}
public function testIsFreshDeleteDirectory()

View File

@ -4,7 +4,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
//Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
//Ensure has proper line ending before outputting a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyleWithForcedLineLength($input, $output);

View File

@ -51,7 +51,7 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
if (isset($replacements[$targetId])) {
$container->setAlias($definitionId, $replacements[$targetId]);
}
// No neeed to process the same target twice
// No need to process the same target twice
if (isset($seenAliasTargets[$targetId])) {
continue;
}

View File

@ -137,7 +137,7 @@ class MoFileLoader extends FileLoader
}
/**
* Reads an unsigned long from stream respecting endianess.
* Reads an unsigned long from stream respecting endianness.
*
* @param resource $stream
* @param bool $isBigEndian

View File

@ -346,10 +346,6 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
}
foreach ($source->getConstrainedProperties() as $property) {
if ($this->hasPropertyMetadata($property)) {
continue;
}
foreach ($source->getPropertyMetadata($property) as $member) {
$member = clone $member;

View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Fixtures;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\Length;
class EntityStaticCar extends EntityStaticVehicle
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array('max' => 99)));
}
}

View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Fixtures;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\Length;
class EntityStaticCarTurbo extends EntityStaticCar
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array('max' => 99)));
}
}

View File

@ -0,0 +1,25 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Fixtures;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\Length;
class EntityStaticVehicle
{
public $wheels;
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array('max' => 99)));
}
}

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Mapping;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
@ -304,21 +303,6 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
{
$this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property');
}
public function testMergeDoesOverrideConstraintsFromParentClassIfPropertyIsOverriddenInChildClass()
{
$parentMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ParentClass');
$parentMetadata->addPropertyConstraint('example', new GreaterThan(0));
$childMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass');
$childMetadata->addPropertyConstraint('example', new GreaterThan(1));
$childMetadata->mergeConstraints($parentMetadata);
$expectedMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass');
$expectedMetadata->addPropertyConstraint('example', new GreaterThan(1));
$this->assertEquals($expectedMetadata, $childMetadata);
}
}
class ParentClass

View File

@ -168,6 +168,25 @@ class LazyLoadingMetadataFactoryTest extends \PHPUnit_Framework_TestCase
$metadata = $factory->getMetadataFor(self::CLASS_NAME);
}
public function testGroupsFromParent()
{
$reader = new \Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader();
$factory = new LazyLoadingMetadataFactory($reader);
$metadata = $factory->getMetadataFor('Symfony\Component\Validator\Tests\Fixtures\EntityStaticCarTurbo');
$groups = array();
foreach ($metadata->getPropertyMetadata('wheels') as $propertyMetadata) {
$constraints = $propertyMetadata->getConstraints();
$groups = array_replace($groups, $constraints[0]->groups);
}
$this->assertCount(4, $groups);
$this->assertContains('Default', $groups);
$this->assertContains('EntityStaticCarTurbo', $groups);
$this->assertContains('EntityStaticCar', $groups);
$this->assertContains('EntityStaticVehicle', $groups);
}
}
class TestLoader implements LoaderInterface