简体   繁体   English

锂不推荐的__init()方法,需要手动调用

[英]lithium Deprecated __init() method, needs to be called it manually

I recently update lithium library and I have this problem. 我最近更新锂库,我有这个问题。 I get this error: 我收到此错误:

RuntimeException RuntimeException的

Deprecated `app\\models\\StoreCategories::__init()` method, needs to be called it manually.

Source 资源

/works/minhna/public_html/CMP/V0/libraries/lithium/core/Libraries.php: 505 /works/minhna/public_html/CMP/V0/libraries/lithium/core/Libraries.php:505

500 
 501        if ($path && include $path) { 
 502            static::$_cachedPaths[$class] = $path; 
 503            if (method_exists($class, '__init')) { 
 504                $msg = "Deprecated `{$class}::__init()` method, needs to be called it manually."; 
 505                throw new RuntimeException($msg); 
 506            } 
 507        } elseif ($require) { 
 508            throw new RuntimeException("Failed to load class `{$class}` from path `{$path}`."); 
 509        } 
 510    }

In the StoreCategories model, I have a simple function 在StoreCategories模型中,我有一个简单的功能

public static function __init(array $options = array()){
    static::config($options);
    static::applyFilter('save', function ($self, $params, $chain) {
        if(!$params['entity']->_id){
            //set created date
            $params['entity']->created = strtotime(gmdate('Y-m-d H:i:s'));
        }
    }
}

I use composer and in the boostrap libraries.php, I load the li3_socialauth library: 我使用composer并在boostrap libraries.php中加载li3_socialauth库:

/**
 * load the socialauth library
 */
Libraries::add('li3_socialauth');
// Add the composer autoloader if not already done
require_once(LITHIUM_LIBRARY_PATH . '/autoload.php') ;

Thank you in advance. 先感谢您。

Lithium在静态对象中删除了__init(),请参阅此提交

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

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