类插件
Elasticsearch 插件
命名空间: Cake\ElasticSearch
常量
-
list<string>
VALID_HOOKS ¶['bootstrap', 'console', 'middleware', 'routes', 'services', 'events']
有效的钩子列表。
属性摘要
-
$bootstrapEnabled protected
bool
是否执行引导
-
$classPath protected
string|null
此插件的类路径。
-
$configPath protected
string|null
此插件的配置文件路径。
-
$consoleEnabled protected
bool
控制台中间件
-
$eventsEnabled protected
bool
是否加载事件
-
$middlewareEnabled protected
bool
启用中间件
-
$name protected
string|null
此插件的名称
-
$path protected
string|null
此插件的路径。
-
$routesEnabled protected
bool
是否加载路由
-
$servicesEnabled protected
bool
注册容器服务
-
$templatePath protected
string|null
此插件的模板路径。
方法摘要
-
__construct() public
构造函数
-
bootstrap() public
加载所有应用程序配置和引导逻辑。
-
checkHook() protected
检查钩子名称是否有效
-
console() public
为插件添加控制台命令。
-
disable() public
禁用命名钩子
-
enable() public
启用命名钩子
-
events() public
注册应用程序事件。
-
getClassPath() public
获取此插件配置的系统路径
-
getConfigPath() public
获取此插件配置的系统路径
-
getName() public
获取此插件的名称。
-
getPath() public
获取此插件的系统路径
-
getTemplatePath() public
获取此插件模板的系统路径
-
initialize() public
从构造函数调用的初始化钩子。
-
isEnabled() public
检查命名钩子是否已启用
-
middleware() public
为插件添加中间件。
-
routes() public
为插件添加路由。
-
services() public
注册此插件的容器服务。
方法详细信息
__construct() ¶ public
__construct(array<string, mixed> $options = [])
构造函数
参数
-
array<string, mixed>
$options optional 选项
bootstrap() ¶ public
bootstrap(Cake\Core\PluginApplicationInterface $app): void
加载所有应用程序配置和引导逻辑。
此方法的默认实现将包含插件中的 config/bootstrap.php
(如果存在)。您可以覆盖此方法来替换该行为。
主机应用程序作为参数提供。这允许您加载额外的插件依赖项或附加事件。
参数
-
Cake\Core\PluginApplicationInterface
$app
返回值
void
checkHook() ¶ protected
checkHook(string $hook): void
检查钩子名称是否有效
参数
-
string
$hook 要检查的钩子名称
返回值
void
抛出
InvalidArgumentException
对于无效的钩子
console() ¶ public
console(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection
为插件添加控制台命令。
参数
-
Cake\Console\CommandCollection
$commands
返回值
Cake\Console\CommandCollection
events() ¶ public
events(Cake\Event\EventManagerInterface $eventManager): Cake\Event\EventManagerInterface
注册应用程序事件。
参数
-
Cake\Event\EventManagerInterface
$eventManager 要注册侦听器的全局事件管理器
返回值
Cake\Event\EventManagerInterface
middleware() ¶ public
middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue
为插件添加中间件。
参数
-
Cake\Http\MiddlewareQueue
$middlewareQueue
返回值
Cake\Http\MiddlewareQueue
routes() ¶ public
routes(Cake\Routing\RouteBuilder $routes): void
为插件添加路由。
此方法的默认实现将包含插件中的 config/routes.php
(如果存在)。您可以覆盖此方法来替换该行为。
参数
-
Cake\Routing\RouteBuilder
$routes
返回值
void
services() ¶ public
services(Cake\Core\ContainerInterface $container): void
注册此插件的容器服务。
参数
-
Cake\Core\ContainerInterface
$container 要添加服务的容器。
返回值
void