Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm model properties are all strings?
  • Hey guys,

    Is there a setting or something that I can do to avoid that all my model properties are strings?(not strongly typed)
    They have the real data type in the mysql tables like ints floats etc....but when I var_dump a result from the orm al my properties are strings.

    Thanks for your answer
  • Ok: I sorted it out
    'id' => array('data_type' => 'int'),
    You can just specify the data_type.

    But why isn't this by default puted in by oil?
    Or is there a parameter to the oil g model that I am forgetting?

    thx!
  • By default they are all strings because the database driver returns them all as strings.

    You can define a 'data_type' on each property, and configure the Typing observer to enforce the defined type.

    Check the Orm docs, observers, included observers.
  • I don't think that is implemented in Oil.
  • Cool...thanks for your quick response.
    We, as a online production team have recently made the switch to fuel php.
    I must say there are some very good things to say about the framework.
    Are you guys trusting on the community to add in things for in this example oil?
  • FuelPHP has over 100 contributors at the moment, so I'd say that's a yes. ;-)

    Keep an eye on the coding standards, code that doesn't follow it will be rejected. And if you're not sure a feature will be accepted, create a feature request first in the github issue tracker, so it can be discussed.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion