public function save($entity)
    {
        if ($this->idProperty->getValue($entity) === null) {
            return $this->insert($entity);
        } else {
            return $this->update($entity);
        }

    }
public function save($entity)
    {
        if ($this->idProperty->getValue($entity) === null) {
            return $this->insert($entity);
        } else {
            return $this->update($entity);
        }

    }
public function save ( $ entity ) { if ( $ this -> idProperty -> getValue ( $ entity ) === null ) { return $ this -> insert ( $ entity ) ; } else { return $ this -> update ( $ entity ) ; } }
Insert an entity into the database if it has no id yet. Otherwise update it by id.
@param mixed $entity the entity
@return int the id of the saved document
@throws ConfigurationException if no idProperty was set
Insert an entity into the database if it has no id yet . Otherwise update it by id .