Pass a config array to the base_module_model constructor

edited January 2011 in Modules
How can I pass a config array to the __construct method on a Base_module_model extended class similar to the way I do in a MY_Model Class'

Comments

  • edited 4:52AM
    Hmm... doesn't look like you can at the moment without some changes... let me look into a fix for that.
  • edited 4:52AM
    OK... I've posted a fix for that for you to try out in both branches.
  • edited 4:52AM
    You're awesome!!!
    Thank you very much. Have a nice day!
  • edited 4:52AM
    I need to pass the $params var to the MY_Model constructor, isn't it?
    I'm doing it as follows: parent::__construct($table, $params); // table name
    But this code throws this error:

    Severity: Notice

    Message: Undefined variable: required

    Filename: libraries/MY_Model.php

    Line Number: 1665

  • edited 4:52AM
    Ok, now it's working for me, I was passing the "required" parameter as string.
    Your fix works well, but is needed to pass the "$params" var to the "MY_Model" constructor
  • edited 4:52AM
    The fix that was put in place was to check if the $params was a string, it would assume you are passing the module name (which is what the previous version was looking for). If the parameters was an array, then it would send it as initialization parameters.

    I'm not sure if I understand what you mean "Your fix works well, but is needed to pass the "$params" var to the "MY_Model" constructor". Could you help clarify, just in case there is a better way for me to implement the fix? Thanks.
  • edited 4:52AM
    Sorry about my writing, my English is not enough fluent...
    I mean the "base_module_model" constructor code should finish with
    "parent::__construct($table, $params); // table name, params"
    instead of
    "parent::__construct($table); //table name"
  • edited 4:52AM
    Oh... yes. That didn't make it into the update (I'm maintaining too many branches right now I think). That fix has been posted.
  • edited 4:52AM
    Thank you very much!!! Great product and better support.
    Hope I can help you...
  • edited 4:52AM
    And go sleep!!!!!! hahahahahahahaa
    Are your working at 2:45am????

    You are insane!!!
  • edited 4:52AM
    Ha... it is 1:45 am... (I try not to do that too often). It's only work if you don't enjoy it right?... Was working on 0.92 branch.
  • edited 4:52AM
    You are right, I usually go sleep late working on my own projects. I'm doing my new personal webpage with FuelCMS and I'm planning to release the code with Github (I have some files right now, but in an early stage, because I'm making continuous changes while I'm learning). I want to thank you all your efforts because you are doing a really good product. I'm loving the half framework half CMS idea!
  • edited 4:52AM
    Thanks for the kind words. Feel free to share it when you are done in the forum (there is a share category for stuff like that).
Sign In or Register to comment.