I am having problems with value types when using the findBy()
method.
User blueprint in addresses
structure field:
fields:
autoincrement:
type: hidden
translate: false
User content file user.txt
:
Addresses:
-
autoincrement: 10
name: Office
...
Works with string:
kirby()->user()->addresses()->toStructure()->findBy("autoincrement", "10");
Failed with integer:
kirby()->user()->addresses()->toStructure()->findBy("autoincrement", 10);
Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Object of class Kirby\Cms\Field could not be converted to int
Btw filterBy()
method working properly:
kirby()->user()->addresses()->toStructure()->filterBy("autoincrement", 10)->first();
Do I always have to cast value to string?