Skip to content

Update message of ORMInvalidArgumentException #11845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ORMInvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private static function newEntityFoundThroughRelationshipMessage(array $associat
. ' configured to cascade persist operations for entity: ' . self::objToStr($entity) . '.'
. ' To solve this issue: Either explicitly call EntityManager#persist()'
. ' on this unknown entity or configure cascade persist'
. ' this association in the mapping for example @ManyToOne(..,cascade={"persist"}).'
. ' this association in the mapping for example #[ORM\ManyToOne(..., cascade: [\'persist\'])].'
. (method_exists($entity, '__toString')
? ''
: ' If you cannot find out which entity causes the problem implement \''
Expand Down
8 changes: 4 additions & 4 deletions tests/Tests/ORM/ORMInvalidArgumentExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __toString(): string
. 'persist operations for entity: stdClass@' . spl_object_id($entity1)
. '. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity '
. 'or configure cascade persist this association in the mapping for example '
. '@ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem '
. '#[ORM\ManyToOne(..., cascade: [\'persist\'])]. If you cannot find out which entity causes the problem '
. 'implement \'baz1#__toString()\' to get a clue.',
],
'two entities found' => [
Expand All @@ -104,13 +104,13 @@ public function __toString(): string
. 'cascade persist operations for entity: stdClass@' . spl_object_id($entity1) . '. '
. 'To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity '
. 'or configure cascade persist this association in the mapping for example '
. '@ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem '
. '#[ORM\ManyToOne(..., cascade: [\'persist\'])]. If you cannot find out which entity causes the problem '
. 'implement \'baz1#__toString()\' to get a clue.' . "\n"
. ' * A new entity was found through the relationship \'foo2#bar2\' that was not configured to '
. 'cascade persist operations for entity: stdClass@' . spl_object_id($entity2) . '. To solve '
. 'this issue: Either explicitly call EntityManager#persist() on this unknown entity or '
. 'configure cascade persist this association in the mapping for example '
. '@ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem '
. '#[ORM\ManyToOne(..., cascade: [\'persist\'])]. If you cannot find out which entity causes the problem '
. 'implement \'baz2#__toString()\' to get a clue.',
],
'two entities found, one is stringable' => [
Expand All @@ -124,7 +124,7 @@ public function __toString(): string
. 'persist operations for entity: ThisIsAStringRepresentationOfEntity3'
. '. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity '
. 'or configure cascade persist this association in the mapping for example '
. '@ManyToOne(..,cascade={"persist"}).',
. '#[ORM\ManyToOne(..., cascade: [\'persist\'])].',
],
];
}
Expand Down