1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @copyright Vertex. All rights reserved. https://www.vertexinc.com/
* @author Mediotype https://www.mediotype.com/
*/
namespace Vertex\Tax\Model\ResourceModel;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
/**
* Performs Datastore-related actions for the LogEntry repository
*/
class LogEntry extends AbstractDb
{
/**
* @inheritdoc
*
* MEQP2 Warning: Protected method. Needed to override AbstractDb's _construct
*/
protected function _construct()
{
$this->_init('vertex_taxrequest', 'request_id');
}
/**
* Delete records in a table based on the collection passed in
*
* @param LogEntry\Collection $collection
* @throws CouldNotDeleteException
*/
public function deleteByCollection($collection)
{
$query = $collection->getSelect()->deleteFromSelect('main_table');
try {
$this->getConnection()->query($query);
} catch (\Exception $e) {
throw new CouldNotDeleteException(__('%1 could not delete log entries', __CLASS__), $e);
}
}
}