aelvan / VarnishPurge-Craft

Craft plugin for purging Varnish when elements are saved.
MIT License
33 stars 11 forks source link

Potential incompatibility with NeoMatrix #16

Open sjenset opened 7 years ago

sjenset commented 7 years ago

Hi.

Using this plugin on a few sites, and love it.

However, when used on one particular site - which also uses the popular NeoMatrix-plugin - I get a fatal when attempting to save some pages.

This happens because we're trying to access ->owner->uri on $relatedMatrixBlock, and I think it happens because NeoMatrixBlocks don't necessarily have a owner (they can be quite nested).

I've patched my local site by adding a recursive method that cycles through parents until it finds one with a owner (fallback is to just return NULL and not add a URI to the collection) - but I figured I would raise it to your attention.