LiipImagineBundle imagine_filter not working - symfony

I have a problem with the imagine_filter that works in one page and not in the others even if I use it exactly the same way with the same photo.
In the first page, where my filter works, I have this src:
http://myserver.com/media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
However, on the page where the filter doesn't work, I have this src:
:///media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
Has anybody already have a problem like that?
Moreover, the first src only works on app.php and not on app_dev.php.
On my application, I'm using Gaufrette to upload photos to S3 and then Liip to apply the filters. The cache is on my server. This is my configuration:
"liip/imagine-bundle": "1.3.*#dev",
"knplabs/gaufrette": "0.1.*",
"knplabs/knp-gaufrette-bundle": "0.1.*#dev",
"aws/aws-sdk-php": "2.8.*#dev",
<--- The services --->
services:
mycompany.aws_s3.client:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
key: %amazon_aws_key%
secret: %amazon_aws_secret_key%
region: %amazon_aws_region%
mycompany.liip_imagine.binary.loader.stream.shooting:
class: '%liip_imagine.binary.loader.stream.class%'
arguments:
- 'gaufrette://shooting/'
tags:
- { name: 'liip_imagine.binary.loader', loader: 'stream.shooting' }
<--- Gaufrette --->
knp_gaufrette:
adapters:
shooting:
aws_s3:
service_id: mycompany.aws_s3.client
bucket_name: %amazon_s3_bucket%
options:
directory: shooting
filesystems:
shooting:
adapter: shooting
alias: shooting_filesystem
stream_wrapper: ~
<--- Liip --->
liip_imagine:
resolvers:
default:
web_path: ~
shooting:
web_path:
cache_prefix: /media/cache/shooting
controller:
filter_action: mycompany_imagine.controller:filterAction
filter_sets:
photo_preview:
data_loader: stream.shooting
cache: shooting
quality: 50
filters:
upscale: { min: [690, 690] }
thumbnail: { size: [690, 690], mode: outbound}
<--- Twig --->
<img src="{{ photo.imagepath | imagine_filter('photo_preview') }}" alt="">

I got an answer on Github. I just needed to change my resolver:
https://github.com/liip/LiipImagineBundle/issues/203

Related

Symfony Sonata Admin - Security issue with Role and on_top

i got a problem with security and menu.
I have a menu point "Besuchsmanagement" set on_top: true
Now i have roles for this.
My problem is, that the on_top always be shown, if role is granted or not.
ROLES:
role_hierarchy:
ROLE_ADMIN_VISIT_READER:
- ROLE_ADMIN_VISIT_LIST
- ROLE_ADMIN_VISIT_VIEW
ROLE_ADMIN_VISIT_CREATOR:
- ROLE_ADMIN_VISIT_READER
- ROLE_ADMIN_VISIT_CREATE
- ROLE_ADMIN_VISIT_EDIT
ROLE_ADMIN_VISIT_ADMIN:
- ROLE_ADMIN_VISIT_ALL
ROLE_USER:
- ROLE_ADMIN_VISIT_ADMIN
services.yml
admin.visit:
class: ifabrik\VisitBundle\Admin\VisitAdmin
arguments: [~, ifabrik\VisitBundle\Entity\Visit, ~]
tags:
- { name: sonata.admin, group: Besuchsmanagement, manager_type: orm, on_top: true, icon: '<i class="fa fa-map-signs" aria-hidden="true"></i>' }
When i remove on_top - then roles are correct.
Instead of passing on_top in the service definition you should be configuring your admin menu in your app/config.yml.
Here is an example :
sonata_admin:
dashboard:
groups:
Customers Relationship Management:
label: libio.menu_label.crm
icon: '<i class="fa fa-address-card"></i>'
on_top: true
roles: [ROLE_SUPER_ADMIN]
items:
- route: admin_librinfo_crm_organism_list
label: libio.menu_label.organisms_list
As you can see you can specify the roles to wich the menu entry will be shown.
To find out the route execute the command
app/console (bin/console on sf3) debug:router

Override Sonata Users services Menu Group

