Skip to content
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

[Feature] Allow primary key loader to lookup by relation #386

Open
dkarlovi opened this issue Jan 19, 2023 · 0 comments
Open

[Feature] Allow primary key loader to lookup by relation #386

dkarlovi opened this issue Jan 19, 2023 · 0 comments

Comments

@dkarlovi
Copy link
Collaborator

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

  1. we run the object_resolver which is defined with Name field
  2. it finds /orgs/newegg, ID=123
  3. we add contion:
$condition[] = '`'.$map->getToColumn().'__id` = ?';
$conditionValues[] = $object->getId();

$condition[] = '`'.$map->getToColumn().'__type` = ?';
$conditionValues[] = 'object';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant