2012-03-30 11 views
5

resmi ACL örnek kod çalışır: http://symfony.com/doc/current/cookbook/security/acl.htmlSymfony2'nin: dal uzatma is_granted ('DÜZENLEME', yorum) bir foreach döngüsünde çalışmaz

Yaparsam ... sorun, o

{% if is_granted('EDIT', comment) %} 
    Edit 
{% endif %} 

... ancak ilişkili bir nesneye "Erişim Verilen Erişim" istiyorsam, işe yaramıyor.

{% for comment in news.comments %} 
    comment.content 
    {% if is_granted('EDIT', comment) %} 
     Edit 
    {% endif %} 
{% endfor %} 

Ben dal uzantısı "yorum" a "Comment Varlık" olduğunu bilmiyor düşünüyorum.

sorgu "Proxies \ JblNewsBundleEntityCommentProxy" yerine "JBL \ NewsBundle \ Varlık \ Comment" arar:

SELECT a.ancestor_id FROM acl_object_identities o INNER JOIN acl_classes c ON c.id = o.class_id INNER JOIN acl_object_identity_ancestors a ON a.object_identity_id = o.id WHERE ((o.object_identifier = '38' AND c.class_type = 'Proxies\\JblNewsBundleEntityCommentProxy')) 

Ama bunu düzeltmeye nasıl bilmiyorum.

Çözümünüz varmı, lütfen?

cevap

İlgili konular