Prado\Data\ActiveRecord\TActiveRecord::delete PHP 메소드

delete() 공개 메소드

Deletes the current record from the database. Once deleted, this object can not be saved again in the same instance.
public delete ( ) : boolean
리턴 boolean true if the record was deleted successfully, false otherwise.
    public function delete()
    {
        if ($this->_recordState === self::STATE_LOADED) {
            $gateway = $this->getRecordGateway();
            $param = new TActiveRecordChangeEventParameter();
            $this->onDelete($param);
            if ($param->getIsValid() && $gateway->delete($this)) {
                $this->_recordState = self::STATE_DELETED;
                return true;
            }
        } else {
            throw new TActiveRecordException('ar_delete_invalid', get_class($this));
        }
        return false;
    }