Skip to content

Commit

Permalink
fix: Fixed RequestDataCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Jul 12, 2024
1 parent 1d9d203 commit 4aa997a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/RoadizCoreBundle/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ services:
- '../src/Traits/'
- '../src/Kernel.php'
- '../src/Tests/'
- '../src/DataCollector/'
- '../src/Event/'

RZ\Roadiz\CoreBundle\EntityHandler\:
Expand Down
17 changes: 5 additions & 12 deletions lib/RoadizCoreBundle/src/DataCollector/RequestDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace RZ\Roadiz\CoreBundle\DataCollector;

use PackageVersions\Versions;
use Symfony\Bundle\FrameworkBundle\DataCollector\AbstractDataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -22,20 +21,14 @@ public function __construct(
*/
public function collect(Request $request, Response $response, \Throwable $exception = null): void
{
$this->data = [];
$this->data = [
'version' => implode(' - ', array_filter([$this->cmsVersionPrefix, $this->cmsVersion])),
];
}

public function getVersion(): ?string
public function getVersion(): string
{
$fallback = implode(' - ', array_filter([$this->cmsVersionPrefix, $this->cmsVersion]));
if (!class_exists(Versions::class)) {
return $fallback;
}

$version = Versions::getVersion('roadiz/core-bundle');
preg_match('/^v(.*?)@/', $version, $output);

return $output[1] ?? strtok($version, '@') ?: $fallback;
return $this->data['version'];
}

public static function getTemplate(): ?string
Expand Down

0 comments on commit 4aa997a

Please sign in to comment.