/** * Constructor * @since Version 3.5 * @param int $id */ public function __construct($id = null) { parent::__construct(); if ($id == null) { return $this; } $this->id = $id; if ($this->id = filter_var($this->id, FILTER_VALIDATE_INT)) { $this->fetch(); } }
/** * Constructor * @since Version 3.5 * @param int $id */ public function __construct($id = false) { parent::__construct(); if ($id) { if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; } elseif (is_string($id)) { $query = "SELECT id FROM nuke_faqAnswer WHERE url_slug = ?"; $this->id = $this->db_readonly->fetchOne($query, $id); } $this->fetch(); } }
public function test_deleteCategory() { $Help = new Help(); $Category = $this->testAddCategory(); $this->assertTrue($Help->deleteCategory($Category->id)); $this->setExpectedException("Exception", "Cannot delete category - no ID given"); $Help->deleteCategory(); }