1
votes

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];
        }
    }
}
1

1 Answers

0
votes

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);
        }
    }
}