Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all 3917 articles
Browse latest View live

How do I disable encoding of special characters in URLS when redirect to HTTPS?

$
0
0

I installed a call tracking and ad management system on the site, but it doesn't work, because after a redirect from HTTP ->HTTPS, some of the special characters in the URL are encoded.

Source URL:

http://site.ru/?utm_content=cid|{campaign_id}&calltouch_tm=yd_c:{campaign_id}_gb

After the redirect:

https://site.ru/?calltouch_tm=yd_c%3A%7Bcampaign_id%7D_gb&utm_content=cid%7C%7Bcampaign_id%7D

After contacting the hosting service, I found out that it is the engine that does the encoding, not the server. This was also indicated by the fact that the resulting URL had the same parameters, but in a different order.

We Use Symfony 4.2. The HTTP ->HTTPS redirect is controlled in the access_control section:

- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }

I really ask for help - I have no ideas how to solve this problem (at all) - for me it is a dead end. Any implementations of the solution.


overWrite security.yml fir disable oauth0 generate error "You are not allowed to define new elements for path "security.firewalls"."

$
0
0

I use symfony 4.3. I want to disable oauth0 authentification for behat test environnement and change security.yml but i have error `You are not allowed to define new elements for path "security.firewalls". Please define all elements for this path in one config file.

default security.yml use this bundle for oauth 0 bundle

security:
  providers:
    app_user_provider:
      id: App\Security\UserProvider

  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    secured_area:
      pattern: ^/api
      stateless: true
      simple_preauth:
        authenticator: jwt_auth.jwt_authenticator
    static_area:
      pattern: ^/static
      stateless: true
      simple_preauth:
        authenticator: custom_auth

  # Easy way to control access for large sections of your site
  # Note: Only the *first* access control that matches will be used
  access_control:
    - { path: ^/api, roles: ROLE_USER }

TEST security.yml:

security:
  providers:
    app_user_provider:
      id: App\Tests\UserProvider

  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    security_area:
      pattern: ^/api
      stateless: true
      guard:
        authenticators:
          - App\Tests\FakeAutehnticator
    static_area:
      pattern: ^/static
      stateless: true
      guard:
        authenticators:
          - App\Tests\FakeAutehnticator

Thanks

JMS\Serializer\Annotation\Type does not exist or not found

$
0
0

I am working on writing tests for some existing code. The code works, but if I write a unit test that hits the same code, I get this error:

Doctrine\Common\Annotations\AnnotationException : [Semantical Error] The annotation "@JMS\Serializer\Annotation\Type" in property App\DTO\ItemDataCostValue::$available does not exist, or could not be auto-loaded.

The annotation for that property exists and I can click through to it:

use JMS\Serializer\Annotation\ as JMS;

class ItemDataCostValue
{
    /**
     * @var boolean
     * @JMS\Type("boolean")
     * @JMS\SerializedName("f")
     * @JMS\SkipWhenEmpty
     */
    protected $available;

It seems like this line is causing the error:

$idc = $this->serializer->deserialize($amenity->getData(), ItemDataCostValue::class, 'json');

The serializer is built in my test like this:

$accommodationAmenities = new AccommodationAmenitiesBusinessCase(
    new AccommodationDataService($accommodationRepositoryMock),
    new FieldsService($fieldRepositoryMock),
    new ValueTypeService($valueRepositoryMock),
    SerializerBuilder::create()->build(),
    new CostObjectsHelpers()
);

The constructor looks like this:

public function __construct(
    AccommodationDataService $dataService,
    FieldsService $fieldsService,
    ValueTypeService $valueTypeService,
    SerializerInterface $serializer,
    CostObjectsHelpers $costHelpers
) {
    $this->dataService = $dataService;
    $this->fieldsService = $fieldsService;
    $this->valueTypeService = $valueTypeService;
    $this->serializer = $serializer;
    $this->costHelpers = $costHelpers;
}

Am I building the serializer wrong? Is there something I should check in my config? What could be the problem?

Symfony 4: How to organize folder structure (namely, your business logic)

$
0
0

In the Symfony Best Practices is advised to not use bundles to organize business logic.

The bundles should be used only when the code in them is meant to be reused as-is in other applications:

But a bundle is meant to be something that can be reused as a stand-alone piece of software. If UserBundle cannot be used "as is" in other Symfony apps, then it shouldn't be its own bundle.

So, as I'm upgrading my app from Symfony 3.3 to Symfony 4, I think this is the right time to reorganize my code.

At the moment I have followed the "bundled-structure":

- src
   - AppBundle
      - Controller
      - Entity
      - Repository
      - Resources
      - ...
   - MyNamespace
      - Bundle
          - BundleTodo
              - Controller
              - Entity
              - Repository
              - Resources
              - ...
          - BundleCatalog
              - Controller
              - Entity
              - Repository
              - Resources
              - ...
          - BundleCart
              - Controller
              - Entity
              - Repository
              - Resources
              - ...
          - ...

Now, with the new directory structure, how should have I to organize my code?

I'd like to organize it this way:

-src
   - Core
      - Controller
      - Entity
      - Repository
      - ..
   - Todos
      - Controller
      - Entity
      - Repository
      - ..
   - Catalog
      - Controller
      - Entity
      - Repository
      - ..
   - Cart
      - Controller
      - Entity
      - Repository
      - ...

But, is this correct? Is there any problem with the expected folder structure of Symfony 4 and Flex?

Or is better something like this:

-src
   - Controller
       - Core
       - Todos
       - Catalog
       - Cart
       - ...
   - Entity
       - Core
       - Todos
       - Catalog
       - Cart
       - ...
   - Repository
       - Core
       - Todos
       - Catalog
       - Cart
       - ...
   - ...

The same applies also to other root folders as described in the project directory structure (about how to override it).

Are there any rules or constraints that I have to take into account deciding my new folder structure?

TRYING TO SOLVE THE PROBLEM

So, trying to solve the problem, I'm going deeper in the documentation and I will write here what I will find.


Symfony 4.4 https everywhere

$
0
0

I want my Symfony 4.4 site to force https site wide. I know this should be simple and I've been googling for a while but I don't seem to be able to find the correct solution. I have paths defined in my security.yaml file for pages behind a login. I tried adding "requires_channel: https" to those and then added one to catch everything else and it killed my site:

- { path: ^/marketing/page1, roles: ROLE_USER, requires_channel: https }
- { path: ^/marketing/page2, roles: ROLE_USER, requires_channel: https }
- { path: ^/marketing/page3, roles: ROLE_USER, requires_channel: https }
# catch all other URLs
- {path: '^/', roles: IS_AUTHENTICATED_ANNONYMOUSLY, requires_channel: https}

With those rules in place I was unable to connect at all in a browser. I do not have a cert for this, but I still expected to get the "this site is not secure do you want to proceed page". Am I thinking about this the wrong way?

Thanks

Using an environment variable (from `.env` file) in custom Twig function in Symfony 4

$
0
0

How can I use an environment variable from the .env file in a custom Twig function (\Twig_SimpleFunction) in Symfony 4?

How to override the "public" directory?

$
0
0

I've renamed my public directory into www so as the documentation says I've added some line in composer.json file:

"extra": {
    "...": "...",
    "public-dir": "www"
}

Then I ran composer update.

But it seems not to work.

I have this error :

An exception has been thrown during the rendering of a template ("Asset manifest file "*******/public/build/manifest.json" does not exist.").

So I've added in config/packages/dev/framework.yaml (I'm on dev):

framework:
    assets:
        json_manifest_path: '%kernel.project_dir%/www/build/manifest.json'

But another error has appeared:

An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "*******/public/build/entrypoints.json" does not exist.").

Then I modify webpack.config.js file like this :

Encore
    // directory where compiled assets will be stored
    .setOutputPath('www/build/')

But the error is still there.

Is there a simple way to rename the public directory?

doctrine querybuilder syntax error expected =, =, !=, got end of string

$
0
0

Having following error:

"[Syntax Error] line 0, col -1: Error: Expected =, <, <=, <>, >, >=, !=, got end of string."

building this query with doctrine querybuiler :

SELECT * 
FROM area 
WHERE ST_Contains(polygon, ST_GeomFromText('POINT(13.405584 52.510621)', 1));

(Sf4 and Doctrine 2.6)

Orm config:

orm:
    dql:
      numeric_functions:
        ST_Contains: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STContains
        ST_GeomFromText: App\Infrastructure\Persistence\Doctrine\STGeomFromText
        POINT: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Point

STGeoFromText Class:

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

class STGeomFromText extends AbstractSpatialDQLFunction
{
    protected $platforms = array('mysql');

    protected $functionName = 'ST_GeomFromText';

    protected $minGeomExpr = 1;

    protected $maxGeomExpr = 2;
}

Construction of the query:

use CrEOF\Spatial\PHP\Types\Geometry\Point;

    $lon = 13.405584;
    $lat = 52.510621;
    $qb = $this->getEntityManager()->createQueryBuilder();
    $qb->select('a.name')
        ->from(Area::class, 'a')
        ->where("ST_Contains(a.polygon, ST_GeomFromText(':point', 1))")
        ->setParameter('point', new Point($lon, $lat), 'point');
    $result = $query->getResult();

same error with:

->where("ST_Contains(a.polygon, ST_GeomFromText(:point, 1))")

notice no presence of symbol ' wrapping the :point parameter.


Rendering problem with the NelmioApiDocBundle

$
0
0

I have a problem with the bundle "NelmioApiDocBundle".

my rendering https://localhost:8000/api/doc

The rendering is raw when it should be much more design.

***routes.yaml***

api_login_check:
        path: /api/login_check

    app.swagger:
        path: /api/doc
        methods: GET
        defaults: { _controller: nelmio_api_doc.controller.swagger }

my bundles

***bundles.php***

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
    Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
    Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
    Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
    Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
    Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
    Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],

];

Did you have this kind of problem?

Thanks

Deployment Symfony 4 with React js application on Heroku

$
0
0

My application is Symfony 4 with React js, then I want to deploy on Heroku. I have one repository for both and there are two folders backend and front-react in this repository. Then I started to deploy from the backend folder, finally i got this error:

See the error by clicking here

Can anyone give any solution or suggestion? Thanks

Why adding custom collection operation removes post method?

$
0
0

If I use only the @ApiResource() annotation result is as follows:

open-api docs screen-shot

When I try to add a custom operation, the post collection operation is missing:

 * @ApiResource(
 *     collectionOperations={"get", "find_between" = {
 *          "method"="GET",
 *          "path"="/bookings/find_between",
 *          "openapi_context" = {
 *                  "parameters" = {
 *                      {
 *                          "name" = "startAt",
 *                          "in" = "query",
 *                          "description" = "Start date & time for bookings retrieval",
 *                          "required" = "true",
 *                          "type" : "string",
 *                          "format" : "date-time"
 *                      },
 *                      {
 *                          "name" = "endAt",
 *                          "in" = "query",
 *                          "description" = "End date & time for bookings retrieval",
 *                          "required" = "true",
 *                          "type" : "string",
 *                          "format" : "date-time"
 *                      }
 *                  }
 *               }
 *          }
 *     },
 * )

open-api documentations screenshot with missing post operation

Jwt Token decode - Symfony 4

$
0
0

I am trying to solve a problem related with token request. It is my newArticle function (to add new article) in the controller:

public function newArticle(Request $request, EntityManagerInterface $entityManager): View
    {
        $data = json_decode($request->getContent(), true);
        $title = $data['title'];
        $content = $data['content'];
        //$published_at = $data['published_at'];
        $authorizationHeader = $request->headers->get('Authorization');
        list(,$token) = explode('', $authorizationHeader);
        $jwtToken = $this->JWTEncoder->decode($token);
        $user_id = $data[$jwtToken];
        $userId = $this->userRepository->findOneBy(['id' => $user_id['id']]);
        $article = new Article();
        $article->setTitle($title);
        $article->setContent($content);
        $article->setPublishedAt(new \DateTime());
        $article->setUser($userId);
        // Todo: 400 response - Invalid input
        // Todo: 404 response - Response not found
        // Incase our Post was a success we need to return a 201 HTTP CREATED response with the created object
        if(in_array('ROLE_USER', $article->getUser()->getRoles(), true)) {
            $entityManager->persist($article);
            $entityManager->flush();
            return View::create("You added an article successfully!", Response::HTTP_OK);
        } else {
            return View::create(["You are not a user! So please register to add an article!"], Response::HTTP_BAD_REQUEST);
        }
    } 

It is working before adding token header authorization and now I got this error:

"error": {
   "code": 500,
  "message": "Internal Server Error",
 "message": "Notice: Undefined offset: 1", 

Can someone give me any suggestions?

Symfony Messenger and RabbitMQ

$
0
0

I am using the Symfony Messenger on Symfony 4.4 with RabbitMQ.

Everything seems to work fine. I have own Serializer, own Handler. I can consume messages etc...

The problem is that after consuming message, I can see message on the queue list. I am expecting that consumed message will be removed from Ready/Total..

Ready: 1Total: 1

If I add next message, the new one will be consumed with success, but "Ready" and "Total" value will increase to 2...

I can not found any return success flag or something like this to remove correct message from the queue.

 // Quit the worker with CONTROL-C.                                                                                     11:45:02 INFO      [messenger] Received message App\Messenger\Message ["message" => App\Messenger\Message^ { …},"class" => "App\Messenger\Message"]test11:45:02 INFO      [messenger] Message App\Messenger\Message handled by App\Messenger\Consumer\MyOwnHandler::__invoke ["message" => App\Messenger\Message^ { …},"class" => "App\Messenger\Message","handler" => "App\Messenger\Consumer\MyOwnHandler::__invoke"]11:45:02 INFO      [messenger] App\Messenger\Message was handled successfully (acknowledging to transport). ["message" => App\Messenger\Message^ { …},"class" => "App\Messenger\Message"]

And simple handler __invoke method

public function __invoke(Message $message){    $message = unserialize($message->getBody());    print_r($message);}

Translation of flash messages with parameters in Symfony 4

$
0
0

I have a problem with flash messages in Symfony 4 and translation. Translation of simple flash messages is working fine:

$this->addFlash('success', 'flashmessage.project_deleted');

But now I want to add some parameters to the flash messages and I have no idea how to handle it. I tried a lot, but nothing is working. I want to show in the flash messages the title of projects after f.e. removing. For example:

$this->addFlash('success', sprintf('flashmessage.project_deleted: %s', $project->getTitle()));

But the translation is not recognized, because the parameter is replaces before translation happens (I think so). And it should also be possible to have parameters in the middle of a string and not only at the end or at the beginning and ideally more than one parameter.

I'm using this in my Controller which extends AbstractController.

Does anybody has a solution for this?

Does number of processes affect sequential execution for Messenger?

$
0
0

We have a simple use case: we need to consume messages in the queue sequentially (message #1 finishes execution before message #2 starts execution).

Suggested supervisor configuration in Symfony docs is:

;/etc/supervisor/conf.d/messenger-worker.conf
[program:messenger-consume]
command=php /path/to/your/app/bin/console messenger:consume async --time-limit=3600
user=ubuntu
numprocs=2
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d

Does numprocs=2 mean that 2 workers will consume the messages "simultaneously", i.e. worker 2 will start execution of message #2 before message #1 is finished?

If yes, is there any way to keep 2 workers (if we need simultaneous execution for some other message type) and still have the messages of this specific type be executed sequentially?


Message handler shows as registered on debug:messenger, but handler not found when consumming messages

$
0
0

When I execute bin/console debug:messenger I get:

Messenger
=========

async.command.bus
-----------------

 The following messages can be dispatched:

 --------------------------------------------------------------------------------
  App\Application\Command\SendEmailNotifications
      handled by App\Infrastructure\Handler\SendEmailNotificationsHandler
  App\Application\Command\DummyMessage
      handled by App\Infrastructure\Handler\Dummy\DummyMessageHandler
  App\Application\Command\BoostLead\InsertLead
      handled by App\Infrastructure\Handler\InsertLeadHandler
 --------------------------------------------------------------------------------

Clearly showing that there is handler registered for App\Application\Command\DummyMessage.

But after I dispatch the a message and I try to consume it with messenger:consume I get:

No handler for message "App\Application\Command\DummyMessage

full error message, emphasis mine:

16:38:12 ERROR [messenger] Error thrown while handling message App\Application\Command\DummyMessage. Sending for retry #1 using 1000 ms delay. Error: "No handler for message "App\Application\Command\DummyMessage"." ["message" => App\Application\Command\DummyMessage^ { …},"class" =>"App\Application\Command\DummyMessage","retryCount" => 1,"delay" => 1000,"error" =>"No handler for message "App\Application\Command\DummyMessage".","exception" => Symfony\Component\Messenger\Exception\NoHandlerForMessageException^ { …}]

If I execute debug:container DummyMessageHandler I get:

Information for Service "App\Infrastructure\Handler\Dummy\DummyMessageHandler"
==============================================================================

 ---------------- ------------------------------------------------------
  Option           Value
 ---------------- ------------------------------------------------------
  Service ID       App\Infrastructure\Handler\Dummy\DummyMessageHandler
  Class            App\Infrastructure\Handler\Dummy\DummyMessageHandler
  Tags             messenger.message_handler (bus: async.command.bus)
  Public           no
  Synthetic        no
  Lazy             no
  Shared           yes
  Abstract         no
  Autowired        yes
  Autoconfigured   yes
 ---------------- ------------------------------------------------------

The handler it's fairly simple, with only a __invoke(DummyMessage $message) method.

How can it be the handler is found when executing the debugger, but not when actually consuming the messages? Where can I look what's going on?

Symfony 4 : good practice controller render

$
0
0

I just begun to use Symfony, and I came from CodeIgniter. In this framwork you pass parameters to the view with an array called $data. So if you want to pass the same variables in each views of a controller, you simply instanciate the $data array in the consctrutor and add what ever you want.

For symfony it's a bit different, and I have imagine something to do the same. It's work great, but I ask myself if they doesn't exist a better way to do it. Or do I have to rethink the way I design my code to avoid this sort of things, for example add another twig layout for specify title in each route of the controller, but what if it's a parameter than I have to use for each render ?

First I define this function :

    public function default_data(array $parameters):array{
    $default_parameters = array(
        'controller_name' => 'AdminController',
        'navbar_title' => 'Suivis Satisfaction Utilisateurs',
    );

    return array_merge($default_parameters, $parameters);
}

Then I call render this way :

return $this->render(my_view.html.twig, $this->default_data(array('my_new_parameter' => 'new_data')));

Thanks for reading.

Symfony add logic to logout route

$
0
0

In a Symfony 5.0 Application I want to add custom logic for cleanup reasons when the user loggs out. What I have currenty is what is described in the docs:

https://symfony.com/doc/current/security.html#logging-out

As the logout() function in the SecurityController is intercepted by Symfony it won't work to add logic there.

So - where CAN I add logic which is allways executed when a user loggs out? Couldn't find anything in the docs so far...

Vanilla JavaScript not working in Symfony4

$
0
0

I installed webpack encore on a Symfony 4 project but my vanilla javascript is not working. I can use jQuery.Here is part of the code structure:

webpack.config.js

var Encore = require('@symfony/webpack-encore');
// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
    Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
    // directory where compiled assets will be stored

    .setOutputPath('public/build/')

    // public path used by the web server to access the output path

    .setPublicPath('/build')

    // only needed for CDN's or sub-directory deploy

    //.setManifestKeyPrefix('build/')



    /*

     * ENTRY CONFIG

     *

     * Add 1 entry for each "page" of your app

     * (including one that's included on every page - e.g. "app")

     *

     * Each entry will result in one JavaScript file (e.g. app.js)

     * and one CSS file (e.g. app.css) if your JavaScript imports CSS.

     */

    .addEntry('app', './assets/js/app.js')

    .addEntry('login', './assets/js/login.js')

    .addEntry('non_financial_details', './assets/js/non_financial_details.js')

    //.addEntry('page2', './assets/js/page2.js')

    .copyFiles({

        from: './assets/img',

        to: 'img/[path][name].[ext]',

        pattern: /\.(png|jpg|jpeg|gif)$/

    })

    // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.

    .splitEntryChunks()



    // will require an extra script tag for runtime.js

    // but, you probably want this, unless you're building a single-page app

    .enableSingleRuntimeChunk()



    /*

     * FEATURE CONFIG

     *

     * Enable & configure other features below. For a full

     * list of features, see:

     * https://symfony.com/doc/current/frontend.html#adding-more-features

     */

    .cleanupOutputBeforeBuild()

    .enableBuildNotifications()

    // allow legacy applications to use $/jQuery as a global variable

     .autoProvidejQuery()

    .enableSourceMaps(!Encore.isProduction())

    // enables hashed filenames (e.g. app.abc123.css)

    .enableVersioning(Encore.isProduction())



    // enables @babel/preset-env polyfills

    .configureBabelPresetEnv((config) => {

        config.useBuiltIns = 'usage';

        config.corejs = 3;

    })



    // enables Sass/SCSS support

    //.enableSassLoader()



    // uncomment if you use TypeScript

    //.enableTypeScriptLoader()



    // uncomment to get integrity="..." attributes on your script & link tags

    // requires WebpackEncoreBundle 1.4 or higher

    //.enableIntegrityHashes(Encore.isProduction())



    // uncomment if you're having problems with a jQuery plugin

    //.autoProvidejQuery()



    // uncomment if you use API Platform Admin (composer req api-admin)

    //.enableReactPreset()

    //.addEntry('admin', './assets/js/admin.js')

;

module.exports = Encore.getWebpackConfig();

app.js

require('../css/app.css');

require('jquery/dist/jquery.js');

//require('popper.js/dist/umd/popper.js');

require('bootstrap/dist/js/bootstrap.js');

require('bootstrap/dist/css/bootstrap.css');

non_financial_details.js

require('../css/permudb.css');

$(document).ready(function () {

$('form[name="non_financial_details"]').on("change",".target-actuals",function(e) {

var target_output_name=$(this).attr('name');
var result = target_output_name.split('_');
var indicator=result[0];
var tr= $(this).closest('tr');
var cum_semitot=0;
if (target_output_name.indexOf("qtr1") >= 0){
cum_semitot=parseInt($(this).val())+parseInt($("input[name='"+indicator+"_qtr2']").val());
$('td:nth-child(5)',tr).text(cum_semitot);
}else if (target_output_name.indexOf("qtr2") >= 0){
cum_semitot=parseInt($(this).val())+parseInt($("input[name='"+indicator+"_qtr1']").val());
$('td:nth-child(5)',tr).text(cum_semitot);
}
var cum_annualtot=parseInt($("input[name='"+indicator+"_qtr1']").val())+parseInt($("input[name='"+indicator+"_qtr2']").val())+parseInt($("input[name='"+indicator+"_qtr3").val())+parseInt($("input[name='"+indicator+"_qtr4']").val());
$('td:nth-child(8)',tr).text(cum_annualtot);

});



})

The three vanilla javascript functions: split(),indexof(), parseint() inside non_financial_details change event are not working.The presence of those functions make whole javascript including jquery fail. If I remove the whole code inside non_financial_details change event jQuery works. I am pretty sure that vanilla javascript functions are the culprit because even if I replace the code with simple code such as:

var str = "test_120";
var res = str.split("_");

It is still failing. Is there any explanation for this ?

where to store global veriables in Symfony 5? [closed]

$
0
0

where to store global variables in Symfony5? I want to store application specific parameters like. site name, admin email etc. I would like to know the best practice to store these. How to access these variables in controller and in twig. Thanks.

Viewing all 3917 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>