I make user of the Sonata User Bundle. According to the documentation under section 2.5 Extending the Bundle they want me to generate a complete new bundle for my user and group entities. I think this is completely unnecessary and I don't want that extra bundle. So I've created my User and Group entities in my AppBundle and I extend them from the Sonata\UserBundle\Entity\BaseUser entities.
After this, I've changed my fos_user user_class and group_class to my new entities.
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
group:
group_class: AppBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
service:
user_manager: sonata.user.orm.user_manager
Everything works perfectly, my user and group tables in my database is generated correctly, I can create users through the fos user command line, and I can log in.
In the menu is an automatically generated user group that contain the user and group entities (see the image below). Now the only problem is to override the services for this entities to them to use my own entity classes, because when I click now on one of them they want the entities in the extended bundle that I don't want. How can I tell sonata to make use of my own services? Or even, how can I just remove or hide the Users (with Users and Groups) completely?
After some digging in Sonata User Bundle files, I see that the entities can be set with a parameter. So all I had to do was to add;
parameters:
sonata.user.admin.user.entity: AppBundle\Entity\User
sonata.user.admin.group.entity: AppBundle\Entity\Group
in my config.yml file.
"Or even, how can I just remove or hide the Users (with Users and Groups) completely?"
So, we have SonataUserBundle and our AppBundle.
In both of them we have User and Group Entity. And we don't want to use entities from sonata - we just extend them. But SonataUserBundle has already had the UserAdmin and GroupAdmin classes inside.
That's why, after installing SonataUserBundle in the admin menu appear two services:
As you know, every sonata admin class we declare in the services.yml file.
In SonataUserBundle we have another files, which sonata developers declare services in. In case of using doctrine orm we should look at admin_orm.xml file, which lies in this path:
vendor/sonata-project/user-bundle/Resources/config/admin_orm.xml
Inside the file we can find the declaration of the admin services - UserAdmin and GroupAdmin:
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sonata.user.admin.groupname">sonata_user</parameter>
<parameter key="sonata.user.admin.label_catalogue">SonataUserBundle</parameter>
<parameter key="sonata.user.admin.groupicon"><![CDATA[<i class='fa fa-users'></i>]]></parameter>
</parameters>
<services>
<service id="sonata.user.admin.user" class="%sonata.user.admin.user.class%">
<tag name="sonata.admin" manager_type="orm" group="%sonata.user.admin.groupname%" label="users" label_catalogue="%sonata.user.admin.label_catalogue%" label_translator_strategy="sonata.admin.label.strategy.underscore" icon="%sonata.user.admin.groupicon%"/>
<argument/>
<argument>%sonata.user.admin.user.entity%</argument>
<argument>%sonata.user.admin.user.controller%</argument>
<call method="setUserManager">
<argument type="service" id="fos_user.user_manager"/>
</call>
<call method="setTranslationDomain">
<argument>%sonata.user.admin.user.translation_domain%</argument>
</call>
</service>
<service id="sonata.user.admin.group" class="%sonata.user.admin.group.class%">
<tag name="sonata.admin" manager_type="orm" group="%sonata.user.admin.groupname%" label="groups" label_catalogue="%sonata.user.admin.label_catalogue%" label_translator_strategy="sonata.admin.label.strategy.underscore"/>
<argument/>
<argument>%sonata.user.admin.group.entity%</argument>
<argument>%sonata.user.admin.group.controller%</argument>
<call method="setTranslationDomain">
<argument>%sonata.user.admin.group.translation_domain%</argument>
</call>
</service>
</services>
As you can see here the ids of our services:
sonata.user.admin.user
sonata.user.admin.group
The simplest method to overwrite them is to create the same services (I mean we will use this ids ) in our services.yml file.
Yes, you can have an argument with me, that this method is stupid, but as I said it's not the only one.
So Sonata services in OUR services.yml will looks like this:
sonata.user.admin.user:
class: "%sonata.user.admin.user.class%"
arguments: [~, "%sonata.user.admin.user.entity%", "%sonata.user.admin.user.controller%"]
tags:
- { name: sonata.admin, manager_type: orm, group: "%sonata.user.admin.groupname%", label_catalogue: "%sonata.user.admin.label_catalogue%", label: "users", icon: "<i class=\"fa fa-users\"></i>" }
calls:
- [ setUserManager, [ "#fos_user.user_manager" ] ]
- [ setTranslationDomain, [ "%sonata.user.admin.user.translation_domain%" ] ]
sonata.user.admin.group:
class: "%sonata.user.admin.group.class%"
arguments: [~, "%sonata.user.admin.group.entity%", "%sonata.user.admin.group.controller%"]
tags:
- { name: sonata.admin, manager_type: orm, group: "%sonata.user.admin.groupname%", label_catalogue: "%sonata.user.admin.label_catalogue%", label: "groups" }
calls:
- [ setTranslationDomain, [ "%sonata.user.admin.group.translation_domain%" ] ]
Now you can update the admin dashboard and see, that nothing have happened. But the our purpose was to disable this service from our dashboard and menu. Let's do the trick. Add
show_in_dashboard: false
tags:
- { show_in_dashboard: false, name: sonata.admin, manager_type: orm, group: "%sonata.user.admin.groupname%", label_catalogue: "%sonata.user.admin.label_catalogue%", label: "users", icon: "<i class=\"fa fa-user\"></i>" }
to the declaration of this service in services.yml.
Therefore our services will look like this:
sonata.user.admin.user:
class: "%sonata.user.admin.user.class%"
arguments: [~, "%sonata.user.admin.user.entity%", "%sonata.user.admin.user.controller%"]
tags:
- { name: sonata.admin, manager_type: orm, group: "%sonata.user.admin.groupname%", label_catalogue: "%sonata.user.admin.label_catalogue%", label: "users", icon: "<i class=\"fa fa-user\"></i>", show_in_dashboard: false }
calls:
- [ setUserManager, [ "#fos_user.user_manager" ] ]
- [ setTranslationDomain, [ "%sonata.user.admin.user.translation_domain%" ] ]
sonata.user.admin.group:
class: "%sonata.user.admin.group.class%"
arguments: [~, "%sonata.user.admin.group.entity%", "%sonata.user.admin.group.controller%"]
tags:
- { name: sonata.admin, manager_type: orm, group: "%sonata.user.admin.groupname%", label_catalogue: "%sonata.user.admin.label_catalogue%", label: "groups", show_in_dashboard: false }
calls:
- [ setTranslationDomain, [ "%sonata.user.admin.group.translation_domain%" ] ]
After this trivial manipulations Sonata services will completely disappear from your Dashboard.

