Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil - Skin Views - Mysql field attribute "null" ? can knowing this ?
  • Hi Guys,

    I have one little question about oil generating views. I use FuelPHP 1.6.
    I use this command : refine fromdb:scaffold -s -a MyTableName
    for generate model, views and controller, it's ok. I skin my generating views with the folder : fuel/packages/oil/views/admin/orm/model.php

    Can i know if a mysql field is a null field or not in the db, for skin my template controller ?

    For exemple, in the template model.php, with the foreach "field", i can know the name, the type and the constrainst of the mysql field, with the array attribute  $field['name'], $field['type'], $field['constraint'].

    How i can know if a mysql field is null or not in the db table ?

    Thank a lot for your next answer,
    Have a nice day,
  • fromdb can not retrieve all details from the table, so some fine-tuning of the model is required.

    In the model $_properties property, you can indicate that null is allowed for a field using

    'null' => true,

    you can also define a default in case the value is null (which is a better option that defining a default in your table), using

    'default' => 'your-default-value',

Howdy, Stranger!

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

In this Discussion