public function save() {
		if($this->persistent) {
			$action = $this->{'update'};
			$action->directCall($this->attrsForApi($action));
			
		} else {
			// insert
			$action = $this->{'create'};
			$ret = new Response($action, $action->directCall($this->attrsForApi($action)));
			
			if($ret->isOk()) {
				$this->attrs = array_merge($this->attrs, (array) $ret->getResponse());
				
			} else {
				throw new Exception\ActionFailed($ret, "Action '".$action->name()."' failed: ".$ret->message());
			}
			
			$this->persistent = true;
		}
	}
public function save() {
		if($this->persistent) {
			$action = $this->{'update'};
			$action->directCall($this->attrsForApi($action));
			
		} else {
			// insert
			$action = $this->{'create'};
			$ret = new Response($action, $action->directCall($this->attrsForApi($action)));
			
			if($ret->isOk()) {
				$this->attrs = array_merge($this->attrs, (array) $ret->getResponse());
				
			} else {
				throw new Exception\ActionFailed($ret, "Action '".$action->name()."' failed: ".$ret->message());
			}
			
			$this->persistent = true;
		}
	}
public function save ( ) { if ( $ this -> persistent ) { $ action = $ this -> { 'update' } ; $ action -> directCall ( $ this -> attrsForApi ( $ action ) ) ; } else { // insert $ action = $ this -> { 'create' } ; $ ret = new Response ( $ action , $ action -> directCall ( $ this -> attrsForApi ( $ action ) ) ) ; if ( $ ret -> isOk ( ) ) { $ this -> attrs = array_merge ( $ this -> attrs , ( array ) $ ret -> getResponse ( ) ) ; } else { throw new Exception \ ActionFailed ( $ ret , "Action '" . $ action -> name ( ) . "' failed: " . $ ret -> message ( ) ) ; } $ this -> persistent = true ; } }
Create the resource object if it isn't persistent, update it if it is.
Create the resource object if it isn t persistent update it if it is .