提问者:小点点

在Cakephp Shell中使用插件


我正在写一个shell,它将向在我们网站上发布消息的用户发送电子邮件。电子邮件通过Mandrill发送,并通过插件发送。

这是路径:

/app/Plugin/山楂/控制器/组件/MandrillComponent.php

以下是我的回复(http://stackoverflow.com/questions/10880694/using-a-plugin-component-from-shell-class-in-cakephp-2-0-2),我有以下资料:

App::uses('Controller', 'Controller');
App::uses('ComponentCollection', 'Controller');
App::uses('MandrillComponent', 'mandrill.Controller/Component');`

$Collection = new ComponentCollection();
$Mandrill = new MandrillComponent($Collection);

我通过控制台/蛋糕NotifyMailer运行外壳,但得到的错误:插件山楂无法找到。

我已经为此挣扎了一段时间,所以任何帮助都将不胜感激。

谢谢


共1个答案

匿名用户

您是否已将插件加载到配置/bootstrap.php?

http://book.cakephp.org/2.0/en/plugins.html

CakePlugin::loadAll(); // Loads all plugins at once
CakePlugin::load('Mandrill'); //Loads a single plugin

我认为根据cakephp 2. x约定,您的所有插件都应该以大写字母ie开头。用曼陀林代替山楂