Issue about value types on findBy() method

I am having problems with value types when using the findBy() method.

User blueprint in addresses structure field:

        type: hidden
        translate: false

User content file user.txt:


  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?

Strange! Works with other syntax "=", like following:

kirby()->user()->addresses()->toStructure()->findBy("autoincrement", "=", 10);

That last example doesnā€™t make sense, findBy() only accepts two parameters, not an additional second filter, that only works with filterBy().

The reason why it only works with a string is that getAttribute() (which is used internally) returns a field which cannot be cast to integer.

So only solution is casting to string always, right?