Closed doup closed 2 years ago
@bastianallgeier what do you think - I though relying on casting to string would work and $mode->uuid()
could return the UUID instance. But maybe that leads to too many issues in unforeseen places?
@distantnative I really wonder why the string casting isn't already working in the findBy method. This is pretty weird.
Because the method isn't casting it:
public function findBy(string $attribute, $value)
{
foreach ($this->data as $item) {
if ($this->getAttribute($item, $attribute) == $value) {
return $item;
}
}
return null;
}
$value
being the UUID object.
✅
Description
event
andpost
post
has a fieldrelatedevent
, which stores anevent
UUIDpost => event
relation viafind('page://event-id')
works OKevent => post
viafindBy
doesn't work when just usinguuid()
$this->kirby()->collection('blog/posts')->findBy('relatedevent', $this->uuid())
$this->kirby()->collection('blog/posts')->findBy('relatedevent', $this->uuid()->toString())
Expected behavior
$this->uuid()
, without the need to cast to string.Your setup
Kirby Version :
3.8.0-rc.1