Closed rccc closed 1 year ago
I do not understand why you have an issue with this. Sailor generates fully typed input objects, it should be obvious from their definition how they must be constructed.
In general, I recommend using their ::make()
method and PHP 8 named arguments, for example:
MyOperation::execute(
where: WhereCondition::make(
field: FieldRange::make(from: 1, to: 2),
),
)
Look at the actual generated types to figure out what to pass, there should be no guesswork involved.
Oh and since your example uses inline arguments: make sure to use variables.
Dear Spania,
Sorry for this newbie question, here is how i did it finally:
$numExp = new \App\Api\Types\numeric_comparison_exp();
$numExp->_gte = $data['min_weight'];
$numExp->_lte = $data['max_weight'];
$exp->mol_weight = $numExp;
Sorry again, next time i will take more time to think twice before posting.
I wish you a nice day, many thanks for this (very) nice library.
This looks fine and is how I would do it prior to PHP 8. With PHP 8, I would use named arguments to avoid the intermediary variables and shorten the code.
Hello,
I wonder how to implement this query with Sailor (a date range query base on an input that is built up incrementally) :
In my case, "mol_weight" type is "numeric_comparison_exp".
I wish i could do this:
Many thanks in advance.
Eric