/** * Deleting entity with id = {id} * * @param $entityName - short entity class name (without full path) * @param int $id * * @return boolean */ public function delete($entityName, $id) { $tableName = $this->dbHelper->getUnderscoreName($entityName); $query = "DELETE FROM `{$tableName}` WHERE id = ?"; try { $stmt = $this->pdo->prepare($query); $stmt->bindParam(1, $id, \PDO::PARAM_INT); $stmt->execute(); } catch (\Exception $e) { die($e->getMessage()); } return true; }
public function testGetUnderscoreName() { $this->assertEquals('some_camel_case_string', $this->helper->getUnderscoreName('SomeCamelCaseString')); }