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

Bug: Keys not clearing for extended DataObjects #35

Closed
chrispenny opened this issue Nov 18, 2021 · 0 comments · Fixed by #36
Closed

Bug: Keys not clearing for extended DataObjects #35

chrispenny opened this issue Nov 18, 2021 · 0 comments · Fixed by #36
Labels
bug Something isn't working

Comments

@chrispenny
Copy link
Member

chrispenny commented Nov 18, 2021

Setup

class Video extends Image
{
  ... whatever you want
}

The intention of the setup below is that MyBlock could have an Image or a Video assigned to it.

class MyBlock extends BaseElement
{
  private static array $has_one = [
    'Image' => Image::class,
  ];

  private static array $cares = [
    'Image',
  ];
}

Result

If you assign an Image to this relationship, then changes to the Image correctly invalidate the cache for MyBlock.

If you assign a Video to this relationship, then changes to the Video do not invalidate the cache for MyBlock.

I thought I had covered this already, but I guess not. There must be an issue with the way we fetch Edges, in that it's not considering that it could be a descendant of the $from class that is trying to retrieve the Edge, or potentially we should be creating Edges for each valid $from class.

At the moment, it seems like we create one Edge $from Image $to MyBlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant