Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Model Properties Data Types
  • Apologies if this has been discussed before, i've had a search on the forums and the github but can't see anything obvious. Looking at the docs for setting up the properties in a model, you can set the data_type in both the main array and as an element of the 'forms' sub array.
    What's the difference between these? I've had a look through the code but couldn't find anything.
    Are they both in use? Is one redundant? Edit: Just incase I didn't make myself clear, see the example below from the docs. data_type is defined twice!
            'name' => array(
                'data_type' => 'varchar',
                'label' => 'Article Name',
                'validation' => array('required', 'min_length' => array(3), 'max_length' => array(20)),
                'form' => array('data_type' => 'text'),
                'default' => 'New article',
            ),
    
  • 'data_type' refers to the mysql column data type. In 'form' the key should be 'type' instead of 'data_type' and refers to the type of HTML element/input used. That's a mistake that has been fixed in the develop version of the docs and will be corrected when 1.2 comes out.
  • Ahhh right ok. Thank you very much!

Howdy, Stranger!

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

In this Discussion