phpcs possible raw SQL statementHow to truncate magento table using collection?Using Multiple Database ResourcesPossible raw SQL statement detectedMagento sales_order_grid + join concatenated results from other queryHow to convert sql statement into magentoquery in magento 2Magento 2 : How to get top 10 repeated values in a column using CRUD instead of sql?Modifying a query (get products using SQL only)error on running raw sql query in upgradeData.php magento 2Fetch products from several SKUs where their price don't match from a listphpcs Use ::class notation instead warning on attribute source field
How many possible starting positions are uniquely solvable for a nonogram puzzle?
Is it unethical to quit my job during company crisis?
How can Caller ID be faked?
Is there a risk to write an invitation letter for a stranger to obtain a Czech (Schengen) visa?
How can this shape perfectly cover a cube?
Was the Lonely Mountain, where Smaug lived, a volcano?
How to avoid offending original culture when making conculture inspired from original
Difference between "drift" and "wander"
What is the color associated with lukewarm?
For Saintsbury, which English novelists constituted the "great quartet of the mid-eighteenth century"?
Leveraging cash for buying car
Print the phrase "And she said, 'But that's his.'" using only the alphabet
How to address players struggling with simple controls?
Why is gun control associated with the socially liberal Democratic party?
Bullying by school - Submitted PhD thesis but not allowed to proceed to viva until change to new supervisor
Do items with curse of vanishing disappear from shulker boxes?
Fastest path on a snakes and ladders board
Arcane Tradition and Cost Efficiency: Learn spells on level-up, or learn them from scrolls/spellbooks?
Is it possible to install Firefox on Ubuntu with no desktop enviroment?
How to make a villain when your PCs are villains?
How to know whether to write accidentals as sharps or flats?
Threading data on TimeSeries
Can I give my friend the sour dough "throw away" as a starter to their sourdough starter?
How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?
phpcs possible raw SQL statement
How to truncate magento table using collection?Using Multiple Database ResourcesPossible raw SQL statement detectedMagento sales_order_grid + join concatenated results from other queryHow to convert sql statement into magentoquery in magento 2Magento 2 : How to get top 10 repeated values in a column using CRUD instead of sql?Modifying a query (get products using SQL only)error on running raw sql query in upgradeData.php magento 2Fetch products from several SKUs where their price don't match from a listphpcs Use ::class notation instead warning on attribute source field
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In my code I've got a
$connection->query("TRUNCATE TABLE $tableName");
Works great. However using the official https://github.com/magento/magento-coding-standard ruleset it showed the following warning.
Possible raw SQL satement.
Which I understand because it is.
My question is: is it possible to truncate a table within Magento without using raw SQL?
magento2 php database
add a comment |
In my code I've got a
$connection->query("TRUNCATE TABLE $tableName");
Works great. However using the official https://github.com/magento/magento-coding-standard ruleset it showed the following warning.
Possible raw SQL satement.
Which I understand because it is.
My question is: is it possible to truncate a table within Magento without using raw SQL?
magento2 php database
add a comment |
In my code I've got a
$connection->query("TRUNCATE TABLE $tableName");
Works great. However using the official https://github.com/magento/magento-coding-standard ruleset it showed the following warning.
Possible raw SQL satement.
Which I understand because it is.
My question is: is it possible to truncate a table within Magento without using raw SQL?
magento2 php database
In my code I've got a
$connection->query("TRUNCATE TABLE $tableName");
Works great. However using the official https://github.com/magento/magento-coding-standard ruleset it showed the following warning.
Possible raw SQL satement.
Which I understand because it is.
My question is: is it possible to truncate a table within Magento without using raw SQL?
magento2 php database
magento2 php database
asked Jun 8 at 0:12
Dominic XigenDominic Xigen
1,494311
1,494311
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can simply use $connection->truncateTable($table)
MagentoFrameworkDBAdapterPdoMysql
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from classMagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277677%2fphpcs-possible-raw-sql-statement%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can simply use $connection->truncateTable($table)
MagentoFrameworkDBAdapterPdoMysql
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from classMagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
add a comment |
You can simply use $connection->truncateTable($table)
MagentoFrameworkDBAdapterPdoMysql
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from classMagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
add a comment |
You can simply use $connection->truncateTable($table)
MagentoFrameworkDBAdapterPdoMysql
You can simply use $connection->truncateTable($table)
MagentoFrameworkDBAdapterPdoMysql
edited Jun 8 at 9:27
answered Jun 8 at 2:35
Khoa TruongDinhKhoa TruongDinh
22.8k64591
22.8k64591
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from classMagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
add a comment |
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from classMagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
You know where I can find this method?
– Dominic Xigen
Jun 8 at 7:18
It's from class
MagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
It's from class
MagentoFrameworkDBAdapterPdoMysql
– Khoa TruongDinh
Jun 8 at 9:28
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277677%2fphpcs-possible-raw-sql-statement%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown