[Feature] Allow primary key loader to lookup by relation
Opened this issue · 0 comments
dkarlovi commented
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Branch? | master |
If object_resolver
is attached to the property which is a primary identifier, we could run it before the object is looked up. If it matches an object, we load by its ID.
This would allow stuff like
Supplier | Supplier ID
Newegg | 12345
to be used as a primary identifier, basically using our Supplier object and their (supplier-specific) ID to look up our own object:
TLDR
- we run the
object_resolver
which is defined withName
field - it finds
/orgs/newegg
, ID=123 - we add contion:
$condition[] = '`'.$map->getToColumn().'__id` = ?';
$conditionValues[] = $object->getId();
$condition[] = '`'.$map->getToColumn().'__type` = ?';
$conditionValues[] = 'object';