Xcart - How to delete rows from table in Xcart

124 Views Asked by At

I am using X-Cart for my project, I need help in how to perform delete query in X-cart. Currently, I am using the below code but it showing me an error.

Can anyone help me in this??

$products = \XLite\Core\Database::getRepo('\XLite\Module\XCExample\FormDemo\Model\NewScroll')->createQueryBuilder('p');
        $products->delete('xc_news_scroll p');
        $products->getResult();
1

There are 1 best solutions below

4
Tony On

If you want to remove some object, then you should go:

\XLite\Core\Database::getRepo('\XLite\Module\XCExample\FormDemo\Model\NewScroll')->delete($newScrollObjectToRemove);

If you want to remove some column from the database schema, you need to edit the model class of the entities stored in the table and remove this property there. After that, you will need to re-deploy the store.

Best,

Tony