简体   繁体   English

使用Composer将RedBean PHP ORM更新到上一版本时遇到麻烦

[英]Troubles when updating RedBean PHP ORM to the last version using Composer

I'm new to RedBean, my application was working, but when I updated RedBean to the last version using Composer, I got this error, Fatal error: Class 'RedBean_Facade' not found in my bootstrap.php file : 我是RedBean的新手,我的应用程序正在运行,但当我使用Composer将RedBean更新到最后一个版本时,我收到此错误,致命错误:我的bootstrap.php文件中找不到类'RedBean_Facade':

<?php
require_once __DIR__ . '/config.inc.php';
require_once __DIR__ . '/../vendor/autoload.php';

use RedBean_Facade as R;

if (empty(R::$currentDB)) {
    $dsn = sprintf('%s:host=%s;dbname=%s', DB_TYPE, DB_HOST, DB_NAME);
    R::setup($dsn, DB_USER, DB_PASSWORD);
}

R::close();

I don't understand if it's releated to the new version of RedBean or to my Composer autoloader which take into account just one library? 我不明白它是否与新版本的RedBean或我的Composer自动加载器有关,它只考虑了一个库?

Thanks in advance for your help! 在此先感谢您的帮助!

PHP Fatal error:  Class 'R' not found
PHP Fatal error:  Class 'RedBean_Facade' not found

can both be solved using this new syntax: 可以使用这种新语法解决:

use RedBeanPHP\R;

I've tested it successfully in version 4.3.0 我在4.3.0版中成功测试了它

I have put the single file rb.php into a composer package: 我把单个文件rb.php放到了一个composer包中:

https://github.com/diversen/redbean-composer https://github.com/diversen/redbean-composer

As statet in the docs it is recommended to just include the compiled version of redbeans as a single file. 作为docs中的statet,建议只将redbeans的编译版本作为单个文件包含在内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM