Home » PHP » Pimcore » Raw sql query using Pimcore\Db class in PIMCORE 5

Raw sql query using Pimcore\Db class in PIMCORE 5

Pimcore

Please use the below steps to fetch the data from Pimcore Database.

1. To connect the Pimcore DB
2. This query fetch the id only.
3. This query fetch all records.
4. This query fetch the latest single record.
5. This will load the data. If you will not use this and will print the $sql it will return the structure of all possible query.

 1. $db = \Pimcore\Db::get();
 2. $sql = $db->fetchCol("SELECT * FROM `object_1`");
 3. $sql = $db->fetchAll("SELECT * FROM `object_1`");
 4. $sql = $db->fetchRow("SELECT * FROM `object_1`");
 5. $sql ->load();

Check Also

Pimcore

How can disable the Pimcore Bundle?

To disable the pimcore bundle run the below command on the ubuntu terminal in the …

Leave a Reply

Your email address will not be published. Required fields are marked *