Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Alice to load fixtures #194

Open
lsmith77 opened this issue Aug 12, 2013 · 13 comments
Open

use Alice to load fixtures #194

lsmith77 opened this issue Aug 12, 2013 · 13 comments

Comments

@lsmith77
Copy link
Member

https://github.com/nelmio/alice

related to symfony-cmf/simple-cms-bundle#55

@uwej711
Copy link
Member

uwej711 commented Aug 12, 2013

How would you handle multi lang content, I guess we need some extension to call bindTranslation?

@lsmith77
Copy link
Member Author

i havent looked at the details yet but yeah i guess we might need something along those lines

/cc @Seldaek

@dbu
Copy link
Member

dbu commented Aug 12, 2013

one language would be handled by setting the locale field. but after that indeed we would need "something" that knows what is going on. @Seldaek phpcr-odm translated fields can be updated on the same document and with another call to bindTranslation stored in that language.

@uwej711
Copy link
Member

uwej711 commented Aug 12, 2013

Currently I use something like this in our manual fixtures:

contact:
    class: Website\ContentBundle\Document\Page
    locales:
        en:
            metaTitle: "Contact - Test"
            metaDescription: "Contact - Test"
        de:
            metaTitle: "Kontakt - Test"
            metaDescription: "Kontakt Beschreibung - Test"

which with Alice could be something like this

Website\ContentBundle\Document\Page:
    contact:
        locale:
            en:
                metaTitle: "Contact - Test"
                metaDescription: "Contact - Test"
            de:
                metaTitle: "Kontakt - Test"
                metaDescription: "Kontakt Beschreibung - Test"

@Seldaek
Copy link

Seldaek commented Aug 12, 2013

Alice doens't support localization of an entire item at the moment. It can create two documents in two languages though and then you bind them as the two translations.. I don't know exactly how things work in the CMF nowadays but if you can articulate a bit more maybe we find a good solution. Otherwise the latest alice release has processors which allow you to modify the objects on the way to the doctrine object manager, that might also help.

@uwej711
Copy link
Member

uwej711 commented Aug 12, 2013

I did a quick research and unfortunately the different Doctrine behaviours (ORM) feature different APIs and differ again from PHPCR-ODM. I will look into the processors stuff, maybe that can help.

@uwej711
Copy link
Member

uwej711 commented Aug 12, 2013

Unfortunately the processors have no knowledge of the original fixture data, so this doesn't seem to help. Maybe we can introduce an other syntax like

metaTitle:de: Titel

or

metaTitle: 
     locale: de
     value: Title

@Seldaek
Copy link

Seldaek commented Aug 12, 2013

Can you show me in php code how it looks to populate one of those objects with multiple langs?

@uwej711
Copy link
Member

uwej711 commented Aug 12, 2013

What we need for phpcr odm in the end is something like this:

foreach ($locales as $locale => $value) {
    $page->setMetaTitle($value);
    $page->set ...   // another translated field
    $manager->bindTranslation($page, $locale);
}

It would be good to set all the fields and call bindTranslation only once per field, although it should work to repeat it for each field.

@dbu
Copy link
Member

dbu commented Aug 12, 2013

bindTranslation only once per document and locale - might be we would
even get not nullable validation complaints otherwise.

@uwej711
Copy link
Member

uwej711 commented Aug 29, 2013

For doing this we still have the translations issue and maybe image loading although I'm not sure we have images in the fixtures ...

@lsmith77
Copy link
Member Author

we do not have images in the fixtures yet .. but we might want to in the future.

@dbu
Copy link
Member

dbu commented Sep 27, 2013

i remove the 1.0 milestone from this task. its not critical.

@wouterj wouterj removed the Easy Pick label May 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants