Giter VIP home page Giter VIP logo

Comments (4)

spawnia avatar spawnia commented on August 25, 2024

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.

from sailor.

spawnia avatar spawnia commented on August 25, 2024

Oh and since your example uses inline arguments: make sure to use variables.

from sailor.

rccc avatar rccc commented on August 25, 2024

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.

from sailor.

spawnia avatar spawnia commented on August 25, 2024

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.

from sailor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.