SonataUserBundle : try to go /profile => route "sonata_customer_addresses" does not exist

I can't figured out why I have this error.
Herewith more informations abour my problem :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "sonata_customer_addresses" as such route does not exist.") in SonataUserBundle:Profile:action.html.twig at line 27.
to implement my own User Class.
I use Symfony 2.4 with dev-master SonataAdminBundle and SonataUserBundle. I try
you can find my config.yml :
sonata_user:
security_acl: true
manager_type: orm
profile:
# Profile show page is a dashboard as in SonataAdminBundle
dashboard:
blocks:
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> This is a sample user profile dashboard, feel free to override it in the configuration! Want to make this text dynamic? For instance display the user's name? Create a dedicated block and edit the configuration!"} }
- { position: left, type: sonata.order.block.recent_orders, settings: { title: Recent Orders, number: 5, mode: public }}
- { position: right, type: sonata.timeline.block.timeline, settings: { max_per_page: 15 }}
- { position: right, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 5, mode: public }}
- { position: right, type: sonata.news.block.recent_comments, settings: { title: Recent Comments, number: 5, mode: public }}
# Customize user portal menu by setting links
menu:
- { route: 'sonata_user_profile_show', label: 'sonata_profile_title', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_customer_addresses', label: 'link_list_addresses', domain: 'SonataCustomerBundle'}
- { route: 'sonata_user_profile_edit_authentication', label: 'link_edit_authentication', domain: 'SonataUserBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}
#sonata_admin:
# templates:
# dashboard: SonataAdminBundle:Core:dashboard.html.twig
sonata_admin:
title: Admin Panel
title_logo: /bundles/sonataadmin/logo_title.png
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
dashboard:
blocks:
# display a dashboard block
- { position: left, type: sonata.admin.block.admin_list }
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.user.block.menu:
sonata.user.block.account:
sonata.block.service.text:
sonata.block.service.action:
sonata.block.service.rss:
sonata_doctrine_orm_admin:
# default value is null, so doctrine uses the value defined in the configuration
entity_manager: ~
templates:
form:
- SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig
filter:
- SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig
types:
list:
array: SonataAdminBundle:CRUD:list_array.html.twig
boolean: SonataAdminBundle:CRUD:list_boolean.html.twig
date: SonataAdminBundle:CRUD:list_date.html.twig
time: SonataAdminBundle:CRUD:list_time.html.twig
datetime: SonataAdminBundle:CRUD:list_datetime.html.twig
text: SonataAdminBundle:CRUD:base_list_field.html.twig
trans: SonataAdminBundle:CRUD:list_trans.html.twig
string: SonataAdminBundle:CRUD:base_list_field.html.twig
smallint: SonataAdminBundle:CRUD:base_list_field.html.twig
bigint: SonataAdminBundle:CRUD:base_list_field.html.twig
integer: SonataAdminBundle:CRUD:base_list_field.html.twig
decimal: SonataAdminBundle:CRUD:base_list_field.html.twig
identifier: SonataAdminBundle:CRUD:base_list_field.html.twig
show:
array: SonataAdminBundle:CRUD:show_array.html.twig
boolean: SonataAdminBundle:CRUD:show_boolean.html.twig
date: SonataAdminBundle:CRUD:show_date.html.twig
time: SonataAdminBundle:CRUD:show_time.html.twig
datetime: SonataAdminBundle:CRUD:show_datetime.html.twig
text: SonataAdminBundle:CRUD:base_show_field.html.twig
trans: SonataAdminBundle:CRUD:show_trans.html.twig
string: SonataAdminBundle:CRUD:base_show_field.html.twig
smallint: SonataAdminBundle:CRUD:base_show_field.html.twig
bigint: SonataAdminBundle:CRUD:base_show_field.html.twig
integer: SonataAdminBundle:CRUD:base_show_field.html.twig
decimal: SonataAdminBundle:CRUD:base_show_field.html.twig
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
fos_user:
db_driver: orm
firewall_name: main
user_class: MyProject\UserBundle\Entity\User
group:
group_class: MyProject\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
service:
user_manager: sonata.user.orm.user_manager
and my routing.yml here :
sonata_user_security:
resource: "#SonataUserBundle/Resources/config/routing/sonata_security_1.xml"
sonata_user_resetting:
resource: "#SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml"
prefix: /resetting
sonata_user_profile:
resource: "#SonataUserBundle/Resources/config/routing/sonata_profile_1.xml"
prefix: /profile
sonata_user_register:
resource: "#SonataUserBundle/Resources/config/routing/sonata_registration_1.xml"
prefix: /register
sonata_user_change_password:
resource: "#SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml"
prefix: /profile
sonata_user:
resource: '#SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin
admin:
resource: '#SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
EDIT 1:
[router] Current routes
Name Method Scheme Host Path
_assetic_bootstrap_css ANY ANY ANY /assetic/bootstrap_css.less
_assetic_bootstrap_css_0 ANY ANY ANY /assetic/bootstrap_css_bootstrap_1.less
_assetic_jquery ANY ANY ANY /js/jquery.js
_assetic_jquery_0 ANY ANY ANY /js/jquery_jquery-2.1.1_1.js
_assetic_bootstrap_js ANY ANY ANY /js/bootstrap.js
_assetic_bootstrap_js_0 ANY ANY ANY /js/bootstrap_transition_1.js
_assetic_bootstrap_js_1 ANY ANY ANY /js/bootstrap_alert_2.js
_assetic_bootstrap_js_2 ANY ANY ANY /js/bootstrap_button_3.js
_assetic_bootstrap_js_3 ANY ANY ANY /js/bootstrap_carousel_4.js
_assetic_bootstrap_js_4 ANY ANY ANY /js/bootstrap_collapse_5.js
_assetic_bootstrap_js_5 ANY ANY ANY /js/bootstrap_dropdown_6.js
_assetic_bootstrap_js_6 ANY ANY ANY /js/bootstrap_modal_7.js
_assetic_bootstrap_js_7 ANY ANY ANY /js/bootstrap_tooltip_8.js
_assetic_bootstrap_js_8 ANY ANY ANY /js/bootstrap_popover_9.js
_assetic_bootstrap_js_9 ANY ANY ANY /js/bootstrap_scrollspy_10.js
_assetic_bootstrap_js_10 ANY ANY ANY /js/bootstrap_tab_11.js
_assetic_bootstrap_js_11 ANY ANY ANY /js/bootstrap_affix_12.js
_assetic_a56fa94 ANY ANY ANY /js/a56fa94.js
_assetic_a56fa94_0 ANY ANY ANY /js/a56fa94_part_1.js
_assetic_a56fa94_1 ANY ANY ANY /js/a56fa94_part_2.js
_assetic_65cec74 ANY ANY ANY /css/65cec74.css
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/purge
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_import ANY ANY ANY /_profiler/import
_profiler_export ANY ANY ANY /_profiler/export/{token}.txt
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_configurator_home ANY ANY ANY /_configurator/
_configurator_step ANY ANY ANY /_configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
fos_user_security_login ANY ANY ANY /login
fos_user_security_check POST ANY ANY /login_check
fos_user_security_logout ANY ANY ANY /logout
sonata_user_security_login ANY ANY ANY /login
sonata_user_security_check POST ANY ANY /login_check
sonata_user_security_logout ANY ANY ANY /logout
fos_user_resetting_request GET ANY ANY /resetting/request
fos_user_resetting_send_email POST ANY ANY /resetting/send-email
fos_user_resetting_check_email GET ANY ANY /resetting/check-email
fos_user_resetting_reset GET|POST ANY ANY /resetting/reset/{token}
sonata_user_resetting_request GET ANY ANY /resetting/request
sonata_user_resetting_send_email POST ANY ANY /resetting/send-email
sonata_user_resetting_check_email GET ANY ANY /resetting/check-email
sonata_user_resetting_reset GET|POST ANY ANY /resetting/reset/{token}
fos_user_profile_show GET ANY ANY /profile/
fos_user_profile_edit_authentication ANY ANY ANY /profile/edit-authentication
fos_user_profile_edit ANY ANY ANY /profile/edit-profile
sonata_user_profile_show GET ANY ANY /profile/
sonata_user_profile_edit_authentication ANY ANY ANY /profile/edit-authentication
sonata_user_profile_edit ANY ANY ANY /profile/edit-profile
fos_user_registration_register ANY ANY ANY /register/
fos_user_registration_check_email GET ANY ANY /register/check-email
fos_user_registration_confirm GET ANY ANY /register/confirm/{token}
fos_user_registration_confirmed GET ANY ANY /register/confirmed
sonata_user_registration_register ANY ANY ANY /register/
sonata_user_registration_check_email GET ANY ANY /register/check-email
sonata_user_registration_confirm GET ANY ANY /register/confirm/{token}
sonata_user_registration_confirmed GET ANY ANY /register/confirmed
fos_user_change_password GET|POST ANY ANY /profile/change-password
sonata_user_change_password GET|POST ANY ANY /profile/change-password
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check ANY ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
myproject_user_default_index ANY ANY ANY /hello/{name}
myproject_comment_default_index ANY ANY ANY /hello/{name}
myproject_provider_default_index ANY ANY ANY /hello/{name}
myproject_provider_providersearch_index ANY ANY ANY /ProviderSearch
myproject_service_default_index ANY ANY ANY /hello/{name}
myproject_geo_default_index ANY ANY ANY /hello/{name}
myproject_schedule_default_index ANY ANY ANY /hello/{name}
myproject_coupon_couponsearch_index ANY ANY ANY /couponSearch
my_filter ANY ANY ANY /filter/
myproject_coupon_default_index ANY ANY ANY /coupon
myproject_association_search ANY ANY ANY /associationSearch
myproject_association_search_result ANY ANY ANY /associationSearch/result
myproject_association_search_show ANY ANY ANY /association/{slug}
myproject_contact ANY ANY ANY /contact
myproject_core_homepage ANY ANY ANY /
myproject_city_typeahead ANY ANY ANY /autocompleteCity
myproject_assoName_typeahead ANY ANY ANY /autocompleteAssoName
myproject_providerName_typeahead ANY ANY ANY /autocompleteProviderName
myproject_core_static ANY ANY ANY /{page}
myproject_coupon ANY ANY ANY /coupon
myproject_coupon_search ANY ANY ANY /couponSearch
myproject_coupon_search_result ANY ANY ANY /couponSearch/result
myproject_provider_search_show ANY ANY ANY /provider/{slug}
fos_js_routing_js ANY ANY ANY /js/routing.{_format}
Ok I finally got a dashboard by removing all in sonata_user like this :
sonata_user:
security_acl: true
manager_type: orm
I try to get a Dashboard like in this documentation : http://sonata-project.org/bundles/user/2-2/doc/reference/user_dashboard.html without success.
I have a blank page now, I will do all dashboard on my own,I can't see other way...
You should copy paste the code from the inatallation documentation into config.yml (like me).
Remove the lines with sonata_customer and sonata_order.
profile:
# Profile show page is a dashboard as in SonataAdminBundle
dashboard:
blocks:
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> This is a sample user profile dashboard, feel free to override it in the configuration! Want to make this text dynamic? For instance display the user's name? Create a dedicated block and edit the configuration!"} }
- { position: left, type: sonata.order.block.recent_orders, settings: { title: Recent Orders, number: 5, mode: public }}
- { position: right, type: sonata.timeline.block.timeline, settings: { max_per_page: 15 }}
- { position: right, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 5, mode: public }}
- { position: right, type: sonata.news.block.recent_comments, settings: { title: Recent Comments, number: 5, mode: public }}
# Customize user portal menu by setting links
menu:
- { route: 'sonata_user_profile_show', label: 'sonata_profile_title', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_customer_addresses', label: 'link_list_addresses', domain: 'SonataCustomerBundle'}
- { route: 'sonata_user_profile_edit_authentication', label: 'link_edit_authentication', domain: 'SonataUserBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}

LiipImagineBundle thumbnails doesn't work

I am just trying to get working LiipImagineBundle.
Ok, all I got so far:
Installed using composer
$ php composer.phar require "liip/imagine-bundle:dev-master"
Enabled bundle in AppKernel.php
new Liip\ImagineBundle\LiipImagineBundle(),
Added to routing.yml
_imagine path
Added liip_imagine filter in config.yml
Checked using php app/console router:debug and path _imagine_my_thumb exist.
But after using:
<img src="{{ '/relative/path/to/image.jpg' | imagine_filter('my_thumb') }}" />
image is not rendered, path is simply not found error.
prod.log says that Route _imagine_my_thumb does not exist, although it exist, because it's displayed using router:debug for both environments.
You know that you should replace '/relative/path/to/image.jpg' with your image path?
Make sure your file exists.
A working example
config:
liip_imagine:
driver: gd
web_root: %kernel.root_dir%/../web
data_root: %kernel.root_dir%/../app
cache_mkdir_mode: 0777
cache_prefix: /media/cache
cache: web_path
cache_clearer: true
data_loader: filesystem
controller_action: liip_imagine.controller:filterAction
formats: []
filter_sets:
avatar:
filters:
thumbnail: { size: [40, 40], mode: outbound }
profile:
filters:
relative_resize: { widen: 500 }
html:
<img src="{{ 'uploads/images/filename.jpg' | imagine_filter('avatar') }}" alt="image">
enter code here
routing.yml:
_imagine:
resource: .
type: imagine
Remark: My source folder is in the app folder (see: data_root)
I had similar problem and after enable of php_fileinfo extension in php.ini render start to work.

How to access project configuration parameters from javascript in Symfony2

I'm using Symfony 2.1 dev and looking for easiest way to get parameter from app/config/parameters.yml (ini).
Simple example:
I have record in parameters.yml
parameters:
url: "http://domain.com"
Then i want to use it somehow in static js file
var url = "{{ app.url }}"; // trying to avoid hardcode
This token should be replaced by actual value from coonfig after
app/console assetic:dump
So final js will have
var url = "http://domain.com";
Currently i'm thinking about writing my own console command but firstly i want to ensure there is no any standard way of doing such things in Symfony2 or maybe some bundle that can halp me?
UPDATE: i'd like to do this with AsseticBundle, like YUI and LESS
assetic:
debug: %kernel.debug%
use_controller: false
write_to: %kernel.root_dir%/../web
filters:
cssrewrite: ~
lessphp: ~
yui_js:
jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar"
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
to add another one filter which will replace token {{ app.url }} in js file to actual "http://domain.com"
A simple solution would be to reference your parameters in the twig globals:
parameters:
url: "http://domain.com"
an_array:
twig: "is cool"
and: "symfony2 to"
twig:
globals:
app_parameters:
url: %url%
an_array: %an_array%
Then in your template:
<script>
window.parameters = {{ app_parameters|json_encode|raw }};
</script>
would render something like:
<script>
window.parameters = {"url":"http://domain.com","an_array":{"twig":"is cool","and":"symfony2 to"}};
</script>

Resources