forge->addColumn |
Hi All,
CI 4.6.1. I am trying to add a new column to an existing table. I am not having any luck. PHP Code: $val = array(); getEmailFields looks like PHP Code: protected function getEmailField() The error I am getting is an exception inside forge->addField. It seems that for some reason, it doesn't like the VARCHAR part of the definition. It throws a "Field information is required for that operation." exception, from line 387. The variable $val contains:
I don't see what I have done wrong and cannot find the error on the internet to track it down further. Any help is much appreciated.
I'm not understanding the majority of what your code does, but here is what it looks like in the simplest form to do what I think you're trying to achieve (try it and report back):
PHP Code: $this->forge->addColumn('entry_requests', [ //'entry_requests' is the table name
@grimpirate, thanks for your suggestions. This led me down the right path. There was a logical error in my code.
PHP Code: $val = [ Note the: 'email' => [ My code was not generating the array inside the array. It was at the top level only, the 'email' level was missing. This is why it was not working. It was making this: PHP Code: $val = [ I have updated my structure to generate the correct format and all is well. I am now fully working. How I missed that yesterday is a mystery. Thanks for your help, it is appreciated. C |
Welcome Guest, Not a member yet? Register Sign In |