- Issue created by @dieterholvoet
- 🇧🇪Belgium dieterholvoet Brussels
I'm not sure where the
field_domain_source_url
field is supposed to come from. It doesn't seem to be part of the Domain module. I left it out for now, but feel free to add it back if necessary. - 🇧🇪Belgium dieterholvoet Brussels
Something else I took the liberty to fix: when decorating a service, you're not supposed to extend the original class. You're supposed to implement the service, inject the original class and call it as a service when necessary. By doing this, you don't need to inject all dependencies the parent needs and the class won't break if the constructor of the parent changes.
- Status changed to Needs review
6 months ago 3:33pm 11 June 2024 - 🇫🇷France jenue1933 Bordeaux
Hi!
LGFM, thx for your contribution. Can you update your MR and add some related functional tests plz?
- 🇫🇷France jenue1933 Bordeaux
field_domain_source_url
came from my personal project. I forgot to clean it when I pushed on d.org. - Status changed to Fixed
4 months ago 9:44pm 19 August 2024 - 🇮🇳India chiragkparikh
This works amazingly well, thanks!
But when I was trying install this in an environment by importing config and there was no domain source assigned for any node, I used to get an error saying the function
getDomainIdByRequest
is returning NULL (when an empty string is expected).So, I modified that function slightly to fix this:
public function getDomainIdByRequest(?Request $request = NULL): string { $request ??= $this->requestStack->getCurrentRequest(); $domainId = $request?->request->get('field_domain_source') ?? $this->domainNegotiator->getActiveDomain()?->id(); return $domainId !== null ? $domainId : ''; }
I hope this is fine!