diff --git a/app/AppKernel.php b/app/AppKernel.php index a77ed6ca6..2a32c7266 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -52,8 +52,6 @@ public function registerBundles() new Cocorico\PageBundle\CocoricoPageBundle(), new Cocorico\CMSBundle\CocoricoCMSBundle(), new Cocorico\BreadcrumbBundle\CocoricoBreadcrumbBundle(), - new Cocorico\SonataAdminBundle\CocoricoSonataAdminBundle(), - new Cocorico\SonataUserBundle\CocoricoSonataUserBundle(), new Cocorico\MessageBundle\CocoricoMessageBundle(), new Cocorico\ContactBundle\CocoricoContactBundle(), new Cocorico\ReviewBundle\CocoricoReviewBundle(), diff --git a/app/Resources/SonataAdminBundle/views/CRUD/base_edit_form.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/base_edit_form.html.twig new file mode 100644 index 000000000..b01985311 --- /dev/null +++ b/app/Resources/SonataAdminBundle/views/CRUD/base_edit_form.html.twig @@ -0,0 +1,151 @@ +{% block form %} + {{ sonata_block_render_event('sonata.admin.edit.form.top', { 'admin': admin, 'object': object }) }} + + {# NEXT_MAJOR: remove default filter #} + {% set url = objectId|default(admin.id(object)) is not null ? 'edit' : 'create' %} + + {% if not admin.hasRoute(url)%} +
+ {{ "form_not_available"|trans({}, "SonataAdminBundle") }} +
+ {% else %} +
+ + {{ include('@SonataAdmin/Helper/render_form_dismissable_errors.html.twig') }} + + {% block sonata_pre_fieldsets %} +
+ {% endblock %} + + {% block sonata_tab_content %} + {% import "@SonataAdmin/CRUD/base_edit_form_macro.html.twig" as form_helper %} + {% set has_tab = ((admin.formtabs|length == 1 and admin.formtabs|keys[0] != 'default') or admin.formtabs|length > 1 ) %} + +
+ {% if has_tab %} + {% set tab_prefix = 'tab_' ~ admin.uniqid ~ '_' ~ random() %} + {% set tab_query_index = app.request.query.get('_tab', 0)|split("_")|last %} + + {% else %} + {{ form_helper.render_groups(admin, form, admin.formtabs['default'].groups, has_tab) }} + {% endif %} +
+ {% endblock %} + + {% block sonata_post_fieldsets %} +
+ {% endblock %} + + {{ form_rest(form) }} + + {% block formactions %} +
+ {% block sonata_form_actions %} + {% if app.request.isxmlhttprequest %} + {# NEXT_MAJOR: remove default filter #} + {% if objectId|default(admin.id(object)) is not null %} + + {% if admin.hasRoute('delete') and admin.hasAccess('delete', object) %} + {{ 'delete_or'|trans({}, 'SonataAdminBundle') }} + + {{ 'link_delete'|trans({}, 'SonataAdminBundle') }} + + {% endif %} + {% else %} + + {% endif %} + {% else %} + {% if admin.supportsPreviewMode %} + + {% endif %} + {# NEXT_MAJOR: remove default filter #} + {% if objectId|default(admin.id(object)) is not null %} + + + {% if admin.hasRoute('list') and admin.hasAccess('list') %} + + {% endif %} + + {% if admin.hasRoute('delete') and admin.hasAccess('delete', object) %} + {{ 'delete_or'|trans({}, 'SonataAdminBundle') }} + {{ 'link_delete'|trans({}, 'SonataAdminBundle') }} + {% endif %} + + {#Mangopay dashboard access for bank wire payout and payin refund#} + {% if bundleExist('CocoricoMangoPayBundle') and admin.isGranted('EDIT', object) %} + {% if admin.hasroute('mangopay_withdraw') and object.status == BookingBankWireConstants.STATUS_TO_DO %} + {% include 'CocoricoMangoPayBundle:Admin:list_action_do_bank_wire.html.twig' with {'object': object} only %} + {% elseif bundleExist('CocoricoListingDepositBundle') and admin.hasroute('mangopay_deposit_refund') %} + {% include 'CocoricoMangoPayBundle:Admin:list_action_do_deposit_payin_refund.html.twig' with {'object': object} only %} + {% include 'CocoricoMangoPayBundle:Admin:list_action_do_deposit_bankwire.html.twig' with {'object': object} only %} + {% endif %} + {% endif %} + + {% if admin.isAclEnabled() and admin.hasRoute('acl') and admin.hasAccess('acl', object) %} + {{ 'link_edit_acl'|trans({}, 'SonataAdminBundle') }} + {% endif %} + {% else %} + {% if admin.hasroute('edit') and admin.hasAccess('edit') %} + + {% endif %} + {% if admin.hasroute('list') and admin.hasAccess('list') %} + + {% endif %} + + {% endif %} + {% endif %} + {% endblock %} +
+ {% endblock formactions %} +
+ {% endif%} + + {{ sonata_block_render_event('sonata.admin.edit.form.bottom', { 'admin': admin, 'object': object }) }} + +{% endblock %} + diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_history.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/base_history.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_history.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/base_history.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/batch_confirmation.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/batch_confirmation.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/batch_confirmation.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/batch_confirmation.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_boolean.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/list_boolean.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_boolean.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/list_boolean.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_date.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/list_date.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_date.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/list_date.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_datetime.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/list_datetime.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_datetime.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/list_datetime.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_time.html.twig b/app/Resources/SonataAdminBundle/views/CRUD/list_time.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/CRUD/list_time.html.twig rename to app/Resources/SonataAdminBundle/views/CRUD/list_time.html.twig diff --git a/app/Resources/SonataAdminBundle/views/Pager/base_results.html.twig b/app/Resources/SonataAdminBundle/views/Pager/base_results.html.twig new file mode 100644 index 000000000..19a17f88a --- /dev/null +++ b/app/Resources/SonataAdminBundle/views/Pager/base_results.html.twig @@ -0,0 +1,17 @@ +{% extends '@!SonataAdmin/Pager/base_results.html.twig' %} + +{% block num_results %} + {{ 'list_results_count'|transchoice(admin.datagrid.pager.nbresults, {'%count%': admin.datagrid.pager.nbresults}, 'SonataAdminBundle') }} +  -  +{% endblock %} + +{% block max_per_page %} + + +{% endblock %} diff --git a/app/Resources/SonataAdminBundle/views/standard_layout.html.twig b/app/Resources/SonataAdminBundle/views/standard_layout.html.twig new file mode 100644 index 000000000..c738c451f --- /dev/null +++ b/app/Resources/SonataAdminBundle/views/standard_layout.html.twig @@ -0,0 +1,50 @@ +{% extends '@!SonataAdmin/standard_layout.html.twig' %} + +{% block stylesheets %} + {{ parent() }} + +{% endblock %} + +{% block javascripts %} + {{ parent() }} + +{% endblock %} + +{% block logo %} + {% spaceless %} + + {% endspaceless %} +{% endblock %} + +{% block sonata_top_nav_menu_user_block %} + +{% endblock %} + +{% block side_bar_after_nav %} + {% if app.user and is_granted(sonata_admin.adminPool.getOption('role_admin')) %} + + {% endif %} +{% endblock %} diff --git a/src/Cocorico/SonataUserBundle/Resources/views/Admin/Security/login.html.twig b/app/Resources/SonataUserBundle/Resources/views/Admin/Security/login.html.twig similarity index 100% rename from src/Cocorico/SonataUserBundle/Resources/views/Admin/Security/login.html.twig rename to app/Resources/SonataUserBundle/Resources/views/Admin/Security/login.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/impersonating.html.twig b/app/Resources/views/admin/impersonating.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/impersonating.html.twig rename to app/Resources/views/admin/impersonating.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/list_action_list_booking_with_voucher.html.twig b/app/Resources/views/admin/list_action_list_booking_with_voucher.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/list_action_list_booking_with_voucher.html.twig rename to app/Resources/views/admin/list_action_list_booking_with_voucher.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/list_action_list_user_listings.html.twig b/app/Resources/views/admin/list_action_list_user_listings.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/list_action_list_user_listings.html.twig rename to app/Resources/views/admin/list_action_list_user_listings.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/list_booking_expiration_date.html.twig b/app/Resources/views/admin/list_booking_expiration_date.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/list_booking_expiration_date.html.twig rename to app/Resources/views/admin/list_booking_expiration_date.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/list_field_value_translated.html.twig b/app/Resources/views/admin/list_field_value_translated.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/list_field_value_translated.html.twig rename to app/Resources/views/admin/list_field_value_translated.html.twig diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/user_block.html.twig b/app/Resources/views/admin/user_block.html.twig similarity index 100% rename from src/Cocorico/SonataAdminBundle/Resources/views/user_block.html.twig rename to app/Resources/views/admin/user_block.html.twig diff --git a/app/config/security.yml b/app/config/security.yml index 2d77e8b57..1e256937f 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -27,7 +27,7 @@ security: target: /%cocorico.admin%/ # invalidate_session: false #uncomment it to avoid to logout from all firewall anonymous: true - + logout_on_user_change: true main: context: frontend pattern: ^/(%cocorico.locales_string%) @@ -63,7 +63,7 @@ security: anonymous: true switch_user: { role: ROLE_SUPER_ADMIN, parameter: _become_who_you_are } # switch_user: true - + logout_on_user_change: true dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false diff --git a/src/Cocorico/CMSBundle/Admin/FooterAdmin.php b/src/Cocorico/CMSBundle/Admin/FooterAdmin.php index 30c1e7243..0ad5b0e87 100644 --- a/src/Cocorico/CMSBundle/Admin/FooterAdmin.php +++ b/src/Cocorico/CMSBundle/Admin/FooterAdmin.php @@ -19,6 +19,9 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Validator\Constraints\NotBlank; class FooterAdmin extends AbstractAdmin @@ -76,23 +79,23 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'url' => array( - 'field_type' => 'url', + 'field_type' => UrlType::class, 'locale_options' => $urls, 'required' => false, ), 'urlHash' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $urlsHash, 'required' => false, 'disabled' => true ), 'title' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, 'required' => true, ), 'link' => array( - 'field_type' => 'url', + 'field_type' => UrlType::class, 'locale_options' => $links, 'required' => true, @@ -166,7 +169,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null diff --git a/src/Cocorico/ContactBundle/Admin/ContactAdmin.php b/src/Cocorico/ContactBundle/Admin/ContactAdmin.php index affffe5dd..4160e1cf6 100644 --- a/src/Cocorico/ContactBundle/Admin/ContactAdmin.php +++ b/src/Cocorico/ContactBundle/Admin/ContactAdmin.php @@ -18,6 +18,7 @@ use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EmailType; class ContactAdmin extends AbstractAdmin { @@ -51,7 +52,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'email', - 'email', + EmailType::class, array( 'label' => 'admin.contact.email.label', ) @@ -169,7 +170,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.contact.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_contact' ) ) diff --git a/src/Cocorico/CoreBundle/Admin/BookingAdmin.php b/src/Cocorico/CoreBundle/Admin/BookingAdmin.php index 5591c60af..10cb22ad1 100644 --- a/src/Cocorico/CoreBundle/Admin/BookingAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/BookingAdmin.php @@ -21,8 +21,17 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\Type\Filter\NumberType; +use Sonata\AdminBundle\Form\Type\AdminType; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\CollectionType; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TimeType; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; @@ -112,7 +121,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('admin.booking.title') ->add( 'user', - 'sonata_type_model', + ModelType::class, array( 'query' => $askerQuery, 'disabled' => true, @@ -121,7 +130,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'listing.user', - 'sonata_type_model', + ModelType::class, array( 'query' => $offererQuery, 'disabled' => true, @@ -130,7 +139,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'listing', - 'sonata_type_model', + ModelType::class, array( 'query' => $listingQuery, 'disabled' => true, @@ -180,7 +189,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'discountVoucher', - 'integer', + IntegerType::class, array( 'disabled' => true, 'label' => 'admin.booking.discount_voucher.label', @@ -285,7 +294,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'start', - 'date', + DateType::class, array( 'disabled' => true, 'label' => 'admin.booking.start.label', @@ -294,7 +303,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'end', - 'date', + DateType::class, array( 'disabled' => true, 'label' => 'admin.booking.end.label', @@ -306,7 +315,7 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( 'startTime', - 'time', + TimeType::class, array( 'disabled' => true, 'label' => 'admin.booking.start_time.label', @@ -315,7 +324,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'endTime', - 'time', + TimeType::class, array( 'disabled' => true, 'label' => 'admin.booking.end_time.label', @@ -424,7 +433,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('admin.booking.delivery') ->add( 'listing.location.completeAddress', - 'text', + TextType::class, array( 'disabled' => true, 'label' => 'admin.listing.location.label' @@ -487,7 +496,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('admin.booking.delivery') ->add( 'userAddress', - 'sonata_type_admin', + AdminType::class, array( 'delete' => false, 'disabled' => true, @@ -512,7 +521,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'options', - 'sonata_type_collection', + CollectionType::class, array( //IMPORTANT!: Disable this field else if child form has all its fields disabled then the child entities will be removed while saving 'disabled' => true, @@ -520,7 +529,7 @@ protected function configureFormFields(FormMapper $formMapper) 'delete' => false, 'delete_options' => array( // You may otherwise choose to put the field but hide it - 'type' => 'hidden', + 'type' => HiddenType::class, // In that case, you need to fill in the options as well 'type_options' => array( 'mapped' => false, @@ -640,7 +649,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -663,7 +672,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -673,8 +682,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getAmountMinFilter'), - 'field_type' => 'text', - 'operator_type' => 'choice', + 'field_type' => TextType::class, + 'operator_type' => ChoiceType::class, 'operator_options' => array( 'choices' => array( NumberType::TYPE_GREATER_THAN => '>=', @@ -688,8 +697,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getAmountMaxFilter'), - 'field_type' => 'text', - 'operator_type' => 'choice', + 'field_type' => TextType::class, + 'operator_type' => ChoiceType::class, 'operator_options' => array( 'choices' => array( NumberType::TYPE_LESS_EQUAL => '<=', @@ -772,7 +781,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.booking.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_booking' ) ) @@ -849,7 +858,7 @@ protected function configureListFields(ListMapper $listMapper) 'expiration', null, array( - 'template' => 'CocoricoSonataAdminBundle::list_booking_expiration_date.html.twig', + 'template' => 'admin/list_booking_expiration_date.html.twig', 'label' => 'admin.booking.expire_at.label', 'bookingExpirationDelay' => $this->bookingExpirationDelay, 'bookingAcceptationDelay' => $this->bookingAcceptationDelay, diff --git a/src/Cocorico/CoreBundle/Admin/BookingBankWireAdmin.php b/src/Cocorico/CoreBundle/Admin/BookingBankWireAdmin.php index 9201ad898..eaefb2007 100644 --- a/src/Cocorico/CoreBundle/Admin/BookingBankWireAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/BookingBankWireAdmin.php @@ -20,8 +20,12 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\TextType; class BookingBankWireAdmin extends AbstractAdmin { @@ -94,7 +98,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('') ->add( 'user', - 'sonata_type_model', + ModelType::class, array( 'query' => $offererQuery, 'disabled' => true, @@ -182,7 +186,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'booking.discountVoucher', - 'integer', + IntegerType::class, array( 'disabled' => true, 'label' => 'admin.booking.discount_voucher.label', @@ -293,7 +297,7 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( 'amountToWireDecimal', - 'text', + TextType::class, array( 'disabled' => true, 'label' => 'admin.booking.amount_to_wire.label', @@ -337,7 +341,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'wireReference', - 'text', + TextType::class, array( 'disabled' => true, 'sonata_help' => 'Wire Reference', @@ -413,7 +417,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -430,7 +434,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.booking_bank_wire.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_booking' ) ) @@ -446,7 +450,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.booking.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_booking' ) ) diff --git a/src/Cocorico/CoreBundle/Admin/BookingPayinRefundAdmin.php b/src/Cocorico/CoreBundle/Admin/BookingPayinRefundAdmin.php index 40b4d3279..9feb51f43 100644 --- a/src/Cocorico/CoreBundle/Admin/BookingPayinRefundAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/BookingPayinRefundAdmin.php @@ -18,7 +18,9 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class BookingPayinRefundAdmin extends AbstractAdmin @@ -76,7 +78,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('admin.booking_payin_refund.title') ->add( 'user', - 'sonata_type_model', + ModelType::class, array( 'query' => $askerQuery, 'disabled' => true, @@ -231,7 +233,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -255,7 +257,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.booking.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_booking' ) ) diff --git a/src/Cocorico/CoreBundle/Admin/BookingUserAddressAdmin.php b/src/Cocorico/CoreBundle/Admin/BookingUserAddressAdmin.php index a52f3b93c..b3dee3f21 100644 --- a/src/Cocorico/CoreBundle/Admin/BookingUserAddressAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/BookingUserAddressAdmin.php @@ -5,6 +5,8 @@ use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Symfony\Component\Form\Extension\Core\Type\CountryType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; class BookingUserAddressAdmin extends AbstractAdmin { @@ -23,7 +25,7 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( 'address', - 'textarea', + TextareaType::class, array( 'label' => 'form.address.address', 'required' => false, @@ -47,7 +49,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'country', - 'country', + CountryType::class, array( 'label' => 'form.address.country', 'required' => false, diff --git a/src/Cocorico/CoreBundle/Admin/ListingAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingAdmin.php index 51022e553..14607465b 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingAdmin.php @@ -22,9 +22,14 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\Type\Filter\NumberType; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; class ListingAdmin extends AbstractAdmin { @@ -133,15 +138,15 @@ function ($num) { 'required_locales' => $this->locales, 'fields' => array( 'title' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions, ), 'rules' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $rules, 'required' => false, ), @@ -154,7 +159,7 @@ function ($num) { ) ->add( 'user', - 'sonata_type_model', + ModelType::class, array( 'query' => $offererQuery, 'disabled' => true, @@ -224,7 +229,7 @@ function ($num) { ) ->add( 'location.completeAddress', - 'text', + TextType::class, array( 'disabled' => true, 'label' => 'admin.listing.location.label' @@ -286,8 +291,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getFullNameFilter'), - 'field_type' => 'text', - 'operator_type' => 'hidden', + 'field_type' => TextType::class, + 'operator_type' => HiddenType::class, 'operator_options' => array(), 'label' => 'admin.listing.offerer.label' ) @@ -336,7 +341,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -359,7 +364,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null @@ -369,8 +374,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getPriceMinFilter'), - 'field_type' => 'text', - 'operator_type' => 'choice', + 'field_type' => TextType::class, + 'operator_type' => ChoiceType::class, 'operator_options' => array( 'choices' => array( NumberType::TYPE_GREATER_EQUAL => '>=', @@ -384,8 +389,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getPriceMaxFilter'), - 'field_type' => 'text', - 'operator_type' => 'choice', + 'field_type' => TextType::class, + 'operator_type' => ChoiceType::class, 'operator_options' => array( 'choices' => array( NumberType::TYPE_LESS_EQUAL => '<=' @@ -461,7 +466,7 @@ protected function configureListFields(ListMapper $listMapper) null, array( 'label' => 'admin.listing.status.label', - 'template' => 'CocoricoSonataAdminBundle::list_field_value_translated.html.twig', + 'template' => 'admin/list_field_value_translated.html.twig', 'data_trans' => 'cocorico_listing' ) ) @@ -513,7 +518,7 @@ protected function configureListFields(ListMapper $listMapper) 'impersonating', 'string', array( - 'template' => 'CocoricoSonataAdminBundle::impersonating.html.twig', + 'template' => 'admin/impersonating.html.twig', ) ); } diff --git a/src/Cocorico/CoreBundle/Admin/ListingCategoryAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingCategoryAdmin.php index 66babc63e..7ee55824c 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingCategoryAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingCategoryAdmin.php @@ -20,6 +20,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Validator\Constraints\NotBlank; class ListingCategoryAdmin extends AbstractAdmin @@ -68,7 +69,7 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'name' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), 'slug' => array( diff --git a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicAdmin.php index c891c8e14..6e81e1b69 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicAdmin.php @@ -17,7 +17,11 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Form\Type\ModelListType; use Sonata\AdminBundle\Route\RouteCollection; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Validator\Constraints\NotBlank; class ListingCharacteristicAdmin extends AbstractAdmin @@ -66,11 +70,11 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'name' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions, ) ), @@ -87,7 +91,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'listingCharacteristicType', - 'sonata_type_model_list', + ModelListType::class, array( 'label' => 'admin.listing_characteristic.type.label', 'constraints' => array(new NotBlank()) @@ -95,7 +99,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'listingCharacteristicGroup', - 'sonata_type_model_list', + ModelListType::class, array( 'label' => 'admin.listing_characteristic.group.label', 'constraints' => array(new NotBlank()) diff --git a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicGroupAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicGroupAdmin.php index 3a8b48af3..830a219b7 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicGroupAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicGroupAdmin.php @@ -18,6 +18,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Validator\Constraints\NotBlank; class ListingCharacteristicGroupAdmin extends AbstractAdmin @@ -62,7 +63,7 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'name' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), ), diff --git a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicTypeAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicTypeAdmin.php index 7f1085a5e..65a5c12d3 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicTypeAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicTypeAdmin.php @@ -16,6 +16,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\CollectionType; class ListingCharacteristicTypeAdmin extends AbstractAdmin { @@ -51,7 +52,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'listingCharacteristicValues', - 'sonata_type_collection', + CollectionType::class, array( 'by_reference' => false, 'label' => 'admin.listing_characteristic_type.values.label' diff --git a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicValueAdmin.php b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicValueAdmin.php index f634a9932..7dfa54c99 100644 --- a/src/Cocorico/CoreBundle/Admin/ListingCharacteristicValueAdmin.php +++ b/src/Cocorico/CoreBundle/Admin/ListingCharacteristicValueAdmin.php @@ -17,6 +17,7 @@ use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Validator\Constraints\NotBlank; class ListingCharacteristicValueAdmin extends AbstractAdmin @@ -60,7 +61,7 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'name' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), ), diff --git a/src/Cocorico/CoreBundle/Form/Extension/ImageTypeExtension.php b/src/Cocorico/CoreBundle/Form/Extension/ImageTypeExtension.php index e899612eb..70336a682 100644 --- a/src/Cocorico/CoreBundle/Form/Extension/ImageTypeExtension.php +++ b/src/Cocorico/CoreBundle/Form/Extension/ImageTypeExtension.php @@ -13,6 +13,7 @@ namespace Cocorico\CoreBundle\Form\Extension; use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -23,7 +24,7 @@ class ImageTypeExtension extends AbstractTypeExtension public function getExtendedType() { - return 'file'; + return FileType::class; } /** diff --git a/src/Cocorico/CoreBundle/Form/Type/Dashboard/ListingEditDescriptionType.php b/src/Cocorico/CoreBundle/Form/Type/Dashboard/ListingEditDescriptionType.php index d6c5b3fc0..853367adc 100644 --- a/src/Cocorico/CoreBundle/Form/Type/Dashboard/ListingEditDescriptionType.php +++ b/src/Cocorico/CoreBundle/Form/Type/Dashboard/ListingEditDescriptionType.php @@ -17,6 +17,8 @@ use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Validator\Constraints\NotBlank; class ListingEditDescriptionType extends ListingEditType implements TranslationContainerInterface @@ -57,15 +59,15 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'required_locales' => array($this->locale), 'fields' => array( 'title' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles ), 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions ), 'rules' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $rules ), 'slug' => array( diff --git a/src/Cocorico/CoreBundle/Form/Type/Frontend/ListingNewType.php b/src/Cocorico/CoreBundle/Form/Type/Frontend/ListingNewType.php index e34a2aefa..71cb3e19e 100644 --- a/src/Cocorico/CoreBundle/Form/Type/Frontend/ListingNewType.php +++ b/src/Cocorico/CoreBundle/Form/Type/Frontend/ListingNewType.php @@ -23,6 +23,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -95,11 +97,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'required_locales' => array($this->locale), 'fields' => array( 'title' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, ), 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions, ), 'rules' => array( diff --git a/src/Cocorico/CoreBundle/Form/Type/ImageType.php b/src/Cocorico/CoreBundle/Form/Type/ImageType.php index f47bb9e13..d3f11d684 100644 --- a/src/Cocorico/CoreBundle/Form/Type/ImageType.php +++ b/src/Cocorico/CoreBundle/Form/Type/ImageType.php @@ -12,6 +12,7 @@ namespace Cocorico\CoreBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -29,7 +30,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( $builder->create( 'new', - 'file', + FileType::class, array( 'mapped' => false, //'property_path' => 'images', diff --git a/src/Cocorico/CoreBundle/Form/Type/ListingListingCharacteristicType.php b/src/Cocorico/CoreBundle/Form/Type/ListingListingCharacteristicType.php index c5638d716..cf969019c 100644 --- a/src/Cocorico/CoreBundle/Form/Type/ListingListingCharacteristicType.php +++ b/src/Cocorico/CoreBundle/Form/Type/ListingListingCharacteristicType.php @@ -14,6 +14,7 @@ use Cocorico\CoreBundle\Entity\ListingListingCharacteristic; use Cocorico\CoreBundle\Repository\ListingCharacteristicValueRepository; use Symfony\Component\Form\AbstractType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -46,7 +47,7 @@ function (FormEvent $event) { $form->add( 'listingCharacteristicValue', - 'entity', + EntityType::class, array( 'query_builder' => function (ListingCharacteristicValueRepository $lcvr) use ($llc) { $lct = $llc->getListingCharacteristic()->getListingCharacteristicType(); diff --git a/src/Cocorico/CoreBundle/Resources/config/config.yml b/src/Cocorico/CoreBundle/Resources/config/config.yml index ffb5e9b6c..26141d8ef 100644 --- a/src/Cocorico/CoreBundle/Resources/config/config.yml +++ b/src/Cocorico/CoreBundle/Resources/config/config.yml @@ -245,23 +245,10 @@ sonata_block: sonata_admin: - title: "%cocorico.site_name% administration" + title: "%cocorico.site_name% administration" title_logo: /images/logo2.gif - templates: - layout: CocoricoSonataAdminBundle::standard_layout.html.twig - user_block: CocoricoSonataAdminBundle::user_block.html.twig -# show: SonataAdminBundle:CRUD:show.html.twig - - dashboard: - blocks: -# - position: left -# type: sonata.admin.block.admin_list -# - position: right -# type: sonata.block.service.text -# settings: -# content: '

Welcome

...

' - + user_block: "admin/user_block.html.twig" sonata_doctrine_orm_admin: audit: diff --git a/src/Cocorico/CoreBundle/Translator/AdminExtractor.php b/src/Cocorico/CoreBundle/Translator/AdminExtractor.php index bdb808c1b..9b1c76fe2 100644 --- a/src/Cocorico/CoreBundle/Translator/AdminExtractor.php +++ b/src/Cocorico/CoreBundle/Translator/AdminExtractor.php @@ -17,6 +17,7 @@ use PhpParser\Node; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor; +use Twig\Node\Node as TwigNode; class AdminExtractor implements FileVisitorInterface, NodeVisitor { @@ -85,7 +86,7 @@ public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) { } - public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, \Twig_Node $ast) + public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, TwigNode $ast) { } } diff --git a/src/Cocorico/CoreBundle/Translator/EntityExtractor.php b/src/Cocorico/CoreBundle/Translator/EntityExtractor.php index 64d86ad39..1cfdeb7aa 100644 --- a/src/Cocorico/CoreBundle/Translator/EntityExtractor.php +++ b/src/Cocorico/CoreBundle/Translator/EntityExtractor.php @@ -17,6 +17,7 @@ use PhpParser\Node; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor; +use Twig\Node\Node as TwigNode; class EntityExtractor implements FileVisitorInterface, NodeVisitor { @@ -111,7 +112,7 @@ public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) { } - public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, \Twig_Node $ast) + public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, TwigNode $ast) { } } diff --git a/src/Cocorico/CoreBundle/Twig/CoreExtension.php b/src/Cocorico/CoreBundle/Twig/CoreExtension.php index 3f961497d..67d293eba 100644 --- a/src/Cocorico/CoreBundle/Twig/CoreExtension.php +++ b/src/Cocorico/CoreBundle/Twig/CoreExtension.php @@ -1,5 +1,6 @@ add( 'sender', - 'sonata_type_model', + ModelType::class, array( 'query' => $senderQuery, 'disabled' => true, diff --git a/src/Cocorico/MessageBundle/Admin/ThreadAdmin.php b/src/Cocorico/MessageBundle/Admin/ThreadAdmin.php index c8a4bd76a..83b7defc2 100644 --- a/src/Cocorico/MessageBundle/Admin/ThreadAdmin.php +++ b/src/Cocorico/MessageBundle/Admin/ThreadAdmin.php @@ -18,8 +18,13 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\CollectionType; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; class ThreadAdmin extends AbstractAdmin @@ -138,7 +143,7 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( 'listing', - 'sonata_type_model', + ModelType::class, array( 'query' => $listingQuery, 'disabled' => true, @@ -152,7 +157,7 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( 'messages', - 'sonata_type_collection', + CollectionType::class, array( // IMPORTANT!: Disable this field otherwise if child form has all its fields disabled // then the child entities will be removed while saving @@ -189,7 +194,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getMessageTypeFilter'), - 'field_type' => 'choice', + 'field_type' => ChoiceType::class, 'label' => 'admin.thread.type.label' ), ChoiceType::class, @@ -207,8 +212,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getFromNameFilter'), - 'field_type' => 'text', - 'operator_type' => 'hidden', + 'field_type' => TextType::class, + 'operator_type' => HiddenType::class, 'operator_options' => array(), 'label' => 'admin.thread.from.label' ) @@ -218,8 +223,8 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) 'doctrine_orm_callback', array( 'callback' => array($this, 'getToNameFilter'), - 'field_type' => 'text', - 'operator_type' => 'hidden', + 'field_type' => TextType::class, + 'operator_type' => HiddenType::class, 'operator_options' => array(), 'label' => 'admin.thread.to.label' ) @@ -242,7 +247,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null diff --git a/src/Cocorico/PageBundle/Admin/PageAdmin.php b/src/Cocorico/PageBundle/Admin/PageAdmin.php index 267e81ca1..96a22c5c0 100644 --- a/src/Cocorico/PageBundle/Admin/PageAdmin.php +++ b/src/Cocorico/PageBundle/Admin/PageAdmin.php @@ -18,6 +18,9 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Validator\Constraints\NotBlank; class PageAdmin extends AbstractAdmin @@ -71,7 +74,7 @@ protected function configureFormFields(FormMapper $formMapper) 'required_locales' => $this->locales, 'fields' => array( 'title' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $titles, 'required' => true, ), @@ -87,17 +90,17 @@ protected function configureFormFields(FormMapper $formMapper) ) ), 'metaTitle' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'locale_options' => $metaTitles, 'required' => true, ), 'metaDescription' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $metaDescriptions, 'required' => true, ), 'slug' => array( - 'field_type' => 'text', + 'field_type' => TextType::class, 'disabled' => true, ) ), @@ -168,7 +171,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null diff --git a/src/Cocorico/ReviewBundle/Admin/ReviewAdmin.php b/src/Cocorico/ReviewBundle/Admin/ReviewAdmin.php index 5d266024d..5c374bbda 100644 --- a/src/Cocorico/ReviewBundle/Admin/ReviewAdmin.php +++ b/src/Cocorico/ReviewBundle/Admin/ReviewAdmin.php @@ -18,7 +18,9 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\DatePickerType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class ReviewAdmin extends AbstractAdmin @@ -68,7 +70,7 @@ protected function configureFormFields(FormMapper $formMapper) ->with('admin.review.title') ->add( 'booking', - 'sonata_type_model', + ModelType::class, array( 'query' => $bookingQuery, 'disabled' => true, @@ -77,7 +79,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'reviewBy', - 'sonata_type_model', + ModelType::class, array( 'query' => $reviewByQuery, 'label' => 'admin.review.reviewBy.label', @@ -86,7 +88,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'reviewTo', - 'sonata_type_model', + ModelType::class, array( 'query' => $reviewToQuery, 'label' => 'admin.review.reviewTo.label', @@ -95,7 +97,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'booking.listing', - 'sonata_type_model', + ModelType::class, array( 'query' => $listingQuery, 'disabled' => true, @@ -181,7 +183,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) return true; }, - 'field_type' => 'sonata_type_date_picker', + 'field_type' => DatePickerType::class, 'field_options' => array('format' => 'dd/MM/yyyy'), ), null diff --git a/src/Cocorico/ReviewBundle/Extension/StarRatingTwigExtension.php b/src/Cocorico/ReviewBundle/Extension/StarRatingTwigExtension.php index 8bb15f149..6810a87f1 100644 --- a/src/Cocorico/ReviewBundle/Extension/StarRatingTwigExtension.php +++ b/src/Cocorico/ReviewBundle/Extension/StarRatingTwigExtension.php @@ -11,11 +11,13 @@ namespace Cocorico\ReviewBundle\Extension; +use Twig\Extension\GlobalsInterface; + /** * StarRatingTwigExtension will render the star ratings in the twig, * using single line, depending upon the values for rating */ -class StarRatingTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface +class StarRatingTwigExtension extends \Twig_Extension implements GlobalsInterface { /** * @inheritdoc @@ -61,4 +63,4 @@ public function getName() return 'cocorico_star_rating'; } -} \ No newline at end of file +} diff --git a/src/Cocorico/SonataAdminBundle/CocoricoSonataAdminBundle.php b/src/Cocorico/SonataAdminBundle/CocoricoSonataAdminBundle.php deleted file mode 100644 index 83dc36dfb..000000000 --- a/src/Cocorico/SonataAdminBundle/CocoricoSonataAdminBundle.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Cocorico\SonataAdminBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class CocoricoSonataAdminBundle extends Bundle -{ - - public function getParent() - { - return 'SonataAdminBundle'; - } - -} diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form.html.twig b/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form.html.twig deleted file mode 100644 index a78760d1e..000000000 --- a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form.html.twig +++ /dev/null @@ -1,165 +0,0 @@ -{#@formatter:off#} - -{% block form %} - {% import "SonataAdminBundle:CRUD:base_edit_form_macro.html.twig" as form_helper %} - {{ sonata_block_render_event('sonata.admin.edit.form.top', { 'admin': admin, 'object': object }) }} - - {# NEXT_MAJOR: remove default filter #} - {% set url = objectId|default(admin.id(object)) is not null ? 'edit' : 'create' %} - - {% if not admin.hasRoute(url) %} -
- {{ "form_not_available"|trans({}, "SonataAdminBundle") }} -
- {% else %} -
- - {{ include('SonataAdminBundle:Helper:render_form_dismissable_errors.html.twig') }} - - {% block sonata_pre_fieldsets %} -
- {% endblock %} - - {% block sonata_tab_content %} - {% set has_tab = ((admin.formtabs|length == 1 and admin.formtabs|keys[0] != 'default') or admin.formtabs|length > 1 ) %} - -
- {% if has_tab %} - - {% else %} - {{ form_helper.render_groups(admin, form, admin.formtabs['default'].groups, has_tab) }} - {% endif %} -
- {% endblock %} - - {% block sonata_post_fieldsets %} -
- {% endblock %} - - {{ form_rest(form) }} - - {% block formactions %} -
- {% block sonata_form_actions %} - {% if app.request.isxmlhttprequest %} - {# NEXT_MAJOR: remove default filter #} - {% if objectId|default(admin.id(object)) is not null %} - - {% else %} - - {% endif %} - {% else %} - {% if admin.supportsPreviewMode %} - - {% endif %} - {# NEXT_MAJOR: remove default filter #} - {% if objectId|default(admin.id(object)) is not null %} - - - {% if admin.hasRoute('list') and admin.hasAccess('list') %} - - {% endif %} - - {% if admin.hasRoute('delete') and admin.hasAccess('delete', object) %} - {{ 'delete_or'|trans({}, 'SonataAdminBundle') }} - {{ 'link_delete'|trans({}, 'SonataAdminBundle') }} - - {% endif %} - - {#Mangopay dashboard access for bank wire payout and payin refund#} - {% if bundleExist('CocoricoMangoPayBundle') and admin.isGranted('EDIT', object) %} - {% if admin.hasroute('mangopay_withdraw') and object.status == BookingBankWireConstants.STATUS_TO_DO %} - {% include 'CocoricoMangoPayBundle:Admin:list_action_do_bank_wire.html.twig' with {'object': object} only %} - {% elseif bundleExist('CocoricoListingDepositBundle') and admin.hasroute('mangopay_deposit_refund') %} - {% include 'CocoricoMangoPayBundle:Admin:list_action_do_deposit_payin_refund.html.twig' with {'object': object} only %} - {% include 'CocoricoMangoPayBundle:Admin:list_action_do_deposit_bankwire.html.twig' with {'object': object} only %} - {% endif %} - {% endif %} - - {% if admin.isAclEnabled() and admin.hasRoute('acl') and admin.hasAccess('acl', object) %} - {{ 'link_edit_acl'|trans({}, 'SonataAdminBundle') }} - - {% endif %} - {% else %} - {% if admin.hasroute('edit') and admin.hasAccess('edit') %} - - {% endif %} - {% if admin.hasroute('list') and admin.hasAccess('list') %} - - {% endif %} - - {% endif %} - {% endif %} - {% endblock %} -
- {% endblock formactions %} -
- {% endif %} - - {{ sonata_block_render_event('sonata.admin.edit.form.bottom', { 'admin': admin, 'object': object }) }} - -{% endblock %} diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form_macro.html.twig b/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form_macro.html.twig deleted file mode 100644 index 87acea38e..000000000 --- a/src/Cocorico/SonataAdminBundle/Resources/views/CRUD/base_edit_form_macro.html.twig +++ /dev/null @@ -1,34 +0,0 @@ -{#to remove when https://github.com/sonata-project/SonataAdminBundle/pull/4832 will be merged#} -{% macro render_groups(admin, form, groups, has_tab) %} -
- - {% for code in groups if admin.formgroups[code] is defined %} - {% set form_group = admin.formgroups[code] %} - -
-
-
-

- {{ form_group.label|trans({}, form_group.translation_domain ?: admin.translationDomain) }} -

-
-
-
- {% if form_group.description %} -

- {{ form_group.description|trans({}, form_group.translation_domain ?: admin.translationDomain) }} -

- {% endif %} - - {% for field_name in form_group.fields if form[field_name] is defined %} - {{ form_row(form[field_name]) }} - {% else %} - {{ 'message_form_group_empty'|trans({}, 'SonataAdminBundle') }} - {% endfor %} -
-
-
-
- {% endfor %} -
-{% endmacro %} diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/Pager/base_results.html.twig b/src/Cocorico/SonataAdminBundle/Resources/views/Pager/base_results.html.twig deleted file mode 100644 index d4e923de3..000000000 --- a/src/Cocorico/SonataAdminBundle/Resources/views/Pager/base_results.html.twig +++ /dev/null @@ -1,33 +0,0 @@ -{# - -This file is part of the Sonata package. - -(c) Thomas Rabaix - -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. - -#} - -{% block num_pages %} - {{ admin.datagrid.pager.page }} / {{ admin.datagrid.pager.lastpage }} -  -  -{% endblock %} - -{% block num_results %} - {{ 'list_results_count'|transchoice(admin.datagrid.pager.nbresults, {'%count%': admin.datagrid.pager.nbresults}, 'SonataAdminBundle') }} -  -  -{% endblock %} - -{% block max_per_page %} - - -{% endblock %} diff --git a/src/Cocorico/SonataAdminBundle/Resources/views/standard_layout.html.twig b/src/Cocorico/SonataAdminBundle/Resources/views/standard_layout.html.twig deleted file mode 100644 index 2aa802df7..000000000 --- a/src/Cocorico/SonataAdminBundle/Resources/views/standard_layout.html.twig +++ /dev/null @@ -1,407 +0,0 @@ -{# - -This file is part of the Sonata package. - -(c) Thomas Rabaix - -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. - -#} - -{%- set _preview = block('preview') is defined ? block('preview')|trim : null %} -{% set _form = block('form') is defined ? block('form')|trim : null %} -{% set _show = block('show') is defined ? block('show')|trim : null %} -{% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %} -{% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %} -{% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %} -{% set _content = block('content') is defined ? block('content')|trim : null %} -{% set _title = block('title') is defined ? block('title')|trim : null %} -{% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %} -{% set _actions = block('actions') is defined ? block('actions')|trim : null %} -{% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %} -{% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%} - - - - - {% block meta_tags %} - - - - {% endblock %} - - {% block stylesheets %} - {% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %} - - {% endfor %} - - {% endblock %} - - {% block javascripts %} - {% block sonata_javascript_config %} - - {% endblock %} - - {% block sonata_javascript_pool %} - {% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %} - - {% endfor %} - {% endblock %} - - - - {% set locale = app.request.locale %} - {# localize moment #} - {% if locale[:2] != 'en' %} - - {% endif %} - - {# localize select2 #} - {% if sonata_admin.adminPool.getOption('use_select2') %} - {% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %} - - {# omit default EN locale #} - {% if locale[:2] != 'en' %} - - {% endif %} - {% endif %} - {% endblock %} - - - {% block sonata_head_title %} - {{ 'Admin'|trans({}, 'SonataAdminBundle') }} - - {% if _title is not empty %} - {{ _title|striptags|raw }} - {% else %} - {% if action is defined %} - - - {% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %} - {% if not loop.first %} - {% if loop.index != 2 %} - > - {% endif %} - - {%- set translation_domain = menu.extra('translation_domain', 'messages') -%} - {%- set label = menu.label -%} - {%- if translation_domain is not same as(false) -%} - {%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%} - {%- endif -%} - - {{ label }} - {% endif %} - {% endfor %} - {% endif %} - {% endif %} - {% endblock %} - - - - -
- - {% block sonata_header %} -
- {% block sonata_header_noscript_warning %} - - {% endblock %} - {% block logo %} - {% spaceless %} - - {% endspaceless %} - {% endblock %} - {% block sonata_nav %} - - {% endblock sonata_nav %} -
- {% endblock sonata_header %} - - {% block sonata_wrapper %} - {% block sonata_left_side %} - - {% endblock sonata_left_side %} - -
- {% block sonata_page_content %} -
- - {% block sonata_page_content_header %} - {% block sonata_page_content_nav %} - {% if _navbar_title is not empty - or _tab_menu is not empty - or _actions is not empty - or _list_filters_actions is not empty %} - - {% endif %} - {% endblock sonata_page_content_nav %} - {% endblock sonata_page_content_header %} -
- -
- {% block sonata_admin_content %} - - {% block notice %} - {% include 'SonataCoreBundle:FlashMessage:render.html.twig' %} - {% endblock notice %} - - {% if _preview is not empty %} -
{{ _preview|raw }}
- {% endif %} - - {% if _content is not empty %} -
{{ _content|raw }}
- {% endif %} - - {% if _show is not empty %} -
{{ _show|raw }}
- {% endif %} - - {% if _form is not empty %} -
{{ _form|raw }}
- {% endif %} - - {% if _list_filters is not empty %} -
- {{ _list_filters|raw }} -
- {% endif %} - - {% if _list_table is not empty %} -
- {{ _list_table|raw }} -
- {% endif %} - {% endblock sonata_admin_content %} -
- {% endblock sonata_page_content %} -
- {% endblock sonata_wrapper %} -
- -{% if sonata_admin.adminPool.getOption('use_bootlint') %} - {% block bootlint %} - {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #} - - {% endblock %} -{% endif %} - - - diff --git a/src/Cocorico/SonataUserBundle/CocoricoSonataUserBundle.php b/src/Cocorico/SonataUserBundle/CocoricoSonataUserBundle.php deleted file mode 100644 index 413cbe836..000000000 --- a/src/Cocorico/SonataUserBundle/CocoricoSonataUserBundle.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Cocorico\SonataUserBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class CocoricoSonataUserBundle extends Bundle -{ - - public function getParent() - { - return 'SonataUserBundle'; - } - -} diff --git a/src/Cocorico/TimeBundle/Twig/IntlExtension.php b/src/Cocorico/TimeBundle/Twig/IntlExtension.php index bba723a4e..35aeed84b 100644 --- a/src/Cocorico/TimeBundle/Twig/IntlExtension.php +++ b/src/Cocorico/TimeBundle/Twig/IntlExtension.php @@ -2,6 +2,8 @@ namespace Cocorico\TimeBundle\Twig; +use Twig\Extension\GlobalsInterface; + /* * This file is part of the Cocorico package. * @@ -18,7 +20,7 @@ * To remove when ICU will be updated on servers * */ -class IntlExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface +class IntlExtension extends \Twig_Extension implements GlobalsInterface { /** * @inheritdoc @@ -138,4 +140,4 @@ public function getName() { return 'cocorico_intl'; } -} \ No newline at end of file +} diff --git a/src/Cocorico/TimeBundle/Twig/TimeExtension.php b/src/Cocorico/TimeBundle/Twig/TimeExtension.php index 5e15c2c9b..1281f1cfd 100644 --- a/src/Cocorico/TimeBundle/Twig/TimeExtension.php +++ b/src/Cocorico/TimeBundle/Twig/TimeExtension.php @@ -13,8 +13,9 @@ namespace Cocorico\TimeBundle\Twig; use Cocorico\TimeBundle\Utils\PHP; +use Twig\Extension\GlobalsInterface; -class TimeExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface +class TimeExtension extends \Twig_Extension implements GlobalsInterface { /** diff --git a/src/Cocorico/UserBundle/Admin/UserAddressAdmin.php b/src/Cocorico/UserBundle/Admin/UserAddressAdmin.php index 4f92d48c3..8e9094ce1 100644 --- a/src/Cocorico/UserBundle/Admin/UserAddressAdmin.php +++ b/src/Cocorico/UserBundle/Admin/UserAddressAdmin.php @@ -7,6 +7,8 @@ use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\CountryType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; class UserAddressAdmin extends AbstractAdmin { @@ -35,7 +37,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'address', - 'textarea', + TextareaType::class, array( 'label' => 'form.address.address', 'required' => false, @@ -59,7 +61,7 @@ protected function configureFormFields(FormMapper $formMapper) ) ->add( 'country', - 'country', + CountryType::class, array( 'label' => 'form.address.country', 'required' => false, diff --git a/src/Cocorico/UserBundle/Admin/UserAdmin.php b/src/Cocorico/UserBundle/Admin/UserAdmin.php index 9a522a95b..96a9a4dca 100644 --- a/src/Cocorico/UserBundle/Admin/UserAdmin.php +++ b/src/Cocorico/UserBundle/Admin/UserAdmin.php @@ -18,8 +18,17 @@ use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\Form\Type\CollectionType; use Sonata\UserBundle\Admin\Model\UserAdmin as SonataUserAdmin; +use Symfony\Component\Form\Extension\Core\Type\BirthdayType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\CountryType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\LanguageType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TimezoneType; use Symfony\Component\Validator\Constraints\NotBlank; class UserAdmin extends SonataUserAdmin @@ -114,14 +123,14 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'plainPassword', - 'text', + TextType::class, array( 'required' => (!$subject || is_null($subject->getId())), ) ) ->add( 'motherTongue', - 'language', + LanguageType::class, array( 'required' => true, 'disabled' => true @@ -146,7 +155,7 @@ protected function configureFormFields(FormMapper $formMapper): void 'required_locales' => $this->locales, 'fields' => array( 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions, 'required' => true ), @@ -157,7 +166,7 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'birthday', - 'birthday', + BirthdayType::class, array( 'format' => 'dd - MMMM - yyyy', 'years' => range(date('Y') - 18, date('Y') - 80), @@ -180,7 +189,7 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'timeZone', - 'timezone', + TimezoneType::class, array( 'label' => 'form.time_zone', 'required' => true, @@ -192,7 +201,7 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'nationality', - 'country', + CountryType::class, array( 'disabled' => true, ) @@ -245,7 +254,7 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'feeAsAsker',//Percent - 'integer', + IntegerType::class, array( 'attr' => array( 'min' => 0, @@ -256,7 +265,7 @@ protected function configureFormFields(FormMapper $formMapper): void ) ->add( 'feeAsOfferer', //Percent - 'integer', + IntegerType::class, array( 'attr' => array( 'min' => 0, @@ -315,7 +324,7 @@ protected function configureFormFields(FormMapper $formMapper): void ->with('Address') ->add( 'addresses', - 'sonata_type_collection', + CollectionType::class, array( // IMPORTANT!: Disable this field otherwise if child form has all its fields disabled // then the child entities will be removed while saving @@ -324,7 +333,7 @@ protected function configureFormFields(FormMapper $formMapper): void 'delete' => false, 'delete_options' => array( // You may otherwise choose to put the field but hide it - 'type' => 'hidden', + 'type' => HiddenType::class, // In that case, you need to fill in the options as well 'type_options' => array( 'mapped' => false, @@ -409,7 +418,7 @@ protected function configureListFields(ListMapper $listMapper): void 'impersonating', 'string', array( - 'template' => 'CocoricoSonataAdminBundle::impersonating.html.twig', + 'template' => 'admin/impersonating.html.twig', ) ); } @@ -422,7 +431,7 @@ protected function configureListFields(ListMapper $listMapper): void 'actions' => array( 'edit' => array(), 'list_user_listings' => array( - 'template' => 'CocoricoSonataAdminBundle::list_action_list_user_listings.html.twig', + 'template' => 'admin/list_action_list_user_listings.html.twig', ), ), ) @@ -440,8 +449,8 @@ protected function configureDatagridFilters(DatagridMapper $filterMapper): void 'doctrine_orm_callback', array( 'callback' => array($this, 'getFullNameFilter'), - 'field_type' => 'text', - 'operator_type' => 'hidden', + 'field_type' => TextType::class, + 'operator_type' => HiddenType::class, 'operator_options' => array(), ) ) diff --git a/src/Cocorico/UserBundle/Form/Type/ProfileAboutMeFormType.php b/src/Cocorico/UserBundle/Form/Type/ProfileAboutMeFormType.php index 3663de4fd..d439b422d 100644 --- a/src/Cocorico/UserBundle/Form/Type/ProfileAboutMeFormType.php +++ b/src/Cocorico/UserBundle/Form/Type/ProfileAboutMeFormType.php @@ -21,6 +21,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\LanguageType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -79,7 +80,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'required_locales' => $this->locales, 'fields' => array( 'description' => array( - 'field_type' => 'textarea', + 'field_type' => TextareaType::class, 'locale_options' => $descriptions, ), ), diff --git a/src/Cocorico/UserBundle/Form/Type/ProfileContactFormType.php b/src/Cocorico/UserBundle/Form/Type/ProfileContactFormType.php index 2f6361182..d5d5e5a13 100644 --- a/src/Cocorico/UserBundle/Form/Type/ProfileContactFormType.php +++ b/src/Cocorico/UserBundle/Form/Type/ProfileContactFormType.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\EmailType; +use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TimezoneType; @@ -58,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'plainPassword', RepeatedType::class, array( - 'type' => 'password', + 'type' => PasswordType::class, 'options' => array('translation_domain' => 'cocorico_user'), 'first_options' => array( 'label' => 'form.password', diff --git a/src/Cocorico/UserBundle/Form/Type/RegistrationFormType.php b/src/Cocorico/UserBundle/Form/Type/RegistrationFormType.php index 74eb209f1..114a952cb 100644 --- a/src/Cocorico/UserBundle/Form/Type/RegistrationFormType.php +++ b/src/Cocorico/UserBundle/Form/Type/RegistrationFormType.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\CountryType; use Symfony\Component\Form\Extension\Core\Type\EmailType; +use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TimezoneType; @@ -124,7 +125,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'plainPassword', RepeatedType::class, array( - 'type' => 'password', + 'type' => PasswordType::class, 'options' => array('translation_domain' => 'cocorico_user'), 'first_options' => array( 'label' => 'form.password',