rsanchez / Deep

A set of Eloquent models for ExpressionEngine Channel Entries.
http://rsanchez.github.io/Deep/
MIT License
51 stars 14 forks source link

Connection issues #1

Closed chrisrowe closed 10 years ago

chrisrowe commented 10 years ago

Following through the installation notes I'm unable to use the Entries model. I'm seeing...

Fatal error: Call to a member function connection() on a non-object in /Users/chrisrowe/Sites/walford/vendor/illuminate/database/Illuminate/Database/Eloquent/Model.php on line 2677

when calling from our module.

Any pointers for me to go off? Thanks

rsanchez commented 10 years ago

Sounds like Eloquent isn’t getting properly bootstrapped to EE’s db connection. Can you show me some of your code? If you’re not extending the BasePlugin class, you will have to bootstrap it yourself by calling this in your constructor:

\rsanchez\Deep\Deep::bootEloquent(ee());
chrisrowe commented 10 years ago

Thanks, yes we're using this data in a Module rather than a Plugin. This has fixed the issue. We've discovered another bug though which @nfourtythree is going to PR shortly.

rsanchez commented 10 years ago

BTW, you can extend the BasePlugin class with a module no problem. But certainly not a requirement to do so.