0
votes

I am trying to upgrade the symfony cmf bundles from v1.0 to v1.1 in our project.

composer.json before upgrade:

    "doctrine/phpcr-odm": "1.1.0-RC1 as 1.0",
    "doctrine/phpcr-bundle": "1.1.0-beta1 as 1.0",
    "phpcr/phpcr-utils": "1.1.0 as 1.0",        

    "symfony-cmf/routing-auto-bundle": "1.0.*@alpha",
    "symfony-cmf/menu-bundle": "1.0.*",
    "symfony-cmf/block-bundle": "1.0.*",
    "symfony-cmf/routing-bundle": "1.1.*",

    "jackalope/jackalope-jackrabbit": "1.1.*",
    "sonata-project/doctrine-phpcr-admin-bundle": "1.0.*",

composer.json after upgrade:

    "doctrine/phpcr-bundle": "1.1.*",
    "doctrine/phpcr-odm": "1.1.*",

    "symfony-cmf/routing-auto-bundle": "1.0.*@alpha",
    "symfony-cmf/routing-bundle": "1.2.0 as 1.1.0",
    "symfony-cmf/core-bundle": "1.1.0 as 1.0.0",
    "symfony-cmf/menu-bundle": "1.1.*",
    "symfony-cmf/block-bundle": "1.1.*",

    "jackalope/jackalope-jackrabbit": "1.1.*",
    "sonata-project/doctrine-phpcr-admin-bundle": "1.1.*",

As you can see I am using composer aliasing in both places in order to be able to use symfony-cmf/routing-auto-bundle. This aliasing method is the only way I was able to use the symfony-cmf/routing-auto-bundle.

So after doing composer update with above changes I have some failing tests in the sonata admin area of the project. By doing some debugging I saw the below changes.

Below is how I load the Page fixtures.

    <?php // load Page fixtures

    protected function create($dm, $class, $parent_path, $data_file)
    {
        $parent = $dm->find(null, $parent_path);
        $data = $this->getData($data_file);

        foreach ($data as $item)
        {
            $doc = new $class();
            $doc->setParent($parent);

            if (is_array($item['title'])) {
                foreach ($item['title'] as $locale => $title) {

                    $doc = $this->createDoc($doc, $title, $item['body'][$locale], $locale);

                    $dm->persist($doc);
                    $dm->bindTranslation($doc, $locale);
                }
            } else {
                $doc = $this->createDoc($doc, $item['title'], $item['body']);

                $dm->persist($doc);
            }
        }

        $dm->flush();
    }

    protected function createDoc($doc, $title, $body, $locale = 'en')
    {
        $doc->setTitle($title);
        $doc->setContent($body);
        $doc->setlocale($locale);

        return $doc;
    }

My questions are:

  1. I have used bindTranslation() method in my fixtures. Has that method changed in cmf v1.1? Is that why I can't see the fields in the admin interface? (I am not using simple-cms-bundle or content-bundle.)

  2. This is un-related to above. Should I continue to use RoutingAutoBundle? (Because I don't see many questions about it on SO. So I think perhaps people are not using it much)

I appreciate any sort of advice you can give me about using cmf bundles in our project.

BTW: I've also read the github issue update to 1.1.0-RC1 by @lsmith77 so please don't point me to that ;)

Please help! I'm here if you need further details.

Thank you.

1

1 Answers

1
votes

bindTranslation was not supposed to change, so if that would be the problem, it would be a regression. You can investigate whether its a problem with the fixtures or later by looking at the output of app/console doctrine:phpcr:node:dump --props /parent/path. Is the list empty regardless of the language you request it?

Did you configure multilang on both cmf_core and doctrine_phpcr?

You could further investigate by loading a document in a controller or command and checking what the content document contains in that case.

For the discussion of routing auto bundle, best come to the mailinglist http://groups.google.com/group/symfony-cmf-devs . It should still happen but it seems we miss somebody to finalize it.