0

我正在制作简单的 Symfony CMS 教程:

http://symfony.com/doc/master/cmf/tutorial/introduction.html
http://symfony.com/doc/master/cmf/tutorial/getting-started.html
http://symfony.com/doc/master/cmf/tutorial/auto-routing.html

问题是虽然命令行没有显示任何错误,但是没有加载夹具,也没有生成路由。

我的错误在哪里?我完全按照教程进行,除了安装,因为它对我不起作用。我安装了标准版的 Symfony CMS 并在其中创建了 BasicCmsBundle。

1)

      c:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition>php app/console doctrine
        :phpcr:fixtures:load
        Careful, database will be purged. Do you want to continue Y/N ?y
          > purging database
          > Executing initializer: CmfContentBundle
          > Executing initializer: CmfSimpleCmsBundle Homepage
          > Executing initializer: CmfBlockBundle
          > Executing initializer: CmfMenuBundle
          > Executing initializer: My custom initializer
          > loading Acme\BasicCmsBundle\DataFixtures\PHPCR\LoadPageData
          > loading Acme\BasicCmsBundle\DataFixtures\PHPCR\LoadPostData

 If i check database:
C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\app\app.sqlite
 - it is empty, there are no posts and pages. 


2) And the command below does not list routes.




c:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition>php app/console doctrine
        :phpcr:node:dump
        ROOT:
          cms:
            content:
              blocks:
                hero_unit:
                  quick_tour:
                  configure:
                  demo:
            simple:
              home:
              demo:
              quick_tour:
              login:
            menu:
            pages:
              Home:
            posts:
              My First Post:
              My Second Post:
              My Third Post:
              My Fourth Post:
            routes:


3) Actually the tutorial does not show where and how to create resources for the fixtures. Maybe you could tell in short how web pages (resources) are generated in CMS for the given document and fixtures. 

    composer.json

        {
            "name": "symfony-cmf/standard-edition",
            "homepage": "http://cmf.symfony.com",
            "license": "MIT",
            "type": "project",
            "description": "The \"Symfony CMF Standard Edition\" distribution",
            "authors": [
                {
                    "name": "Symfony CMF Community",
                    "homepage": "https://github.com/symfony-cmf/standard-edition/contributors"
                }
            ],
            "autoload": {
                "psr-0": { "": "src/" }
            },
            "minimum-stability": "stable",
            "require": {
                "php": ">=5.3.3",
                "symfony/symfony": "~2.5",
                "doctrine/orm": "^2.4.8",
                "doctrine/doctrine-bundle": "~1.4",
                "doctrine/data-fixtures": "~1.0",
                "doctrine/doctrine-cache-bundle": "~1.0",
                "twig/extensions": "~1.0",
                "symfony/assetic-bundle": "~2.3",
                "symfony/swiftmailer-bundle": "~2.3",
                "symfony/monolog-bundle": "~2.4",
                "symfony-cmf/symfony-cmf": "1.2.*",
                "symfony-cmf/simple-cms-bundle": "1.2.*",
                "symfony-cmf/menu-bundle" : "~1.2", 
                "symfony-cmf/tree-browser-bundle": "~1.1",
                "symfony-cmf/create-bundle": "1.2.*",
                "symfony-cmf/routing-auto-bundle": "~1.0",
                "symfony-cmf/routing-bundle": "~1.3",
                "symfony-cmf/routing": "~1.3",        
                "jackalope/jackalope-doctrine-dbal": "1.1.*",
                "sensio/distribution-bundle": "~3.0",
                "sensio/framework-extra-bundle": "~3.0",
                "incenteev/composer-parameter-handler": "~2.0",
                "nelmio/alice": "~1.0",
                "sonata-project/doctrine-phpcr-admin-bundle" : "~1.2"
            },
            "require-dev": {
                "liip/functional-test-bundle": "~1.0",
                "sensio/generator-bundle": "~2.3"
            },
            "scripts": {
                "post-install-cmd": [
                    "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
                    "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
                ],
                "post-update-cmd": [
                    "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
                    "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                    "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
                ]
            },
            "config": {
                "bin-dir": "bin"
            },
            "extra": {
                "symfony-app-dir": "app",
                "symfony-web-dir": "web",
                "incenteev-parameters": {
                    "file": "app/config/parameters.yml"
                },
                "branch-alias": {
                    "dev-master": "1.2-dev"
                }
            }
        }

    C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\app\AppKernel.php

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // Symfony Standard Edition 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 Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            // Symfony CMF Standard Edition Bundles
            new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
            new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
            new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
            new Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle(),
            new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
            new Symfony\Cmf\Bundle\RoutingAutoBundle\CmfRoutingAutoBundle(),
            new Symfony\Cmf\Bundle\SimpleCmsBundle\CmfSimpleCmsBundle(),

            new Symfony\Cmf\Bundle\BlockBundle\CmfBlockBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Sonata\CoreBundle\SonataCoreBundle(),

            new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),

            new Symfony\Cmf\Bundle\CreateBundle\CmfCreateBundle(),
            new FOS\RestBundle\FOSRestBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),

            // Remove this Bundle when using the SE as the basis for a new project
            new Acme\DemoBundle\AcmeDemoBundle(),
            new Acme\TaskBundle\AcmeTaskBundle(),
            new Acme\BasicCmsBundle\AcmeBasicCmsBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

    C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\app\config\parameters.yml



      # This file is auto-generated during the composer install
        parameters:
            database_driver: pdo_sqlite
            database_host: null
            database_port: null
            database_name: standard
            database_user: admin
            database_password: gintare
            database_path: '%kernel.root_dir%/app.sqlite'
            phpcr_backend:
                type: doctrinedbal
                connection: default
                caches:
                    meta: doctrine_cache.providers.phpcr_meta
                    nodes: doctrine_cache.providers.phpcr_nodes
            phpcr_workspace: default
            phpcr_user: admin
            phpcr_password: admin
            mailer_transport: smtp
            mailer_host: 127.0.0.1
            mailer_user: null
            mailer_password: null
            locale: en
            secret: ThisTokenIsNotSoSecretChangeIt
            debug_toolbar: true
            debug_redirects: false
            use_assetic_controller: true


The rest of files are copies from the Tutorial website. If you ask i will paste them:

C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\
src\Acme\BasicCmsBundle\Document\ContentTrait.php

\src\Acme\BasicCmsBundle\Document\Page.php

src\Acme\BasicCmsBundle\Document\Post.php

src\Acme\BasicCmsBundle\DataFixtures\PHPCR\LoadPageData.php

src\Acme\BasicCmsBundle\DataFixtures\PHPCR\LoadPostData.php

src\Acme\BasicCmsBundle\Resources\config\cmf_routing_auto.yml


<?php

// src/Acme/BasicCmsBundle/DataFixtures/PHPCR/LoadPageData.php
namespace Acme\BasicCmsBundle\DataFixtures\PHPCR;

use Acme\BasicCmsBundle\Document\Page;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ODM\PHPCR\DocumentManager;

class LoadPageData implements FixtureInterface
{
    public function load(ObjectManager $dm)
    {
        if (!$dm instanceof DocumentManager) {
            $class = get_class($dm);
            throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
        }

        $parent = $dm->find(null, '/cms/pages');

        $page = new Page();
        $page->setTitle('Home');
        $page->setParentDocument($parent);
        $page->setContent(<<<HERE
Welcome to the homepage of this really basic CMS.
HERE
        );

        $dm->persist($page);
        $dm->flush();
    }
}
4

0 回答 0