Welcome Guest, Not a member yet? Register   Sign In
Passing config params to the model?
#1

Hi,

I'm trying to pass in config parameters to the model on initialization. But, I can't seem to be able to do so, as I get this error:

Code:
Argument 1 passed to CodeIgniter\Model::__construct() must be an instance of CodeIgniter\Database\ConnectionInterface or null, array given, called in /Applications/MAMP/htdocs/ … /app/Controllers/Api.php on line 47

Now, what seems to be more frustrating is the fact that I have absolutely no clue WHERE to look in the docs for the syntax used to set model and pass in parameters. Now, the docs do not seem to be 'designed' for being used as a reference for situations like this. What I'm looking for is something like this:

Code:
$model = new YaddaYaddaModel( $my_config_for_the_model_here );


I've been trawling the docs for it but have had no 'luck' (yeah, that's what it actually takes ; ) ) finding it so far …
Reply




Theme © iAndrew 2016 - Forum software by © MyBB