Release 1.19.2 (#3244)
This commit is contained in:
@@ -54,39 +54,13 @@ trait StringAccessibleConfigTrait
|
||||
return;
|
||||
}
|
||||
|
||||
// this foreach should be replaced by a better piece of code,
|
||||
// especially the pointers could be a problem in the future
|
||||
foreach ($this->getConfigurations($this->repository) as $configuration) {
|
||||
$temp = explode('.', $configuration->getName());
|
||||
$this->setConfiguration($temp, $configuration->getValue());
|
||||
$this->set($configuration->getName(), $configuration->getValue());
|
||||
}
|
||||
|
||||
$this->initialized = true;
|
||||
}
|
||||
|
||||
private function setConfiguration(array $keys, ?string $value): void
|
||||
{
|
||||
$array = &$this->settings;
|
||||
if ($keys[0] === $this->getPrefix()) {
|
||||
$keys = \array_slice($keys, 1);
|
||||
}
|
||||
foreach ($keys as $key2) {
|
||||
if (!\array_key_exists($key2, $array)) {
|
||||
$array[$key2] = $value;
|
||||
continue;
|
||||
}
|
||||
if (\is_array($array[$key2])) {
|
||||
$array = &$array[$key2];
|
||||
} elseif (\is_bool($array[$key2])) {
|
||||
$array[$key2] = (bool) $value;
|
||||
} elseif (\is_int($array[$key2])) {
|
||||
$array[$key2] = (int) $value;
|
||||
} else {
|
||||
$array[$key2] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -186,7 +160,7 @@ trait StringAccessibleConfigTrait
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->setConfiguration(explode('.', $offset), $value);
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,4 +171,43 @@ trait StringAccessibleConfigTrait
|
||||
{
|
||||
throw new \BadMethodCallException('SystemBundleConfiguration does not support offsetUnset()');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array item to a given value using "dot" notation.
|
||||
*
|
||||
* If no key is given to the method, the entire array will be replaced.
|
||||
*
|
||||
* @see https://github.com/divineomega/array_undot
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function set(string $key, $value): array
|
||||
{
|
||||
$array = &$this->settings;
|
||||
$keys = explode('.', $key);
|
||||
while (\count($keys) > 1) {
|
||||
$key = array_shift($keys);
|
||||
if (!isset($array[$key]) || !\is_array($array[$key])) {
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
$array = &$array[$key];
|
||||
}
|
||||
|
||||
$k = array_shift($keys);
|
||||
|
||||
if (\array_key_exists($k, $array)) {
|
||||
if (\is_bool($array[$k])) {
|
||||
$value = (bool) $value;
|
||||
} elseif (\is_int($array[$k])) {
|
||||
$value = (int) $value;
|
||||
}
|
||||
}
|
||||
|
||||
$array[$k] = $value;
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ class Constants
|
||||
/**
|
||||
* The current release version
|
||||
*/
|
||||
public const VERSION = '1.19.1';
|
||||
public const VERSION = '1.19.2';
|
||||
/**
|
||||
* The current release: major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
public const VERSION_ID = 11901;
|
||||
public const VERSION_ID = 11902;
|
||||
/**
|
||||
* The current release status, either "stable" or "dev"
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
|
||||
public const MIN_TIMESHEETS_PER_USER = 50;
|
||||
public const MAX_TIMESHEETS_PER_USER = 500;
|
||||
public const MAX_TIMESHEETS_TOTAL = 200;
|
||||
public const MAX_RUNNING_TIMESHEETS_PER_USER = 1;
|
||||
public const MIN_MINUTES_PER_ENTRY = 15;
|
||||
public const MAX_MINUTES_PER_ENTRY = 840; // 14h
|
||||
public const MAX_DESCRIPTION_LENGTH = 200;
|
||||
@@ -87,7 +86,7 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
|
||||
if ($i % 3 === 0) {
|
||||
$description = $faker->realText($faker->numberBetween(10, self::MAX_DESCRIPTION_LENGTH));
|
||||
} elseif ($i % 7 === 0) {
|
||||
$description = substr($faker->text, 0, self::MAX_DESCRIPTION_LENGTH);
|
||||
$description = substr($faker->text(), 0, self::MAX_DESCRIPTION_LENGTH);
|
||||
}
|
||||
|
||||
$entry = $this->createTimesheetEntry(
|
||||
@@ -109,8 +108,7 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
|
||||
}
|
||||
|
||||
// create active recordings for test user
|
||||
$activeEntries = rand(0, self::MAX_RUNNING_TIMESHEETS_PER_USER);
|
||||
for ($i = 0; $i < $activeEntries; $i++) {
|
||||
if (rand(0, 10) >= 5) {
|
||||
$entry = $this->createTimesheetEntry(
|
||||
$user,
|
||||
$activities[array_rand($activities)],
|
||||
|
||||
@@ -82,7 +82,7 @@ class ProjectType extends AbstractType
|
||||
$name = $this->getPattern();
|
||||
$name = str_replace(self::PATTERN_NAME, $project->getName(), $name);
|
||||
$name = str_replace(self::PATTERN_COMMENT, $project->getComment() ?? '', $name);
|
||||
$name = str_replace(self::PATTERN_ORDERNUMBER, $project->getOrderNumber(), $name);
|
||||
$name = str_replace(self::PATTERN_ORDERNUMBER, $project->getOrderNumber() ?? '', $name);
|
||||
$name = str_replace(self::PATTERN_START, $start, $name);
|
||||
$name = str_replace(self::PATTERN_END, $end, $name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user