我是Symfony的新手。 试图安装奏鸣曲管理包。 形成: http://symfony.com/doc/current/bundles/SonataAdminBundle/getting_started/installation.html
但是我收到了错误 索纳塔\ DoctrineORMAdminBundle \ SonataDoctrineORMAdminBundle'在/home/ubuntu/workspace/app/AppKernel.php
中找不到我的 AppKernel.php的代码是
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
// These are the other bundles the SonataAdminBundle relies on
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// And finally, the storage and SonataAdminBundle
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
像这样 和 composer.json的代码是 {
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.1.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"sonata-project/admin-bundle": "^3.4"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"platform": {
"php": "5.5.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.1-dev"
}
}
}
提前致谢:
答案 0 :(得分:1)
对我来说,就像错误所说的那样,行
if sender.currentImage == #imageLiteral(resourceName: "menu"){
menuOpen = true
UIView.animate(withDuration: 0.3) {
self.copyButton.center = self.copyButtonCenter
self.pasteButton.center = self.pasteButtonCenter
self.cutButton.center = self.cutButtonCenter
self.marketButton.center = self.marketButtonCenter
}
sender.setImage(#imageLiteral(resourceName: "cancel"), for: .normal)
}else{
menuOpen = false
UIView.animate(withDuration: 0.3) {
self.copyButton.center = self.menuButton.center
self.pasteButton.center = self.menuButton.center
self.cutButton.center = self.menuButton.center
self.marketButton.center = self.menuButton.center
}
sender.setImage(#imageLiteral(resourceName: "menu"), for: .normal)
}
}
@IBAction func closeMenu(_ sender: UIButton){
if menuOpen{
UIView.animate(withDuration: 0.3) {
self.copyButton.center = self.menuButton.center
self.pasteButton.center = self.menuButton.center
self.cutButton.center = self.menuButton.center
self.marketButton.center = self.menuButton.center
}
menuButton.setImage(#imageLiteral(resourceName: "menu"), for: .normal)
}
}
在AppKernel.php中重复了两次
答案 1 :(得分:0)
我想你错过了在作曲家中要求捆绑......
尝试运行
php composer.phar require sonata-project/doctrine-orm-admin-bundle
和composer install / update
来自sonata-admin文档:
SonataAdminBundle与存储无关,这意味着它可以与多种存储机制配合使用。根据您在项目中使用的内容,您需要安装以下捆绑包之一。在相应的链接中,您可以找到每个链接的简单安装说明:
更多信息:https://sonata-project.org/bundles/admin/master/doc/reference/installation.html
祝你好运