安装
使用 Symfony Flex 安装
Symfony Flex 是在 Symfony 3.4 及更高版本应用中管理依赖项的新方式。如果您的项目已使用 Symfony Flex,请执行此命令以自动下载、注册和配置 bundle
1
$ composer require stof/doctrine-extensions-bundle
就这样!您可以跳过本文的其余部分。
不使用 Symfony Flex 安装
步骤 1:下载 Bundle
打开命令行控制台,进入您的项目目录并执行以下命令以下载此 bundle 的最新稳定版本
1
$ composer require stof/doctrine-extensions-bundle
此命令要求您全局安装 Composer,如 Composer 文档的安装章节中所述。
步骤 2:启用 Bundle
然后,通过在项目的 app/AppKernel.php
文件中添加以下行来启用 bundle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
);
// ...
}
// ...
}
本作品,包括代码示例,均根据 Creative Commons BY-SA 3.0 许可获得许可。