Closed benmajor closed 6 years ago
Okay, after some lengthy digging, I have found a solution. The following works:
class Model_User extends \RedBeanPHP\SimpleModel { }
Note: In order to use the R
facade within the Model, we also need to add a use
statement at the beginning of the Model. As such, Models should look like this when using Composer:
use \RedBeanPHP\R;
class Model_User extends \RedBeanPHP\SimpleModel
{
public function check()
{
R::findOne( ... );
}
}
I think it's worth updating the Readme to include information about this, as the documentation doesn't seem to cover it. I'll make a PR and update.
Please see https://github.com/gabordemooij/redbean/pull/597.
thanks for contributing!
When using Composer and RedBeanPHP, we have run into some issues using Models within our application. For example:
Produces the following error:
It seems there's a scoping issue with
ReadBean_SimpleModel
. After digging around in the source, I tried the following:Which seems to get a step further, but then we receive the following error:
Is there a fix for this?