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 2:56PM
    Hmm... doesn't look like you can at the moment without some changes... let me look into a fix for that.
  • edited 2:56PM
    OK... I've posted a fix for that for you to try out in both branches.
  • edited 2:56PM
    You're awesome!!!
    Thank you very much. Have a nice day!
  • edited 2:56PM
    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 2:56PM
    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 2:56PM
    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 2:56PM
    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 2:56PM
    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 2:56PM
    Thank you very much!!! Great product and better support.
    Hope I can help you...
  • edited 2:56PM
    And go sleep!!!!!! hahahahahahahaa
    Are your working at 2:45am????

    You are insane!!!
  • edited 2:56PM
    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 2:56PM
    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 2:56PM
    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.