Description
Environment
Symfony packages
$ composer show --latest 'symfony/*'
symfony/asset v6.0.3 v6.0.3 Manages URL generation and versioning of web assets such as CSS...
symfony/browser-kit v6.0.3 v6.0.3 Simulates the behavior of a web browser, allowing you to make r...
symfony/cache v6.0.3 v6.0.3 Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts v3.0.0 v3.0.0 Generic abstractions related to caching
symfony/config v6.0.3 v6.0.3 Helps you find, load, combine, autofill and validate configurat...
symfony/console v6.0.3 v6.0.3 Eases the creation of beautiful and testable command line inter...
symfony/css-selector v6.0.3 v6.0.3 Converts CSS selectors to XPath expressions
symfony/debug-bundle v6.0.3 v6.0.3 Provides a tight integration of the Symfony VarDumper component...
symfony/dependency-injection v6.0.3 v6.0.3 Allows you to standardize and centralize the way objects are co...
symfony/deprecation-contracts v3.0.0 v3.0.0 A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge v6.0.3 v6.0.3 Provides integration for Doctrine with various Symfony components
symfony/dom-crawler v6.0.3 v6.0.3 Eases DOM navigation for HTML and XML documents
symfony/dotenv v6.0.3 v6.0.3 Registers environment variables from a .env file
symfony/error-handler v6.0.3 v6.0.3 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v6.0.3 v6.0.3 Provides tools that allow your application components to commun...
symfony/event-dispatcher-contracts v3.0.0 v3.0.0 Generic abstractions related to dispatching event
symfony/expression-language v6.0.3 v6.0.3 Provides an engine that can compile and evaluate expressions
symfony/filesystem v6.0.3 v6.0.3 Provides basic utilities for the filesystem
symfony/finder v6.0.3 v6.0.3 Finds files and directories via an intuitive fluent interface
symfony/flex v2.1.4 v2.1.4 Composer plugin for Symfony
symfony/form v6.0.3 v6.0.3 Allows to easily create, process and reuse HTML forms
symfony/framework-bundle v6.0.4 v6.0.4 Provides a tight integration between Symfony components and the...
symfony/http-client v6.0.3 v6.0.3 Provides powerful methods to fetch HTTP resources synchronously...
symfony/http-client-contracts v3.0.0 v3.0.0 Generic abstractions related to HTTP clients
symfony/http-foundation v6.0.3 v6.0.3 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v6.0.4 v6.0.4 Provides a structured process for converting a Request into a R...
symfony/intl v6.0.3 v6.0.3 Provides a PHP replacement layer for the C intl extension that ...
symfony/mailer v6.0.3 v6.0.3 Helps sending emails
symfony/maker-bundle v1.36.4 v1.36.4 Symfony Maker helps you create empty commands, controllers, for...
symfony/mime v6.0.3 v6.0.3 Allows manipulating MIME messages
symfony/monolog-bridge v6.0.3 v6.0.3 Provides integration for Monolog with various Symfony components
symfony/monolog-bundle v3.7.1 v3.7.1 Symfony MonologBundle
symfony/notifier v6.0.3 v6.0.3 Sends notifications via one or more channels (email, SMS, ...)
symfony/options-resolver v6.0.3 v6.0.3 Provides an improved replacement for the array_replace PHP func...
symfony/password-hasher v6.0.3 v6.0.3 Provides password hashing utilities
symfony/phpunit-bridge v6.0.3 v6.0.3 Provides utilities for PHPUnit, especially user deprecation not...
symfony/polyfill-intl-grapheme v1.24.0 v1.24.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu v1.24.0 v1.24.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.24.0 v1.24.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer v1.24.0 v1.24.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.24.0 v1.24.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php81 v1.24.0 v1.24.0 Symfony polyfill backporting some PHP 8.1+ features to lower PH...
symfony/polyfill-uuid v1.24.0 v1.24.0 Symfony polyfill for uuid functions
symfony/process v6.0.3 v6.0.3 Executes commands in sub-processes
symfony/property-access v6.0.3 v6.0.3 Provides functions to read and write from/to an object or array...
symfony/property-info v6.0.3 v6.0.3 Extracts information about PHP class' properties using metadata...
symfony/proxy-manager-bridge v6.0.3 v6.0.3 Provides integration for ProxyManager with various Symfony comp...
symfony/routing v6.0.3 v6.0.3 Maps an HTTP request to a set of configuration variables
symfony/runtime v6.0.3 v6.0.3 Enables decoupling PHP applications from global state
symfony/security-bundle v6.0.3 v6.0.3 Provides a tight integration of the Security component into the...
symfony/security-core v6.0.3 v6.0.3 Symfony Security Component - Core Library
symfony/security-csrf v6.0.3 v6.0.3 Symfony Security Component - CSRF Library
symfony/security-http v6.0.3 v6.0.3 Symfony Security Component - HTTP Integration
symfony/serializer v6.0.3 v6.0.3 Handles serializing and deserializing data structures, includin...
symfony/service-contracts v3.0.0 v3.0.0 Generic abstractions related to writing services
symfony/stopwatch v6.0.3 v6.0.3 Provides a way to profile code
symfony/string v6.0.3 v6.0.3 Provides an object-oriented API to strings and deals with bytes...
symfony/translation v6.0.3 v6.0.3 Provides tools to internationalize your application
symfony/translation-contracts v3.0.0 v3.0.0 Generic abstractions related to translation
symfony/twig-bridge v6.0.3 v6.0.3 Provides integration for Twig with various Symfony components
symfony/twig-bundle v6.0.3 v6.0.3 Provides a tight integration of Twig into the Symfony full-stac...
symfony/uid v6.0.3 v6.0.3 Provides an object-oriented API to generate and represent UIDs
symfony/validator v6.0.3 v6.0.3 Provides tools to validate values
symfony/var-dumper v6.0.3 v6.0.3 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter v6.0.3 v6.0.3 Allows exporting any serializable PHP data structure to plain P...
symfony/web-link v6.0.3 v6.0.3 Manages links between resources
symfony/web-profiler-bundle v6.0.3 v6.0.3 Provides a development tool that gives detailed information abo...
symfony/webpack-encore-bundle v1.13.2 v1.13.2 Integration with your Symfony app & Webpack Encore!
symfony/yaml v6.0.3 v6.0.3 Loads and dumps YAML files
Symfony CMF packages
$ composer show --latest 'symfony-cmf/*'
symfony-cmf/routing 3.0.0 3.0.0 Extends the Symfony routing component for dynamic routes and chaining sever...
symfony-cmf/routing-bundle 3.0.0 3.0.0 Symfony RoutingBundle
Subject
After installing the package on a fresh Symfony (--full) installation with doctrine ORM, I am trying to test the package but I have the following error message when I try to execute the doctrine:migration:diff
command:
The class 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route' was not found in the chain configured namespaces App\Entity
Steps to reproduce
Install the package composer require symfony-cmf/routing-bundle
then add a config file:
cmf_routing:
chain:
routers_by_id:
router.default: 200
cmf_routing.dynamic_router: 100
dynamic:
persistence:
orm:
enabled: true
Add the routes
config inside an existing Entity. Here an example:
<?php
namespace App\Entity;
use App\Identifier\EventId;
use App\Repository\EventRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Cmf\Component\Routing\RouteReferrersInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
#[ORM\Entity(repositoryClass: EventRepository::class)]
#[ORM\Index(fields: ['name'])]
#[ORM\Index(fields: ['startDate'])]
class Event implements RouteReferrersInterface
{
#[ORM\Id]
#[ORM\Column(type: 'string', length: 64, unique: true)]
private string $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name;
#[ORM\Column(type: 'datetime')]
private ?\DateTimeInterface $startDate;
#[ORM\Column(type: 'datetime')]
private ?\DateTimeInterface $endDate;
#[ORM\ManyToMany(targetEntity: Route::class, cascade: ['persist', 'remove'])]
private ArrayCollection $routes;
public function __construct()
{
$this->id = (string) EventId::generate();
$this->routes = new ArrayCollection();
}
public function getId(): string
{
return $this->id;
}
public function getRoutes(): ArrayCollection
{
return $this->routes;
}
public function setRoutes(ArrayCollection $routes): void
{
$this->routes = $routes;
}
public function addRoute($route): void
{
$this->routes[] = $route;
}
public function removeRoute($route): void
{
$this->routes->removeElement($route);
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->startDate;
}
public function setStartDate(\DateTimeInterface $startDate): void
{
$this->startDate = $startDate;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(\DateTimeInterface $endDate): void
{
$this->endDate = $endDate;
}
public function __toString(): string
{
return $this->name.' '.$this->startDate->format('d/m/Y');
}
}
Then, try to create a migration bin/console doctrine:migration:diff
.
Expected results
Migration created.
Actual results
The class 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route' was not found in the chain configured namespaces App\Entity
Nota Bene
I tried to register this bundle manually inside the doctrine config:
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
CmfRoutingBundle:
alias: CmfRoutingBundle
prefix: Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm
dir: "%kernel.project_dir%/vendor/symfony-cmf/routing-bundle/src/Doctrine/Orm"
But another error happens:
Class "Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route" sub class of "Symfony\Cmf\Bundle\RoutingBundle\Model\Route" is not a valid entity or mapped super class.
And I think this bundle does not need this manual config when I read the \Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle::buildOrmCompilerPass
function that seems to do the job.