Closed andreas-eisenmann closed 5 months ago
I've opened a PR here - https://github.com/statamic/eloquent-driver/pull/238 let me know if this works as expected
Thanks for the fast reply! 🚀
Yes, this would work generally, but there's a little syntax error ()
instead of ]
).
And I think you could shrink it to:
if (str_contains($blueprint, '::')) {
return explode('::', $blueprint);
}
Already fixed that
In statamic/cms whe have
::
as separator for namespace and handle when loading a blueprint, see this line.So we can call:
Now "foo" is treated as namespace and "bar" as the handle.
Let's peek into the counterpart in statamic/eloquent-driver at this line. Here we are not able to use
::
as a separator, but instead we have to use the dot.
es separator.We use statamic-rad-pack/runway in combination with statamic/eloquent-driver, so we store our blueprints in the database.
This code won't work with the eloquent driver:
$blueprint
will always benull
. If we callBlueprint::find("runway.{$this->handle}");
(so with a dot as the separator), everything works fine.Just spent a few seconds to think about in which project to report this issue, but for me it seems clear that if statamic/cms supports
::
as a separator to distinguish between namespace and handle when loading a blueprint, the eloquent driver should also support this behaviour to stay compatible? Developers should rely on that if they use a Facade of statamic (e.g.\Statamic\Facades\Blueprint
) in their app code and switch to the eloquent driver that everything works the same as before.