Prado\Data\ActiveRecord\TActiveRecord::save PHP Метод

save() публичный Метод

Saves the current record to the database, insert or update is automatically determined.
public save ( ) : boolean
Результат boolean true if record was saved successfully, false otherwise.
    public function save()
    {
        $gateway = $this->getRecordGateway();
        $param = new TActiveRecordChangeEventParameter();
        if ($this->_recordState === self::STATE_NEW) {
            $this->onInsert($param);
            if ($param->getIsValid() && $gateway->insert($this)) {
                $this->_recordState = self::STATE_LOADED;
                return true;
            }
        } else {
            if ($this->_recordState === self::STATE_LOADED) {
                $this->onUpdate($param);
                if ($param->getIsValid() && $gateway->update($this)) {
                    return true;
                }
            } else {
                throw new TActiveRecordException('ar_save_invalid', get_class($this));
            }
        }
        return false;
    }