如何在插件中使用模型class?
How to use model class in plugin?
我尝试为 pimcore 编写插件,需要在其中使用用户 class 来更改数据库中的用户 table。我应该怎么做?
只需:
$user = Objects\User::getById(2);
无效:
include_once(Pimcore/Model/Object/ClassDefinition/Data/Objects/User.php): failed to open stream: No such file or directory in /var/www/pimcore/pimcore/lib/Zend/Loader.php on line 134
提前致谢!
我这样做过:
`$db = Mysql::get();
$select = $db->select()
->from('users', ['lastpasswordedit'])
->where('id = ?', $userId);
$stmt = $db->query($select);
$result = $stmt->fetch();`
谢谢@Igor Benko!
我尝试为 pimcore 编写插件,需要在其中使用用户 class 来更改数据库中的用户 table。我应该怎么做? 只需:
$user = Objects\User::getById(2);
无效:
include_once(Pimcore/Model/Object/ClassDefinition/Data/Objects/User.php): failed to open stream: No such file or directory in /var/www/pimcore/pimcore/lib/Zend/Loader.php on line 134
提前致谢!
我这样做过:
`$db = Mysql::get();
$select = $db->select()
->from('users', ['lastpasswordedit'])
->where('id = ?', $userId);
$stmt = $db->query($select);
$result = $stmt->fetch();`
谢谢@Igor Benko!