Alfaraz Shaikh
Alfaraz Shaikh

Reputation: 199

Xcart - How to delete rows from table in Xcart

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();

Upvotes: 0

Views: 118

Answers (1)

Tony
Tony

Reputation: 149

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

Upvotes: 0

Related Questions