Merge branch '5.0' into 5.1
* 5.0: [Cache] Use the default expiry when saving (not when creating) items Fix typo Fix DBAL deprecation [Form] Fix ChoiceType translation domain Add Tagalog translations for new form messages [Form] Add missing vietnamese translations sync translations from master [OptionsResolver] Fix force prepend normalizer add vietnamese translation for html5 color validation
This commit is contained in:
commit
c87847c361
@ -81,8 +81,12 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||||||
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
|
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
|
||||||
$paramValues = ['series' => $series];
|
$paramValues = ['series' => $series];
|
||||||
$paramTypes = ['series' => \PDO::PARAM_STR];
|
$paramTypes = ['series' => \PDO::PARAM_STR];
|
||||||
|
if (method_exists($this->conn, 'executeStatement')) {
|
||||||
|
$this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||||
|
} else {
|
||||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -101,7 +105,11 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||||||
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
||||||
'series' => \PDO::PARAM_STR,
|
'series' => \PDO::PARAM_STR,
|
||||||
];
|
];
|
||||||
|
if (method_exists($this->conn, 'executeStatement')) {
|
||||||
|
$updated = $this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||||
|
} else {
|
||||||
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||||
|
}
|
||||||
if ($updated < 1) {
|
if ($updated < 1) {
|
||||||
throw new TokenNotFoundException('No token found.');
|
throw new TokenNotFoundException('No token found.');
|
||||||
}
|
}
|
||||||
@ -129,6 +137,10 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||||||
'value' => \PDO::PARAM_STR,
|
'value' => \PDO::PARAM_STR,
|
||||||
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
||||||
];
|
];
|
||||||
|
if (method_exists($this->conn, 'executeStatement')) {
|
||||||
|
$this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||||
|
} else {
|
||||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class DoctrineTokenProviderTest extends TestCase
|
|||||||
'driver' => 'pdo_sqlite',
|
'driver' => 'pdo_sqlite',
|
||||||
'url' => 'sqlite:///:memory:',
|
'url' => 'sqlite:///:memory:',
|
||||||
]);
|
]);
|
||||||
$connection->executeUpdate(<<< 'SQL'
|
$connection->{method_exists($connection, 'executeStatement') ? 'executeStatement' : 'executeUpdate'}(<<< 'SQL'
|
||||||
CREATE TABLE rememberme_token (
|
CREATE TABLE rememberme_token (
|
||||||
series char(88) UNIQUE PRIMARY KEY NOT NULL,
|
series char(88) UNIQUE PRIMARY KEY NOT NULL,
|
||||||
value char(88) NOT NULL,
|
value char(88) NOT NULL,
|
||||||
|
@ -43,12 +43,11 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $v = $value;
|
$item->value = $v = $value;
|
||||||
$item->isHit = $isHit;
|
$item->isHit = $isHit;
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
|
||||||
// Detect wrapped values that encode for their expiry and creation duration
|
// Detect wrapped values that encode for their expiry and creation duration
|
||||||
// For compactness, these values are packed in the key of an array using
|
// For compactness, these values are packed in the key of an array using
|
||||||
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
|
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
|
||||||
@ -66,7 +65,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
);
|
);
|
||||||
$getId = \Closure::fromCallable([$this, 'getId']);
|
$getId = \Closure::fromCallable([$this, 'getId']);
|
||||||
$this->mergeByLifetime = \Closure::bind(
|
$this->mergeByLifetime = \Closure::bind(
|
||||||
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
|
static function ($deferred, $namespace, &$expiredIds) use ($getId, $defaultLifetime) {
|
||||||
$byLifetime = [];
|
$byLifetime = [];
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
$expiredIds = [];
|
$expiredIds = [];
|
||||||
@ -74,7 +73,9 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
foreach ($deferred as $key => $item) {
|
foreach ($deferred as $key => $item) {
|
||||||
$key = (string) $key;
|
$key = (string) $key;
|
||||||
if (null === $item->expiry) {
|
if (null === $item->expiry) {
|
||||||
$ttl = 0 < $item->defaultLifetime ? $item->defaultLifetime : 0;
|
$ttl = 0 < $defaultLifetime ? $defaultLifetime : 0;
|
||||||
|
} elseif (0 === $item->expiry) {
|
||||||
|
$ttl = 0;
|
||||||
} elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) {
|
} elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) {
|
||||||
$expiredIds[] = $getId($key);
|
$expiredIds[] = $getId($key);
|
||||||
continue;
|
continue;
|
||||||
|
@ -44,10 +44,9 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
|
|||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
|
||||||
$item->isTaggable = true;
|
$item->isTaggable = true;
|
||||||
// If structure does not match what we expect return item as is (no value and not a hit)
|
// If structure does not match what we expect return item as is (no value and not a hit)
|
||||||
if (!\is_array($value) || !\array_key_exists('value', $value)) {
|
if (!\is_array($value) || !\array_key_exists('value', $value)) {
|
||||||
@ -72,7 +71,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
|
|||||||
$getId = \Closure::fromCallable([$this, 'getId']);
|
$getId = \Closure::fromCallable([$this, 'getId']);
|
||||||
$tagPrefix = self::TAGS_PREFIX;
|
$tagPrefix = self::TAGS_PREFIX;
|
||||||
$this->mergeByLifetime = \Closure::bind(
|
$this->mergeByLifetime = \Closure::bind(
|
||||||
static function ($deferred, &$expiredIds) use ($getId, $tagPrefix) {
|
static function ($deferred, &$expiredIds) use ($getId, $tagPrefix, $defaultLifetime) {
|
||||||
$byLifetime = [];
|
$byLifetime = [];
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
$expiredIds = [];
|
$expiredIds = [];
|
||||||
@ -80,7 +79,9 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
|
|||||||
foreach ($deferred as $key => $item) {
|
foreach ($deferred as $key => $item) {
|
||||||
$key = (string) $key;
|
$key = (string) $key;
|
||||||
if (null === $item->expiry) {
|
if (null === $item->expiry) {
|
||||||
$ttl = 0 < $item->defaultLifetime ? $item->defaultLifetime : 0;
|
$ttl = 0 < $defaultLifetime ? $defaultLifetime : 0;
|
||||||
|
} elseif (0 === $item->expiry) {
|
||||||
|
$ttl = 0;
|
||||||
} elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) {
|
} elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) {
|
||||||
$expiredIds[] = $getId($key);
|
$expiredIds[] = $getId($key);
|
||||||
continue;
|
continue;
|
||||||
|
@ -34,6 +34,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
|||||||
private $values = [];
|
private $values = [];
|
||||||
private $expiries = [];
|
private $expiries = [];
|
||||||
private $createCacheItem;
|
private $createCacheItem;
|
||||||
|
private $defaultLifetime;
|
||||||
private $maxLifetime;
|
private $maxLifetime;
|
||||||
private $maxItems;
|
private $maxItems;
|
||||||
|
|
||||||
@ -50,16 +51,16 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
|||||||
throw new InvalidArgumentException(sprintf('Argument $maxItems must be a positive integer, %d passed.', $maxItems));
|
throw new InvalidArgumentException(sprintf('Argument $maxItems must be a positive integer, %d passed.', $maxItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->defaultLifetime = $defaultLifetime;
|
||||||
$this->storeSerialized = $storeSerialized;
|
$this->storeSerialized = $storeSerialized;
|
||||||
$this->maxLifetime = $maxLifetime;
|
$this->maxLifetime = $maxLifetime;
|
||||||
$this->maxItems = $maxItems;
|
$this->maxItems = $maxItems;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
$item->isHit = $isHit;
|
$item->isHit = $isHit;
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
},
|
},
|
||||||
@ -203,8 +204,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
|||||||
if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) {
|
if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) {
|
if (null === $expiry && 0 < $this->defaultLifetime) {
|
||||||
$expiry = $item["\0*\0defaultLifetime"];
|
$expiry = microtime(true) + $this->defaultLifetime;
|
||||||
$expiry = $now + ($expiry > ($this->maxLifetime ?: $expiry) ? $this->maxLifetime : $expiry);
|
$expiry = $now + ($expiry > ($this->maxLifetime ?: $expiry) ? $this->maxLifetime : $expiry);
|
||||||
} elseif ($this->maxLifetime && (null === $expiry || $expiry > $now + $this->maxLifetime)) {
|
} elseif ($this->maxLifetime && (null === $expiry || $expiry > $now + $this->maxLifetime)) {
|
||||||
$expiry = $now + $this->maxLifetime;
|
$expiry = $now + $this->maxLifetime;
|
||||||
|
@ -70,15 +70,11 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
unset($sourceMetadata[CacheItem::METADATA_TAGS]);
|
unset($sourceMetadata[CacheItem::METADATA_TAGS]);
|
||||||
|
|
||||||
$item->value = $sourceItem->value;
|
$item->value = $sourceItem->value;
|
||||||
$item->expiry = $sourceMetadata[CacheItem::METADATA_EXPIRY] ?? $sourceItem->expiry;
|
|
||||||
$item->isHit = $sourceItem->isHit;
|
$item->isHit = $sourceItem->isHit;
|
||||||
$item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
|
$item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
|
||||||
|
|
||||||
if (0 < $sourceItem->defaultLifetime && $sourceItem->defaultLifetime < $defaultLifetime) {
|
if (0 < $defaultLifetime) {
|
||||||
$defaultLifetime = $sourceItem->defaultLifetime;
|
$item->expiresAfter($defaultLifetime);
|
||||||
}
|
|
||||||
if (0 < $defaultLifetime && ($item->defaultLifetime <= 0 || $defaultLifetime < $item->defaultLifetime)) {
|
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
|
@ -121,8 +121,12 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
|||||||
$this->addTableToSchema($schema);
|
$this->addTableToSchema($schema);
|
||||||
|
|
||||||
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -152,8 +156,12 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
|||||||
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
|
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the Table to the Schema if the adapter uses this Connection.
|
* Adds the Table to the Schema if the adapter uses this Connection.
|
||||||
@ -281,7 +289,11 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
|
}
|
||||||
} catch (TableNotFoundException $e) {
|
} catch (TableNotFoundException $e) {
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
private $createCacheItem;
|
private $createCacheItem;
|
||||||
private $setInnerItem;
|
private $setInnerItem;
|
||||||
private $poolHash;
|
private $poolHash;
|
||||||
|
private $defaultLifetime;
|
||||||
|
|
||||||
public function __construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0)
|
public function __construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0)
|
||||||
{
|
{
|
||||||
@ -40,8 +41,9 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
$this->poolHash = $poolHash = spl_object_hash($pool);
|
$this->poolHash = $poolHash = spl_object_hash($pool);
|
||||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
||||||
$this->namespaceLen = \strlen($namespace);
|
$this->namespaceLen = \strlen($namespace);
|
||||||
|
$this->defaultLifetime = $defaultLifetime;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
|
static function ($key, $innerItem) use ($poolHash) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
|
|
||||||
@ -52,7 +54,6 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
$item->value = $v = $innerItem->get();
|
$item->value = $v = $innerItem->get();
|
||||||
$item->isHit = $innerItem->isHit();
|
$item->isHit = $innerItem->isHit();
|
||||||
$item->innerItem = $innerItem;
|
$item->innerItem = $innerItem;
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
|
||||||
$item->poolHash = $poolHash;
|
$item->poolHash = $poolHash;
|
||||||
|
|
||||||
// Detect wrapped values that encode for their expiry and creation duration
|
// Detect wrapped values that encode for their expiry and creation duration
|
||||||
@ -223,8 +224,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$item = (array) $item;
|
$item = (array) $item;
|
||||||
if (null === $item["\0*\0expiry"] && 0 < $item["\0*\0defaultLifetime"]) {
|
if (null === $item["\0*\0expiry"] && 0 < $this->defaultLifetime) {
|
||||||
$item["\0*\0expiry"] = microtime(true) + $item["\0*\0defaultLifetime"];
|
$item["\0*\0expiry"] = microtime(true) + $this->defaultLifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item["\0*\0poolHash"] === $this->poolHash && $item["\0*\0innerItem"]) {
|
if ($item["\0*\0poolHash"] === $this->poolHash && $item["\0*\0innerItem"]) {
|
||||||
|
@ -49,7 +49,6 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
$item->defaultLifetime = $protoItem->defaultLifetime;
|
|
||||||
$item->expiry = $protoItem->expiry;
|
$item->expiry = $protoItem->expiry;
|
||||||
$item->poolHash = $protoItem->poolHash;
|
$item->poolHash = $protoItem->poolHash;
|
||||||
|
|
||||||
@ -94,8 +93,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
$this->invalidateTags = \Closure::bind(
|
$this->invalidateTags = \Closure::bind(
|
||||||
static function (AdapterInterface $tagsAdapter, array $tags) {
|
static function (AdapterInterface $tagsAdapter, array $tags) {
|
||||||
foreach ($tags as $v) {
|
foreach ($tags as $v) {
|
||||||
$v->defaultLifetime = 0;
|
$v->expiry = 0;
|
||||||
$v->expiry = null;
|
|
||||||
$tagsAdapter->saveDeferred($v);
|
$tagsAdapter->saveDeferred($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ final class CacheItem implements ItemInterface
|
|||||||
protected $value;
|
protected $value;
|
||||||
protected $isHit = false;
|
protected $isHit = false;
|
||||||
protected $expiry;
|
protected $expiry;
|
||||||
protected $defaultLifetime;
|
|
||||||
protected $metadata = [];
|
protected $metadata = [];
|
||||||
protected $newMetadata = [];
|
protected $newMetadata = [];
|
||||||
protected $innerItem;
|
protected $innerItem;
|
||||||
@ -78,7 +77,7 @@ final class CacheItem implements ItemInterface
|
|||||||
public function expiresAt($expiration): self
|
public function expiresAt($expiration): self
|
||||||
{
|
{
|
||||||
if (null === $expiration) {
|
if (null === $expiration) {
|
||||||
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
|
$this->expiry = null;
|
||||||
} elseif ($expiration instanceof \DateTimeInterface) {
|
} elseif ($expiration instanceof \DateTimeInterface) {
|
||||||
$this->expiry = (float) $expiration->format('U.u');
|
$this->expiry = (float) $expiration->format('U.u');
|
||||||
} else {
|
} else {
|
||||||
@ -96,7 +95,7 @@ final class CacheItem implements ItemInterface
|
|||||||
public function expiresAfter($time): self
|
public function expiresAfter($time): self
|
||||||
{
|
{
|
||||||
if (null === $time) {
|
if (null === $time) {
|
||||||
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
|
$this->expiry = null;
|
||||||
} elseif ($time instanceof \DateInterval) {
|
} elseif ($time instanceof \DateInterval) {
|
||||||
$this->expiry = microtime(true) + \DateTime::createFromFormat('U', 0)->add($time)->format('U.u');
|
$this->expiry = microtime(true) + \DateTime::createFromFormat('U', 0)->add($time)->format('U.u');
|
||||||
} elseif (\is_int($time)) {
|
} elseif (\is_int($time)) {
|
||||||
|
@ -31,7 +31,7 @@ class ChainAdapterTest extends AdapterTestCase
|
|||||||
return new ChainAdapter([new FilesystemAdapter('a', $defaultLifetime), new FilesystemAdapter('b', $defaultLifetime)], $defaultLifetime);
|
return new ChainAdapter([new FilesystemAdapter('a', $defaultLifetime), new FilesystemAdapter('b', $defaultLifetime)], $defaultLifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime);
|
return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter($defaultLifetime), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEmptyAdaptersException()
|
public function testEmptyAdaptersException()
|
||||||
@ -69,6 +69,124 @@ class ChainAdapterTest extends AdapterTestCase
|
|||||||
$this->assertFalse($cache->prune());
|
$this->assertFalse($cache->prune());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMultipleCachesExpirationWhenCommonTtlIsNotSet()
|
||||||
|
{
|
||||||
|
if (isset($this->skippedTests[__FUNCTION__])) {
|
||||||
|
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$adapter1 = new ArrayAdapter(4);
|
||||||
|
$adapter2 = new ArrayAdapter(2);
|
||||||
|
|
||||||
|
$cache = new ChainAdapter([$adapter1, $adapter2]);
|
||||||
|
|
||||||
|
$cache->save($cache->getItem('key')->set('value'));
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
$adapter2->save($adapter2->getItem('key1')->set('value1'));
|
||||||
|
|
||||||
|
$item = $cache->getItem('key1');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value1', $item->get());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key1');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value1', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key1');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key1');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMultipleCachesExpirationWhenCommonTtlIsSet()
|
||||||
|
{
|
||||||
|
if (isset($this->skippedTests[__FUNCTION__])) {
|
||||||
|
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$adapter1 = new ArrayAdapter(4);
|
||||||
|
$adapter2 = new ArrayAdapter(2);
|
||||||
|
|
||||||
|
$cache = new ChainAdapter([$adapter1, $adapter2], 6);
|
||||||
|
|
||||||
|
$cache->save($cache->getItem('key')->set('value'));
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
$adapter2->save($adapter2->getItem('key1')->set('value1'));
|
||||||
|
|
||||||
|
$item = $cache->getItem('key1');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value1', $item->get());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key1');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value1', $item->get());
|
||||||
|
|
||||||
|
$item = $adapter2->getItem('key1');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key1');
|
||||||
|
$this->assertTrue($item->isHit());
|
||||||
|
$this->assertEquals('value1', $item->get());
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$item = $adapter1->getItem('key1');
|
||||||
|
$this->assertFalse($item->isHit());
|
||||||
|
}
|
||||||
|
|
||||||
private function getPruneableMock(): AdapterInterface
|
private function getPruneableMock(): AdapterInterface
|
||||||
{
|
{
|
||||||
$pruneable = $this->createMock([PruneableInterface::class, AdapterInterface::class]);
|
$pruneable = $this->createMock([PruneableInterface::class, AdapterInterface::class]);
|
||||||
|
@ -390,7 +390,7 @@ class ChoiceType extends AbstractType
|
|||||||
'value' => $choiceView->value,
|
'value' => $choiceView->value,
|
||||||
'label' => $choiceView->label,
|
'label' => $choiceView->label,
|
||||||
'attr' => $choiceView->attr,
|
'attr' => $choiceView->attr,
|
||||||
'translation_domain' => $options['translation_domain'],
|
'translation_domain' => $options['choice_translation_domain'],
|
||||||
'block_name' => 'entry',
|
'block_name' => 'entry',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -18,6 +18,102 @@
|
|||||||
<source>This value is not a valid HTML5 color.</source>
|
<source>This value is not a valid HTML5 color.</source>
|
||||||
<target>This value is not a valid HTML5 color.</target>
|
<target>This value is not a valid HTML5 color.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="100">
|
||||||
|
<source>Please enter a valid birthdate.</source>
|
||||||
|
<target>Please enter a valid birthdate.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="101">
|
||||||
|
<source>The selected choice is invalid.</source>
|
||||||
|
<target>The selected choice is invalid.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="102">
|
||||||
|
<source>The collection is invalid.</source>
|
||||||
|
<target>The collection is invalid.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="103">
|
||||||
|
<source>Please select a valid color.</source>
|
||||||
|
<target>Please select a valid color.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="104">
|
||||||
|
<source>Please select a valid country.</source>
|
||||||
|
<target>Please select a valid country.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="105">
|
||||||
|
<source>Please select a valid currency.</source>
|
||||||
|
<target>Please select a valid currency.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="106">
|
||||||
|
<source>Please choose a valid date interval.</source>
|
||||||
|
<target>Please choose a valid date interval.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="107">
|
||||||
|
<source>Please enter a valid date and time.</source>
|
||||||
|
<target>Please enter a valid date and time.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="108">
|
||||||
|
<source>Please enter a valid date.</source>
|
||||||
|
<target>Please enter a valid date.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="109">
|
||||||
|
<source>Please select a valid file.</source>
|
||||||
|
<target>Please select a valid file.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="110">
|
||||||
|
<source>The hidden field is invalid.</source>
|
||||||
|
<target>The hidden field is invalid.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="111">
|
||||||
|
<source>Please enter an integer.</source>
|
||||||
|
<target>Please enter an integer.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="112">
|
||||||
|
<source>Please select a valid language.</source>
|
||||||
|
<target>Please select a valid language.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="113">
|
||||||
|
<source>Please select a valid locale.</source>
|
||||||
|
<target>Please select a valid locale.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="114">
|
||||||
|
<source>Please enter a valid money amount.</source>
|
||||||
|
<target>Please enter a valid money amount.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="115">
|
||||||
|
<source>Please enter a number.</source>
|
||||||
|
<target>Please enter a number.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="116">
|
||||||
|
<source>The password is invalid.</source>
|
||||||
|
<target>The password is invalid.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="117">
|
||||||
|
<source>Please enter a percentage value.</source>
|
||||||
|
<target>Please enter a percentage value.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="118">
|
||||||
|
<source>The values do not match.</source>
|
||||||
|
<target>The values do not match.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="119">
|
||||||
|
<source>Please enter a valid time.</source>
|
||||||
|
<target>Please enter a valid time.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="120">
|
||||||
|
<source>Please select a valid timezone.</source>
|
||||||
|
<target>Please select a valid timezone.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="121">
|
||||||
|
<source>Please enter a valid URL.</source>
|
||||||
|
<target>Please enter a valid URL.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="122">
|
||||||
|
<source>Please enter a valid search term.</source>
|
||||||
|
<target>Please enter a valid search term.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="123">
|
||||||
|
<source>Please provide a valid phone number.</source>
|
||||||
|
<target>Please provide a valid phone number.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -14,6 +14,106 @@
|
|||||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||||
<target>Hindi balido ang CSRF token. Maagpasa muli ng isang pang porma.</target>
|
<target>Hindi balido ang CSRF token. Maagpasa muli ng isang pang porma.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="99">
|
||||||
|
<source>This value is not a valid HTML5 color.</source>
|
||||||
|
<target>Ang halagang ito ay hindi wastong HTML5 color.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="100">
|
||||||
|
<source>Please enter a valid birthdate.</source>
|
||||||
|
<target>Pakilagay ang tamang petsa ng kapanganakan.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="101">
|
||||||
|
<source>The selected choice is invalid.</source>
|
||||||
|
<target>Ang pinagpiliang sagot ay hindi tama.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="102">
|
||||||
|
<source>The collection is invalid.</source>
|
||||||
|
<target>Hindi balido ang koleksyon.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="103">
|
||||||
|
<source>Please select a valid color.</source>
|
||||||
|
<target>Pakipiliin ang nararapat na kulay.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="104">
|
||||||
|
<source>Please select a valid country.</source>
|
||||||
|
<target>Pakipiliin ang nararapat na bansa.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="105">
|
||||||
|
<source>Please select a valid currency.</source>
|
||||||
|
<target>Pakipiliin ang tamang pananalapi.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="106">
|
||||||
|
<source>Please choose a valid date interval.</source>
|
||||||
|
<target>Piliin ang wastong agwat ng petsa.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="107">
|
||||||
|
<source>Please enter a valid date and time.</source>
|
||||||
|
<target>Piliin ang wastong petsa at oras.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="108">
|
||||||
|
<source>Please enter a valid date.</source>
|
||||||
|
<target>Ilagay ang wastong petsa.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="109">
|
||||||
|
<source>Please select a valid file.</source>
|
||||||
|
<target>Piliin ang balidong file.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="110">
|
||||||
|
<source>The hidden field is invalid.</source>
|
||||||
|
<target>Hindi balido ang field na nakatago.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="111">
|
||||||
|
<source>Please enter an integer.</source>
|
||||||
|
<target>Pakilagay ang integer.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="112">
|
||||||
|
<source>Please select a valid language.</source>
|
||||||
|
<target>Piliin ang nararapat na lengguwahe.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="113">
|
||||||
|
<source>Please select a valid locale.</source>
|
||||||
|
<target>Pakipili ang nararapat na locale.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="114">
|
||||||
|
<source>Please enter a valid money amount.</source>
|
||||||
|
<target>Pakilagay ang tamang halaga ng pera.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="115">
|
||||||
|
<source>Please enter a number.</source>
|
||||||
|
<target>Ilagay ang numero.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="116">
|
||||||
|
<source>The password is invalid.</source>
|
||||||
|
<target>Hindi balido ang password.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="117">
|
||||||
|
<source>Please enter a percentage value.</source>
|
||||||
|
<target>Pakilagay ang tamang porsyento ng halaga.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="118">
|
||||||
|
<source>The values do not match.</source>
|
||||||
|
<target>Hindi tugma ang mga halaga.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="119">
|
||||||
|
<source>Please enter a valid time.</source>
|
||||||
|
<target>Pakilagay ang tamang oras.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="120">
|
||||||
|
<source>Please select a valid timezone.</source>
|
||||||
|
<target>Pakilagay ang tamang sona ng oras.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="121">
|
||||||
|
<source>Please enter a valid URL.</source>
|
||||||
|
<target>Pakilagay ang balidong URL.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="122">
|
||||||
|
<source>Please enter a valid search term.</source>
|
||||||
|
<target>Pakilagay ang balidong katagang sinasaliksik.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="123">
|
||||||
|
<source>Please provide a valid phone number.</source>
|
||||||
|
<target>Pakilagay ang balidong numero ng telepono.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<trans-unit id="28">
|
<trans-unit id="28">
|
||||||
<source>This form should not contain extra fields.</source>
|
<source>This form should not contain extra fields.</source>
|
||||||
<target>Mẫu này không nên chứa trường mở rộng</target>
|
<target>Mẫu này không nên chứa trường mở rộng.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="29">
|
<trans-unit id="29">
|
||||||
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
|
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
|
||||||
@ -14,6 +14,106 @@
|
|||||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||||
<target>CSRF token không hợp lệ. Vui lòng thử lại.</target>
|
<target>CSRF token không hợp lệ. Vui lòng thử lại.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="99">
|
||||||
|
<source>This value is not a valid HTML5 color.</source>
|
||||||
|
<target>Giá trị này không phải là màu HTML5 hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="100">
|
||||||
|
<source>Please enter a valid birthdate.</source>
|
||||||
|
<target>Vui lòng nhập ngày sinh hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="101">
|
||||||
|
<source>The selected choice is invalid.</source>
|
||||||
|
<target>Lựa chọn không hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="102">
|
||||||
|
<source>The collection is invalid.</source>
|
||||||
|
<target>Danh sách không hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="103">
|
||||||
|
<source>Please select a valid color.</source>
|
||||||
|
<target>Vui lòng chọn một màu hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="104">
|
||||||
|
<source>Please select a valid country.</source>
|
||||||
|
<target>Vui lòng chọn đất nước hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="105">
|
||||||
|
<source>Please select a valid currency.</source>
|
||||||
|
<target>Vui lòng chọn tiền tệ hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="106">
|
||||||
|
<source>Please choose a valid date interval.</source>
|
||||||
|
<target>Vui lòng chọn một khoảng thời gian hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="107">
|
||||||
|
<source>Please enter a valid date and time.</source>
|
||||||
|
<target>Vui lòng nhập ngày và thời gian hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="108">
|
||||||
|
<source>Please enter a valid date.</source>
|
||||||
|
<target>Vui lòng nhập ngày hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="109">
|
||||||
|
<source>Please select a valid file.</source>
|
||||||
|
<target>Vui lòng chọn tệp hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="110">
|
||||||
|
<source>The hidden field is invalid.</source>
|
||||||
|
<target>Phạm vi ẩn không hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="111">
|
||||||
|
<source>Please enter an integer.</source>
|
||||||
|
<target>Vui lòng nhập một số nguyên.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="112">
|
||||||
|
<source>Please select a valid language.</source>
|
||||||
|
<target>Vui lòng chọn ngôn ngữ hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="113">
|
||||||
|
<source>Please select a valid locale.</source>
|
||||||
|
<target>Vui lòng chọn miền hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="114">
|
||||||
|
<source>Please enter a valid money amount.</source>
|
||||||
|
<target>Vui lòng nhập một khoảng tiền hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="115">
|
||||||
|
<source>Please enter a number.</source>
|
||||||
|
<target>Vui lòng nhập một con số.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="116">
|
||||||
|
<source>The password is invalid.</source>
|
||||||
|
<target>Mật khẩu không hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="117">
|
||||||
|
<source>Please enter a percentage value.</source>
|
||||||
|
<target>Vui lòng nhập một giá trị phần trăm.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="118">
|
||||||
|
<source>The values do not match.</source>
|
||||||
|
<target>Các giá trị không phù hợp.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="119">
|
||||||
|
<source>Please enter a valid time.</source>
|
||||||
|
<target>Vui lòng nhập thời gian hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="120">
|
||||||
|
<source>Please select a valid timezone.</source>
|
||||||
|
<target>Vui lòng chọn múi giờ hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="121">
|
||||||
|
<source>Please enter a valid URL.</source>
|
||||||
|
<target>Vui lòng nhập một URL hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="122">
|
||||||
|
<source>Please enter a valid search term.</source>
|
||||||
|
<target>Vui lòng nhập chuỗi tìm kiếm hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="123">
|
||||||
|
<source>Please provide a valid phone number.</source>
|
||||||
|
<target>Vui lòng cung cấp số điện thoại hợp lệ.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -2003,6 +2003,24 @@ class ChoiceTypeTest extends BaseTypeTest
|
|||||||
$this->assertEquals('_09name', $view->vars['full_name']);
|
$this->assertEquals('_09name', $view->vars['full_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSubFormTranslationDomain()
|
||||||
|
{
|
||||||
|
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
||||||
|
'label' => 'label',
|
||||||
|
'translation_domain' => 'label_translation_domain',
|
||||||
|
'choices' => [
|
||||||
|
'choice1' => true,
|
||||||
|
'choice2' => false,
|
||||||
|
],
|
||||||
|
'choice_translation_domain' => 'choice_translation_domain',
|
||||||
|
'expanded' => true,
|
||||||
|
])->createView();
|
||||||
|
|
||||||
|
$this->assertCount(2, $form->children);
|
||||||
|
$this->assertSame('choice_translation_domain', $form->children[0]->vars['translation_domain']);
|
||||||
|
$this->assertSame('choice_translation_domain', $form->children[1]->vars['translation_domain']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideTrimCases
|
* @dataProvider provideTrimCases
|
||||||
*/
|
*/
|
||||||
|
@ -253,8 +253,12 @@ class PdoStore implements PersistingStoreInterface
|
|||||||
$this->addTableToSchema($schema);
|
$this->addTableToSchema($schema);
|
||||||
|
|
||||||
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -279,8 +283,12 @@ class PdoStore implements PersistingStoreInterface
|
|||||||
throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver));
|
throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
$conn->exec($sql);
|
$conn->exec($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the Table to the Schema if it doesn't exist.
|
* Adds the Table to the Schema if it doesn't exist.
|
||||||
@ -305,7 +313,12 @@ class PdoStore implements PersistingStoreInterface
|
|||||||
{
|
{
|
||||||
$sql = "DELETE FROM $this->table WHERE $this->expirationCol <= {$this->getCurrentTimestampStatement()}";
|
$sql = "DELETE FROM $this->table WHERE $this->expirationCol <= {$this->getCurrentTimestampStatement()}";
|
||||||
|
|
||||||
$this->getConnection()->exec($sql);
|
$conn = $this->getConnection();
|
||||||
|
if (method_exists($conn, 'executeStatement')) {
|
||||||
|
$conn->executeStatement($sql);
|
||||||
|
} else {
|
||||||
|
$conn->exec($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDriver(): string
|
private function getDriver(): string
|
||||||
|
@ -137,7 +137,7 @@ class Connection implements ResetInterface
|
|||||||
'available_at' => '?',
|
'available_at' => '?',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->executeUpdate($queryBuilder->getSQL(), [
|
$this->executeStatement($queryBuilder->getSQL(), [
|
||||||
$body,
|
$body,
|
||||||
json_encode($headers),
|
json_encode($headers),
|
||||||
$this->configuration['queue_name'],
|
$this->configuration['queue_name'],
|
||||||
@ -194,7 +194,7 @@ class Connection implements ResetInterface
|
|||||||
->set('delivered_at', '?')
|
->set('delivered_at', '?')
|
||||||
->where('id = ?');
|
->where('id = ?');
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
$this->executeUpdate($queryBuilder->getSQL(), [
|
$this->executeStatement($queryBuilder->getSQL(), [
|
||||||
$now,
|
$now,
|
||||||
$doctrineEnvelope['id'],
|
$doctrineEnvelope['id'],
|
||||||
], [
|
], [
|
||||||
@ -369,10 +369,14 @@ class Connection implements ResetInterface
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function executeUpdate(string $sql, array $parameters = [], array $types = [])
|
private function executeStatement(string $sql, array $parameters = [], array $types = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
if (method_exists($this->driverConnection, 'executeStatement')) {
|
||||||
|
$stmt = $this->driverConnection->executeStatement($sql, $parameters, $types);
|
||||||
|
} else {
|
||||||
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
|
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
|
||||||
|
}
|
||||||
} catch (TableNotFoundException $e) {
|
} catch (TableNotFoundException $e) {
|
||||||
if ($this->driverConnection->isTransactionActive()) {
|
if ($this->driverConnection->isTransactionActive()) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@ -382,8 +386,12 @@ class Connection implements ResetInterface
|
|||||||
if ($this->autoSetup) {
|
if ($this->autoSetup) {
|
||||||
$this->setup();
|
$this->setup();
|
||||||
}
|
}
|
||||||
|
if (method_exists($this->driverConnection, 'executeStatement')) {
|
||||||
|
$stmt = $this->driverConnection->executeStatement($sql, $parameters, $types);
|
||||||
|
} else {
|
||||||
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
|
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
@ -556,6 +556,7 @@ class OptionsResolver implements Options
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($forcePrepend) {
|
if ($forcePrepend) {
|
||||||
|
$this->normalizers[$option] = $this->normalizers[$option] ?? [];
|
||||||
array_unshift($this->normalizers[$option], $normalizer);
|
array_unshift($this->normalizers[$option], $normalizer);
|
||||||
} else {
|
} else {
|
||||||
$this->normalizers[$option][] = $normalizer;
|
$this->normalizers[$option][] = $normalizer;
|
||||||
|
@ -1512,6 +1512,17 @@ class OptionsResolverTest extends TestCase
|
|||||||
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
|
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testForcePrependNormalizerForResolverWithoutPreviousNormalizers()
|
||||||
|
{
|
||||||
|
// defined by superclass
|
||||||
|
$this->resolver->setDefault('foo', 'bar');
|
||||||
|
$this->resolver->addNormalizer('foo', function (Options $options, $value) {
|
||||||
|
return '1st-normalized-'.$value;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
$this->assertEquals(['foo' => '1st-normalized-bar'], $this->resolver->resolve());
|
||||||
|
}
|
||||||
|
|
||||||
public function testAddNormalizerFailsIfUnknownOption()
|
public function testAddNormalizerFailsIfUnknownOption()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
|
$this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');
|
||||||
|
Reference in New Issue
Block a user