Repository navigation
Birthday backend injection - #332
Merged
Merged
Conversation
Saving or deleting an address book from the admin syncs the user's birthday calendar, but the birthday service only gets its CalDAV backend from the DAV server plugin and the sync command. With a contact that has a birthday, the sync then failed with "Call to a member function createCalendarObject() on null" and the admin showed a 500. Set the backend the same way the sync command does before both syncUser() calls. Fixes #328
The birthday service only got its CalDAV backend through setBackend(), which the DAV server plugin and the sync command called, so any other caller had to remember it. Get the backend from the container instead, as a constructor argument, and remove setBackend(). The plugin and the command no longer deal with the backend, and the admin address book actions no longer need to set it. The service is lazy: building the backend opens the database connection, and the sync command is built on every console run.
The backend was built by the container, from two inline services in services.yaml, and the service had to be lazy so that depending on it would not open the database connection. Inject the DBAL connection instead and build the backend in the service the first time it is needed. The service definition goes back to what it was, and no lazy proxy is involved.
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.