Route entity.poll.add_form not recognized in Poll 2.0.0-alpha5

Created on 14 June 2025, 28 days ago

The route `entity.poll.add_form` defined in `poll.routing.yml` is not recognized, causing a `Symfony\Component\Routing\Exception\RouteNotFoundException` when trying to access it (e.g., via `Url::fromRoute('entity.poll.add_form')`). Additionally, `drush route:list` fails with an error, complicating debugging.

**Steps to reproduce**:
1. Install Drupal 10.3.x with Poll module 2.0.0-alpha5.
2. Enable the Poll module (`drush pm:enable poll`).
3. Clear caches (`drush cr`).
4. Attempt to access the route `entity.poll.add_form` (e.g., via a custom block using `Url::fromRoute('entity.poll.add_form')` or by visiting `/poll/add`).
5. Run `drush route:list | grep entity.poll.add_form`.

**Expected result**:
- The route `entity.poll.add_form` should be available and point to `/poll/add` with the form `poll.default` (as defined in `poll.routing.yml`).
- `drush route:list` should list the route.

**Actual result**:
- Accessing `entity.poll.add_form` throws `RouteNotFoundException: Route "entity.poll.add_form" does not exist`.
- `drush route:list` fails with `There are no commands defined in the "route" namespace`.
- Running `drush php:eval "print_r(array_keys(\Drupal::service('router.route_provider')->getAllRoutes()));"` throws `TypeError: array_keys(): Argument #1 ($array) must be of type array, ArrayIterator given`.

**Environment**:
- Drupal: 10.3.x
- PHP: [Your PHP version, e.g., 8.2.x]
- Drush: [Your Drush version, e.g., 12.x]
- Poll: 2.0.0-alpha5
- Other relevant modules: None

**Additional details**:
- `poll.routing.yml` defines `entity.poll.add_form` correctly, but the route is not registered.
- The permission `create poll` may not be properly defined or assigned (needs verification).
- `src/Form/PollForm.php` exists, suggesting the form `poll.default` is implemented, but the route fails to register.
- The Drush error suggests a compatibility issue with Drush or a bug in the Poll module's entity/route handling.

**Suggested next steps**:
- Verify the entity definition for `poll` in `src/Entity/Poll.php` and `src/Form/PollForm.php`.
- Check if the permission `create poll` is defined in `poll.permissions.yml` and assigned correctly.
- Investigate why `drush route:list` fails (possible Drush or Poll bug).
- Test with a newer Drush version (e.g., Drush 12.x).

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France chsdaiguil Coteaux-du-lyonnais

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024