Esempio n. 1
0
 /**
  * Trash all beans of a given type. Wipes an entire type of bean.
  *
  * @param string $type type of bean you wish to delete all instances of
  *
  * @return boolean
  *
  * @throws RedBean_Exception_SQL
  */
 public function wipe($type)
 {
     try {
         $this->writer->wipe($type);
         return TRUE;
     } catch (RedBean_Exception_SQL $exception) {
         if (!$this->writer->sqlStateIn($exception->getSQLState(), array(RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE))) {
             throw $exception;
         }
         return FALSE;
     }
 }
Esempio n. 2
0
	/**
	 * Trash all beans of a given type.
	 *
	 * @param string $type type
	 *
	 * @return boolean $yesNo whether we actually did some work or not..
	 */
	public function wipe($type) {
		try {
			$this->writer->wipe($type);
			return true;
		}catch(RedBean_Exception_SQL $e) {
			if (!$this->writer->sqlStateIn($e->getSQLState(),
			array(RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
			)) throw $e;
		}
		return false;
	}