Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2018 at 20:12 UTC
Updated:
30 Jan 2023 at 20:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ioana apetri commentedComment #3
ioana apetri commentedHere is the documentation added. Please review. Thanks:)
Comment #4
joachim commentedLooks good.
Thanks!
Comment #5
wim leersThanks for helping to improve our documentation!
s/id/ID/
("IDs" later in the sentence gets it right.)
Comment #6
dhirendra.mishra commentedComment #7
dhirendra.mishra commentedComment #8
dhirendra.mishra commentedComment #9
joachim commentedThanks!
Comment #10
alexpottIf we're going to document this behaviour couldn't we do it with an @throws?
However thinking about this conceptually should we catch the exception in \Drupal\Core\Entity\Entity::uriRelationships i.e do something like:
The text at the top is interesting as it says
and what we're saying is that until the entity has an ID it doesn't support any URI relationships so this returns an empty array - rather than throwing an exception.
Comment #11
alexpottTagging for subsystem maintainer review.
Comment #12
hchonov#2924338: Entity::uriRelationships() throws exceptions if an URL cannot be generated because of missing mandatory parameters is a similar issue and even has a patch.
@alexpott, shouldn't the thrown exception here be of type
MissingMandatoryParametersExceptionlike in the other issue?Yes, I think we should catch the exceptions that are thrown if we could not generate a URL because of missing parameters. I think the solution for both issues has to be the same, as
\Drupal\Core\Entity\Entity::uriRelationships()should not throw exceptions, but instead filter out the URI relationships that couldn't be automatically generated.If you are fine with this I would close the current issue as a duplicate and move the discussion to the referenced one.
Comment #13
alexpott@hchonov yep I agree this is a duplicate of that.
Comment #14
s.messaris commentedI don't know if this is the right place for this, but the patch commited in #2924338 only catches
MissingMandatoryParametersException, but there is also the case where anEntityMalformedExceptionis thrown, so I am reopening this so we can fix it. In the spirit of #2924338, I am attaching a patch that catches that as well.Comment #15
dhirendra.mishra commentedLooks ok..
Comment #22
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.