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

[WIP][REFERENCE] Relationships know limitations / edge cases #4012

Closed
4 of 6 tasks
pxpm opened this issue Dec 15, 2021 · 4 comments
Closed
4 of 6 tasks

[WIP][REFERENCE] Relationships know limitations / edge cases #4012

pxpm opened this issue Dec 15, 2021 · 4 comments

Comments

@pxpm
Copy link
Contributor

pxpm commented Dec 15, 2021

  • BelongsToMany/MorphToMany with pivot fields

    • ⚠️ need manual code and an ajax field to don't allow the selection of the same entry as pivot relation - fixed by [Pivot Relations] Pivot Selector should not allow to re-select the same. #4064
    • don't allow re-order of items, we can
      • (A) unsync and sync again everytime the entry is updated, might mess with id column in pivot, and/or timestamps
      • (B) create a way of repeatable storing the order in a defined developer column
  • HasOne / MorphOne

    • unable to add nested belongsTo subfields by foreign_id (they work as relationName though)
    • relations with pivot cannot be chainned (I have a PR to fix this, will submit after the "regular scenarios" are working)
    • cannot delete data from HasOne input (see [Bug] Unable to save empty input with relation HasOne #3944)
  • HasMany / MorphMany

    • after GRR Step 5 - HasMany and MorphMany (Granular Relationships Refactor) #4016, when using the repeatable field for these relationships, the up/down arrows will not show (repeatable will have reorder => false on it); we should add a new attribute & functionality to the repeatable field: order_input (default null); when order_field is not null, we assume there's an input inside the group that stores the order, with that name; so we take that into account in the JS, by
      • respecting that order at pageload;
      • updating those hidden inputs when the arrows are pressed, with the new order;
@tabacitu
Copy link
Member

tabacitu commented Jan 7, 2022

In addition to the quirks above, we also have the following things to do after #4054 (for reference, we have a breakdown of all relationships and their interfaces here).

TODOs:

As of this moment, I think we should only do the quirks and the MUSTs. The other stuff can wait until 4.2.x, they will be non-breaking changes. Instead of aborting in those cases, it'll show a field.

@tabacitu
Copy link
Member

tabacitu commented Jan 9, 2022

@pxpm head's up, I just finished the docs for relationship on 4.2 and I've decided we're going to use subfields (not fields, not pivotFields). From now on, we're going to use subfields for both relationship and repeatable (but the code should still work if you give fields or pivotFields, as aliases). I've written more about this here - Laravel-Backpack/docs#303 if you want. Feel free to argue with me if you think this is a bad direction.

@tabacitu
Copy link
Member

Update - I'm done refactoring and merging things inside relationship. The only thing left in order to close this issue and consider relationship finished is... fix the edge cases at the top of the issue. All yours @pxpm ! Let's tackle them one by one 💪

@tabacitu
Copy link
Member

Fixed in #4095

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

2 participants