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'}
Related
Created a grav frontend form with file uploading feature. Except file upload everything working fine. When i trying to upload file, getting some errors from 'form.vendor.js' and file field seems to be empty after getting error. Errors given below
form.vendor.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'trim')
at D.addedfile (form.vendor.js:5:11362)
at D.value (form.vendor.js:5:1513)
at D.value (form.vendor.js:5:25886)
at HTMLInputElement.<anonymous> (form.vendor.js:5:17561)
Form full definition given below
title: 'Job apply form'
published: true
body_classes: job-apply-main-page
cache_enable: false
visible: true
form:
name: job-apply
id: job-apply
action: ' '
fields:
-
name: job
label: Job
autocomplete: 'off'
type: text
validate:
required: false
-
name: applicantName
label: 'Name of Applicant *'
autocomplete: 'off'
type: text
validate:
required: true
message: 'Please enter the applicant name'
-
name: email
label: Email
type: email
validate:
required: false
-
name: coverletter
label: 'Cover Letter'
type: textarea
validate:
required: false
-
name: resumefile
label: Resume
placeholder: 'Upload Resume'
type: file
destination: user/data/resume
accept:
- .pdf
- .doc
- .docx
multiple: false
-
name: toEmail
label: 'Hidden Field'
type: text
outerclasses: hide-input-field
validate:
required: false
-
name: enquiry-g-recaptcha-response
label: Captcha
type: captcha
id: enquiry-captcha
outerclasses: captcha-field
recaptcha_not_validated: 'Captcha not valid!'
validate:
required: true
buttons:
-
type: submit
value: Save
process:
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- test#gmail.com
body: '{% include ''forms/data.html.twig'' %}'
attachments:
- resumefile
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- '{{ form.value.email }}'
body: '{% include ''forms/apply.html.twig'' with { "message": "Thank you for your Inquiry. We will get back you soon" } %}'
-
save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
filename: site-enquire.txt
operation: add
body: '{% include ''forms/data.txt.twig'' %}'
attachments:
- resumefile
-
message: 'Thank you for your feedback!'
reset: true
Grav and other plugins updated to latest version
Grav v1.7.27.1
Admin v1.10.27
Form v5.1.4
I cannot logout a user.
I ported custom user management logic over to a Symfony 4 project. It uses recipes for security and guard.
Here is the logout config in my main firewall:
logout:
path: /logout
target: /
Result:
- User goes to /logout
- User is redirected to /
- is_granted("IS_AUTHENTICATED_REMEMBERED") continues to return true in my template (false is expected)
Other Considerations:
- The firewall entry is getting triggered because I get errors if I remove it
- I have tried adding additional parameters to logout to destroy the session and cookies, however that made no difference
- Logging in works fine
Any idea on how to troubleshoot this?
:: edit - added security.yaml as requested ::
security:
encoders:
App\Entity\User: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
app_users:
entity: { class: App\Entity\User, property: email }
app_oauth:
id: app.oauth_user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
provider: app_users
anonymous: ~
oauth:
resource_owners:
google: "/login/check-google"
default_target_path: /
login_path: /
failure_path: /login
oauth_user_provider:
service: app.oauth_user_provider
remember_me:
secret: "%env(APP_SECRET)%"
lifetime: 2592000
path: /
guard:
authenticators:
- App\Security\LoginFormAuthenticator
entry_point: App\Security\LoginFormAuthenticator
logout:
path: /logout
target: /
switch_user: ~
Add these commands
In security.yaml
logout:
path: /logout
target: /
invalidate_session: true
In controller
/**
* #Route("/logout", name="logout")
*/
public function logout()
{
}
In logout button
<a class="text-muted" href="{{ path('logout') }}">logout </a>
Check the serialize and unserialize methods for field $this->email in App\Entity\User.
See my answer to the same problem here
I'll repeat what worked for me:
If you follow the instructions at Symfony Security Logging Out, make sure you use the proper route name to get to /logout. I had to use 'app_logout' to actually get it to logout and I was not able to change that path name in the Security.yaml file without also modifying the controller annotations (see below). No controller needed. No custom handler needed (thank god).
After you configure logout, try running php bin/console debug:router to check the actual route to /logout.
The logout part of my Security.yaml looked like this:
logout:
path: app_logout
# where to redirect after logout
target: front
Based on instructions, I added an empty controller (if you want custom path names, you'll have to change the path names here plus add the change to Security.yaml):
<?php
//App/Controller/SecurityController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class SecurityController extends AbstractController
{
/**
* #Route("/logout", name="app_logout")
*/
public function logout()
{
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
}
}
My call looked like this:
<a class="nav-link" href="{{ path('app_logout') }}">Logout</a>
Check your routes with php bin/console debug:router.
For me the security_logout created in the security controller was being called first. I simple removed the function from security controller and it worked (remove the annotation too)
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
I'm using SonataAdminBundle to generate a CRUD for my Page entity.
With the yaml file bellow the menu is displayed in the sidebar.
I would like to change the group default icon which is "fa fa-folder".
But I don't find the option to do it.
sonata.admin.page:
class: FM\AppBundle\Admin\Page\Page
tags:
- { name: sonata.admin, manager_type: orm, group: "CMS", label: "Pages" }
arguments:
- ~
- FM\AppBundle\Entity\Page\Page
- ~
"icon" option:
icon: "<i class=\"fa fa-folder\"></i>"
In your example:
sonata.admin.page:
class: FM\AppBundle\Admin\Page\Page
tags:
- { name: sonata.admin, manager_type: orm, group: "CMS", label: "Pages", icon: "<i class=\"fa fa-folder\"></i>" }
arguments:
- ~
- FM\AppBundle\Entity\Page\Page
- ~
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