symfony-cmf / media-bundle

UNMAINTAINED - Minimalistic interfaces to handle media in the context of the CMF
http://cmf.symfony.com/
30 stars 40 forks source link

use MediaBundle twig functions #140

Closed elenitaex5 closed 8 years ago

elenitaex5 commented 9 years ago

Hi, I'm trying to use MediaBundle in my twig template in a image gallery.

I've this: < a href="{{ cmf_media_download_url(XXX) }}" title="Download" >Download

but it throws me a TWIG error: "The function "cmf_media_download_url" does not exist in XXXBundle::XXX.html.twig "

of course i have in my: app/config/routing.yml image

app/AppKernel.php image

could anybody help me?

dbu commented 8 years ago

this is only available with phpcr-odm. you need to enable phpcr for this bundle to have the twig extension loaded.

If you want to use ORM, you would need to look into the twig extension and see if you can adjust it to also work with Doctrine ORM. A pull request to make that possible would be great - ORM support for the twig helpers is something we want but nobody had time to build it.

see also http://stackoverflow.com/questions/31919763/symfony-cmf-media-bundle-could-not-load-type-cmf-media-image for similar discussion about the form types.