People,
To resolve this question, I have made the following:
class TesteAdmin extends AbstractAdmin
{
public function getTemplate($name)
{
if ($name === 'edit') {
return 'TesteBundle:Anotacao:base_edit.html.twig';
} else {
return parent :: getTemplate($name);
}
}
Thanks,
Aline.
Em quinta-feira, 27 de setembro de 2018 14:27:29 UTC-3, Aline Macena
escreveu:
>
> Hi,
>
> I would like to ask for help me about a project use Symfony 3.1 and I'm
> updating to 3.4.
> O composer.json was like this:
> "require" : {
> "php" : ">=5.5.9",
> "symfony/symfony" : "3.1.*",
> "doctrine/orm" : "^2.5",
> "doctrine/doctrine-bundle" : "^1.6",
> "doctrine/doctrine-cache-bundle" : "^1.2",
> "symfony/swiftmailer-bundle" : "^2.3",
> "symfony/monolog-bundle" : "^2.8",
> "symfony/polyfill-apcu" : "^1.0",
> "sensio/distribution-bundle" : "^5.0",
> "sensio/framework-extra-bundle" : "^3.0.2",
> "incenteev/composer-parameter-handler" : "^2.0",
> "symfony/form" : "^3.1.0",
> "twbs/bootstrap" : "^3.3",
> "symfony/assetic-bundle" : "^2.8",
> "components/jquery" : "^3.0",
> "sonata-project/admin-bundle" : "^3.3",
> "sonata-project/doctrine-orm-admin-bundle" : "^3.0",
> "jms/serializer-bundle" : "^1.1",
> "friendsofsymfony/jsrouting-bundle" : "2.0.0-alpha1",
> "friendsofsymfony/user-bundle" :
> "dev-master#c62c727dc7a387edc16df32d2ee4181e620ad35f",
> "setasign/fpdf" : "1.8.1",
> "knplabs/knp-snappy-bundle" : "^1.4",
> "knplabs/knp-paginator-bundle" : "2.5.3",
> "endroid/qrcode" : "^1.9"
> }
>
> And I changed to:
> "require" : {
> "php" : ">=7.2",
> "symfony/symfony" : "3.4.*",
> "doctrine/orm" : "^2.6",
> "doctrine/doctrine-bundle" : "^1.9",
> "doctrine/doctrine-cache-bundle" : "^1.3",
> "symfony/swiftmailer-bundle" : "^3.2",
> "symfony/monolog-bundle" : "^3.3",
> "symfony/polyfill-apcu" : "^1.9",
> "sensio/distribution-bundle" : "^5.0",
> "sensio/framework-extra-bundle" : "^5.0.2",
> "incenteev/composer-parameter-handler" : "^2.1",
> "symfony/form" : "^3.4",
> "twbs/bootstrap" : "^4.1",
> "symfony/assetic-bundle" : "^2.8",
> "components/jquery" : "^3.3",
> "sonata-project/admin-bundle" : "^3.39",
> "sonata-project/doctrine-orm-admin-bundle" : "^3.6",
> "jms/serializer-bundle" : "^2.4",
> "friendsofsymfony/jsrouting-bundle" : "2.2.0",
> "friendsofsymfony/user-bundle" : "^2.1",
> "setasign/fpdf" : "1.8.1",
> "knplabs/knp-snappy-bundle" : "^1.5",
> "knplabs/knp-paginator-bundle" : "^2.8",
> "endroid/qrcode" : "^1.9"
> }
>
> But a failure occurs how long to access a sonata form that uses ajax:
> *Unable to find template "" (looked into:
> /var/www/html/dhui/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views,
> /var/www/html/dhui/app/Resources/views,
> /var/www/html/dhui/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).*
>
> The fault occurs at the point where there is this function:
>
> class TesteAdmin extends AbstractAdmin
> {
> /**
> * Altera o template padrão do admin para o template com AJAX
> */
> public function getTemplate($name)
> { dump($this->templates); exit;
> if (isset($this->templates[$name])) {
> if ($name === 'edit') {
> return 'TesteBundle:Anotacao:base_edit.html.twig';
> } else {
> return $this->templates[$name];
> }
> }
> }
>
>
>
>
>
>
>
>
>
>
> I overwritten twig base_edit.html.twig to use ajax in some fields.
> Once I access the getTemplate function if I use the dump command ($ this->
> templates); returns empty when it should return:
>
> array:39 [▼
> "layout" => "sonata/sonata_admin_layout.html.twig"
> "user_block" => "sonata/user_block.html.twig"
> "dashboard" => "sonata/dashboard.html.twig"
> "add_block" => "SonataAdminBundle:Core:add_block.html.twig"
> "ajax" => "SonataAdminBundle::ajax_layout.html.twig"
> "search" => "SonataAdminBundle:Core:search.html.twig"
> "list" => "SonataAdminBundle:CRUD:list.html.twig"
> "filter" => "SonataAdminBundle:Form:filter_admin_fields.html.twig"
> "show" => "SonataAdminBundle:CRUD:show.html.twig"
> "show_compare" => "SonataAdminBundle:CRUD:show_compare.html.twig"
> "edit" => "SonataAdminBundle:CRUD:edit.html.twig"
> "preview" => "SonataAdminBundle:CRUD:preview.html.twig"
> "history" => "SonataAdminBundle:CRUD:history.html.twig"
> "acl" => "SonataAdminBundle:CRUD:acl.html.twig"
> "history_revision_timestamp" =>
> "SonataAdminBundle:CRUD:history_revision_timestamp.html.twig"
> "action" => "SonataAdminBundle:CRUD:action.html.twig"
> "select" => "SonataAdminBundle:CRUD:list__select.html.twig"
> "list_block" => "SonataAdminBundle:Block:block_admin_list.html.twig"
> "search_result_block" =>
> "SonataAdminBundle:Block:block_search_result.html.twig"
> "short_object_description" =>
> "SonataAdminBundle:Helper:short-object-description.html.twig"
> "delete" => "SonataAdminBundle:CRUD:delete.html.twig"
> "batch" => "SonataAdminBundle:CRUD:list__batch.html.twig"
> "batch_confirmation" =>
> "SonataAdminBundle:CRUD:batch_confirmation.html.twig"
> "inner_list_row" => "SonataAdminBundle:CRUD:list_inner_row.html.twig"
> "outer_list_rows_mosaic" =>
> "SonataAdminBundle:CRUD:list_outer_rows_mosaic.html.twig"
> "outer_list_rows_list" =>
> "SonataAdminBundle:CRUD:list_outer_rows_list.html.twig"
> "outer_list_rows_tree" =>
> "SonataAdminBundle:CRUD:list_outer_rows_tree.html.twig"
> "base_list_field" => "SonataAdminBundle:CRUD:base_list_field.html.twig"
> "pager_links" => "SonataAdminBundle:Pager:links.html.twig"
> "pager_results" => "SonataAdminBundle:Pager:results.html.twig"
> "tab_menu_template" => "SonataAdminBundle:Core:tab_menu_template.html.twig"
> "knp_menu_template" => "SonataAdminBundle:Menu:sonata_menu.html.twig"
> "action_create" =>
> "SonataAdminBundle:CRUD:dashboard__action_create.html.twig"
> "button_acl" => "SonataAdminBundle:Button:acl_button.html.twig"
> "button_create" => "SonataAdminBundle:Button:create_button.html.twig"
> "button_edit" => "SonataAdminBundle:Button:edit_button.html.twig"
> "button_history" => "SonataAdminBundle:Button:history_button.html.twig"
> "button_list" => "SonataAdminBundle:Button:list_button.html.twig"
> "button_show" => "SonataAdminBundle:Button:show_button.html.twig"]
>
> What could I have done wrong, please?
>
> Thanks,
> Aline.
>
>
--
You received this message because you are subscribed to the Google Groups
"sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.