How can you get yii to work with redbeanphp?

I would absolutely love to use yii framework with redbeanphp. I’m trying to decide which framework to use for my dissertation and so far I’m really liking yii but I’m very keen on redbean, too.

I’ve found a question on stackoverflow, http://stackoverflow.com/questions/9838719/redbean-and-yii-conflict , which seems to be my exact problem, but the solution looks messy. Is there a better way to do it?

I would really appreciate some help with this.

I’ll try to paste part of the error page that I get:


PHP warning


include(Model_Yiitest.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


F:\xampp\yii_framework\framework\YiiBase.php(418)


406                 {

407                     foreach(self::$_includePaths as $path)

408                     {

409                         $classFile=$path.DIRECTORY_SEPARATOR.$className.'.php';

410                         if(is_file($classFile))

411                         {

412                             include($classFile);

413                             break;

414                         }

415                     }

416                 }

417                 else

418                     include($className.'.php');

419             }

420             else  // class name with namespace in PHP 5.3

421             {

422                 $namespace=str_replace('\\','.',ltrim($className,'\\'));

423                 if(($path=self::getPathOfAlias($namespace))!==false)

424                     include($path.'.php');

425                 else

426                     return false;

427             }

428             return class_exists($className,false) || interface_exists($className,false);

429         }

430         return true;

Stack Trace

We built Zurmo, a Yii based CRM application, and chose RedBeanPHP because we felt it was a better solution for our ORM needs. It has 2 modes, frozen and unfrozen which allow easy development without having to worry about the schema. Also, we have added an auto-build functionality for the database schema so that you don’t have to worry about how the schema is constructed. We also like how it keeps the beans decoupled from the models in the application.

We don’t use Yii active record at all. We developed our own base model that is extended by all models that we are using in the system, and that model is RedBeanModel(located in app/protected/extensions/zurmoinc/framework/models). With this setup, we don’t need to write any sql queries (actually almost any because some some queries are database specific - check DatabaseCompatibilityUtil), RedBeanPHP cares about all actions on database (creating tables, updating them and so on). Maybe you want to download Zurmo to see how we have done this?

Thanks for the reply. I didn’t realise what you did do with and how. I’m still to php but with your explanation I should be able to figure out some more things. For now I also have it working with loading and unloading as described in my link above.