-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Extract AssociationMapping in its own DTO #10613
Conversation
I've tried splitting out |
This comment was marked as resolved.
This comment was marked as resolved.
'isCascadeRefresh' => $this->isCascadeRefresh(), | ||
'isCascadeDetach' => $this->isCascadeDetach(), | ||
'isCascadeMerge' => $this->isCascadeMerge(), | ||
default => $this->$offset, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure the property exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we? If we don't, we'll get the same behavior when using $mapping['offset']
as when using $mapping->offset
, and IMO we want that, because it means one less difference when migrating to the object API.
>>> $mapping['foo'];
<warning>PHP Warning: Undefined property: Doctrine\Tests\ORM\Mapping\MyAssociationMapping::$foo in /home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php on line 213</warning>
=> null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, this is just a warning and for setter part, it's even just a deprecation on PHP 8.2. Being more strict allows us to spot places where we forgot to add a property.
If accessing dynamic properties is what we want here, we should opt-in via #[AllowDynamicProperties]
.
I feel like we've had that discussion already. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we very much did 😆 I can add an exception if you insist. Will \InvalidArgumentException
suit you, since this is probably not meant to be caught? If not, please let me know what type you want exactly, to avoid more back and forth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking as draft because adding an exception shows there are cases where I fetch properties that do not exist:
1) Doctrine\Tests\ORM\Functional\CompositePrimaryKeyWithAssociationsTest::testFindByAbleToGetCompositeEntitiesWithMixedTypeIdentifiers
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyWithAssociationsTest.php:40
2) Doctrine\Tests\ORM\Functional\SecondLevelCacheCompositePrimaryKeyWithAssociationsTest::testFindByReturnsCachedEntity
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php:277
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheCompositePrimaryKeyWithAssociationsTest.php:47
3) Doctrine\Tests\ORM\Functional\SecondLevelCacheManyToOneTest::testPutAndLoadNonCacheableManyToOne
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php:277
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheManyToOneTest.php:195
4) Doctrine\Tests\ORM\Functional\SecondLevelCacheManyToOneTest::testPutAndLoadNonCacheableCompositeManyToOne
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php:277
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheManyToOneTest.php:233
5) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToManyTest::testPutAndLoadNonCacheableOneToMany
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php:277
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php:406
6) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToOneTest::testPutAndLoadNonCacheableOneToOne
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php:277
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php:267
7) Doctrine\Tests\ORM\Functional\Ticket\DDC117Test::testReferencesToForeignKeyEntities
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:276
8) Doctrine\Tests\ORM\Functional\Ticket\DDC117Test::testLoadManyToManyCollectionOfForeignKeyEntities
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:391
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:301
9) Doctrine\Tests\ORM\Functional\Ticket\DDC117Test::testClearManyToManyCollectionOfForeignKeyEntities
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:391
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:318
10) Doctrine\Tests\ORM\Functional\Ticket\DDC117Test::testLoadInverseManyToManyCollection
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:391
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:332
11) Doctrine\Tests\ORM\Functional\Ticket\DDC117Test::testLoadOneToManyOfSourceEntityWithAssociationIdentifier
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:391
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php:357
12) Doctrine\Tests\ORM\Functional\Ticket\DDC2252Test::testIssue
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyOwningSideMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php:416
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php:57
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:401
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php:75
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php:50
13) Doctrine\Tests\ORM\Functional\Ticket\GH7062Test::testEntityWithAssociationKeyIdentityCanBeUpdated
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:661
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:686
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:236
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:1021
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:384
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php:58
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php:44
14) Doctrine\Tests\ORM\Persisters\BasicEntityPersisterCompositeTypeParametersTest::testExpandParametersWillExpandCompositeEntityKeys
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:1844
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:1777
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php:38
15) Doctrine\Tests\ORM\Persisters\BasicEntityPersisterCompositeTypeParametersTest::testExpandCriteriaParametersWillExpandCompositeEntityKeys
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\OneToManyAssociationMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:1844
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:858
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php:52
16) Doctrine\Tests\ORM\Persisters\ManyToManyPersisterTest::testDeleteManyToManyCollection
InvalidArgumentException: Unknown property joinColumns on class Doctrine\ORM\Mapping\ManyToManyOwningSideMapping
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Mapping/AssociationMapping.php:220
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Utility/PersisterHelper.php:73
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php:416
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php:57
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/UnitOfWork.php:401
/home/gregoire/dev/doctrine-orm/lib/Doctrine/ORM/EntityManager.php:267
/home/gregoire/dev/doctrine-orm/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php:45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, as well as a similar condition below. The warnings/exceptions have disappear, please advise on
orm/lib/Doctrine/ORM/Utility/PersisterHelper.php
Lines 78 to 82 in e5fb1a4
// iterate over to-one association mappings | |
foreach ($class->associationMappings as $assoc) { | |
if (! isset($assoc['joinColumns'])) { | |
continue; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will
\InvalidArgumentException
suit you, since this is probably not meant to be caught?
I tried hard to resist my impulse to nit-pick here, but… … …
OutOfBoundsException
was made for this.
Sorry. 😓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, actually OutOfRangeException
because the caller could have known in advance that the key is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, the exception is just temporary. Any of these three would do.
🏃🏻♂️💨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutOfRangeException
it is then… indeed, it looks perfectly suited to this 👍
9614e46
to
5b8629c
Compare
3198a1a
to
67fcf67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those instanceof
checks of mappings are reoccurring multiple times. I'd prefer to have them in their own mapping-methods for simplicity.
$value = JoinTableMapping::fromMappingArray($value); | ||
} | ||
|
||
$this->$offset = $value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutOfRangeException
if property does not exist.
67fcf67
to
74d7ac7
Compare
I just pushed a new version where I introduce more of those methods. There are still |
74d7ac7
to
4225b43
Compare
4225b43
to
14d6152
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 but there's an unaddressed comment #10613 (comment)
@SenseException @derrabus I actually addressed that comment by introducing a few lines of code above, which might explain why that diff is not marked as outdated. |
No description provided.