solspace / craft-calendar

Calendar for Craft: The most reliable and powerful event management plugin for Craft.
http://docs.solspace.com/craft/calendar/v5
Other
15 stars 16 forks source link

Events broken after Craft 4-5 upgrade ("Argument #2 ($title) must be of type string") #302

Closed btbunze closed 4 months ago

btbunze commented 4 months ago

Describe the bug or issue you're experiencing

After upgrading my site from Craft 4 (4.10.5) to Craft 5 (5.2.6), existing calendar events seem to be broken. On the Calendar plugin's Events tab, the events listed are shown as "Event #" instead of their title (e.g. "Event 1"), and when I click into an event in that view, Craft crashes and the following error is shown in the browser:

Solspace\Calendar\Controllers\EventsController::renderEditForm(): Argument #2 ($title) must be of type string, null given, called in /var/www/html/vendor/solspace/craft-calendar/packages/plugin/src/Controllers/EventsController.php on line 180

The upgrade from Craft 4-5 itself doesn't run into any issues, and the calendar configuration stays the same (including event fields). Attempting to retrieve the events via graphql results in the following output:

...
"events": [
  {
    "title": null,
    "postDate": "2021-07-09 13:50:00"
  },
  {
    "title": null,
    "postDate": "2021-09-14 10:57:00"
  },
  ...
]
...

Steps to reproduce

  1. Create new craft 4 project with ddev
  2. Add calendar plugin from plugin store
  3. Create an event
  4. Follow Craft 4-5 upgrade steps

Expected behavior

After Craft 4-5 upgrade, event titles are visible in the "Events" tab of the admin panel, an edit form is shown when an event is clicked, and event data (for all existing fields) is still available.

Craft & Plugin Info (please complete the following information):

kjmartens commented 4 months ago

Hi @btbunze,

Have you run the following in your command line interface? 🙂

./craft calendar/events/fix-titles

https://docs.solspace.com/craft/calendar/v5/developer/console-commands/#migrate-craft-4-element-titles

btbunze commented 4 months ago

Hi @kjmartens,

I hadn't! Running it seems to have solved my problem. Thank you.