_state = self::STATE_UNKNOWN; $update_id = $this->getId(); $result = $this->getAdapter()->Save( $this ); if ( false !== $result ) { $this->_state = ( ! empty( $update_id )) ? self::STATE_UPDATED : self::STATE_CREATED; } return $result; } /** * Update Metadata by name and occurrence_id. * * @param string $name - Meta name. * @param mixed $value - Meta value. * @param integer $occurrence_id - Occurrence_id. * *@see WSAL_Adapters_MySQL_Meta::LoadByNameAndOccurrenceId() */ public function UpdateByNameAndOccurenceId( $name, $value, $occurrence_id ) { $meta = $this->getAdapter()->LoadByNameAndOccurrenceId( $name, $occurrence_id ); if ( ! empty( $meta ) ) { $this->id = $meta['id']; $this->occurrence_id = $meta['occurrence_id']; $this->name = $meta['name']; $this->value = maybe_serialize( $value ); $this->saveMeta(); } else { $this->occurrence_id = $occurrence_id; $this->name = $name; $this->value = maybe_serialize( $value ); $this->SaveMeta(); } } }