- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我最近更新了锂库,我遇到了这个问题。我收到此错误:
运行时异常
弃用 `app\models\StoreCategories::__init()` 方法,需要手动调用。
来源
/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 }
在 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'));
}
}
}
我使用 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') ;
提前谢谢你。
最佳答案
Lithium 摆脱了静态对象中的 __init(),参见 this commit .
关于php - lithium 弃用 __init() 方法,需要手动调用它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21064764/
我想将配置数据存储在单独的文件中,并使用正确的 Lithium 方式加载/读取它。 最佳答案 取决于它的用途。我们非常不鼓励抛出全局配置,除非它被仔细管理。 如果它与连接到某种外部系统有关,我建议您查
我通读了锂\数据\模型\查询,但没有看到任何连接示例。 最佳答案 有多种方法可以执行与 Lithium 的连接。 Lithium 将为您处理已定义关系 ( examples in the manual
在 Lithium 中,像这样获取给定模型的所有行之后: $users = Users::all(); 我怎么知道返回了多少行?我正在使用 MySQL 连接器。 谢谢! 最佳答案 如果你只是想要计数
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
我有一个扩展的基础模型。在其中,我定义了两个验证过滤器。一个检查记录是否唯一,另一个检查记录是否存在。它们的工作方式完全相同,只是一个返回值与另一个相反。 因此,将相同的代码编写两次只返回不同的值听起
我正在尝试通过 CLI 运行操作。操作是 UsersController::test() 所以,我运行这个:php libraries/lithium/console/lithium.php\\app
我正在尝试通过 CLI 运行操作。操作是 UsersController::test() 所以,我运行这个:php libraries/lithium/console/lithium.php\\app
这让我从 cakePHP 时代起就感到愤怒。如何查看 Model::find() 上执行的 SQL 查询? 最佳答案 这个问题已经在这里得到了回答:Lithium: Can we see querie
是否可以在 Lithium 的关系中访问多个模型? 例如,我有一个用户模型: class Users extends \lithium\data\Model { public $validat
我在 mongodb 中使用锂,我想知道下面的模型如何从 Posts::find('all'); 获取用户数据查询? 我必须执行两次查询吗? 感谢您的帮助! array('type' =>
如果我有一个我没有设置的锂应用程序,我该如何找出版本? 最佳答案 我认为他们不会在文件本身上加上时间戳。我建议您查看测试用例并查看最近的时间戳。 关于PHP lithium(li3) 如何找出版本,我
我对Lithium框架感到满意,并且想知道是否有用于将MongoDB或Memcache用于Lithium session 的示例。是否需要编写一个新的 session 适配器? 最佳答案 一种选择是将
我过去曾在几个项目中使用过 CakePHP,最近开始使用 Ruby on Rails,但我即将开始一个新项目,它需要 PHP。在使用 CakePHP 更新自己的同时,我了解到有一个名为 Lithium
我正在使用 Lithium 自定义组件来创建撰写最多博客文章的用户列表。我有一个用户列表,他们写了一篇博客文章,然后进行了一次休息,以获取每个用户所写的博客文章的数量。 Blog post
我有一个 MySQL 表 categories以下列: 编号 姓名 我使用检索数据 $categories = Categories::find('all'); 现在,我想创建一个 带有值为 $cat
我想排除调用 Lithium 模型的 find() 方法的结果。我需要为同时具有 MongoDB 和 MySQL 数据源的模型执行此操作,但在 SQL 中,我的意思是类似于 WHERE myfield
我正在使用 Lithium 和 mongoDB 编写我的第一个社区页面。我真的很喜欢 mongo 的无模式方式,但是有一个问题使得没有模式就无法工作: 例如我们有一个像这样的简单形式: form->c
我希望使用 Lithium 框架来构建我的应用程序配置界面,因为我喜欢它的最小方法和以文档存储(即 Mongodb)为中心的模型。 但是,(我知道它还没有完全发布),几乎没有任何信息、教程或示例可以让
我正在构建一个测试 Lithium 应用程序以了解它的工作原理,我发现表单助手似乎无法识别我传回的数据或任何验证错误。 目前我不得不手动传回我的错误,然后在 View 中处理它们。 Questions
我想使用 Lithium 的“cookie” session 适配器。用户登录后,我将使用他的散列密码创建一个 cookie。如果此 cookie 存在并且散列密码与数据库中的密码匹配,我将自动让他登
我是一名优秀的程序员,十分优秀!