<?php
 namespace App\Utils\Db\ManageRecords; class Delete extends GeneralAbstract { protected $populatingTableName; public function __construct($populatingTableName) { if (!$populatingTableName) { throw new \Exception('You must set the populating table name.'); } $this->populatingTableName = $populatingTableName; } public function getFullSQL() :?array { if (!$this->filters) { throw new \Exception('You did not define any filters when using `DELETE`.'); } $bindVars = []; $sql = "DELETE FROM `{$this->populatingTableName}`"; $whereSQL = $this->getSQL_where(); if ($whereSQL['sql']) { $sql .= " WHERE ".$whereSQL['sql']; $bindVars = $whereSQL['bindVars']; } return [ 'sql'=>$sql, 'bindVars'=>$bindVars ]; } } 