5

I am having a problem with record and model attribute types.

I have a frontend user form with some textfields which require a TEXT type field in the database to hold the data. So far I have tried setting the attribute type to String which creates a varchar(255) which isn't big enough to hold the data.

I've also tried Mixed which creates the TEXT type but does not populate the data when the form is submitted. Reading further and based on a previous problem I had I think this is due to the lack of validation on the Mixed attribute.

So my question is how do I get my form to submit this data if the attribute I create is causing the

$record->setAttributes($model->getAttributes());

to ignore the Mixed fields data. Or is there another attribute that would work better something like Text?

Also what would be useful to know is if there is any resource which describes the different attributes with examples of how to set them up for records and models as I can't seem to find anything that describes this process clearly.

Any help much appreciated.

Cheers

1 Answer 1

14

Ok worked out a solution to the attributes. You can set them like this:

array(AttributeType::String, 'column' => ColumnType::Text,  'required' => false)

By defining the column, so hopefully this will help someone else.

1
  • Can't thank you enough @lettie for this! I had no idea I could set ColumnType, has saved me a massive headache!
    – Merlin
    May 15, 2016 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.