1

=============== MyManualController.php ===============

$mCC = $this->getDoctrine()->getManager(); 
$qCC = "CONFLICT QUERY HERE...";
$xCC = $mCC->getConnection()->prepare($qCC); 
$xCC->execute(); 
$sCC =
$xCC->fetchAll();

=============== Current Output ===============

[{
     "emp_name": "Sample"
     "adjustment": "0",
     "by_days": "10",
     "mos": "323",
     "by_mos": "0",
     "yrs": "27",
     "by_yrs": "0" 
}]

=============== Expected Output ===============

[{
    "emp_name": "Sample"
    "adjustment": 0,
    "by_days": 10,
    "mos": 323,
    "by_mos": 0,
    "yrs": 27,
    "by_yrs": 0 
}]
2
  • Not sure what that has to do with controllers or modeling but I am assuming the issue is that you are getting strings for your integer values? This sort of thing happens when you use the default \PDO::ATTR_EMULATE_PREPARES value of true. Setting it to false will give you the expected integers. How you are configuring your connection is a bit of a mystery. Symfony sets it up correctly. But you seem to be using your own configuration. Commented Oct 20, 2022 at 12:18
  • Thank you so much! At first sight, looks my "00001" value will convert to 1 but after I tried this, it follows to my database field type. It saved a lot of time to create api conflict read query. Commented Oct 24, 2022 at 1:29

1 Answer 1

1

follow link https://symfony.com/doc/current/doctrine.html

you can create entity, or, follow doc for create manually class with example

Sign up to request clarification or add additional context in comments.

2 Comments

Ok, thank you! I'll try. Means required to create entity. No direct modelling to the controller.
Exactly, this is the Model View Controller pattern (MVC). Your model should be designed outside controller :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.