Pheasant\Database\Mysqli\Table::upsert PHP Method

upsert() public method

Tries to update a record, or inserts if it doesn't exist. Worth noting that affectedRows will be 2 on an update, 1 on an insert.
public upsert ( $data )
    public function upsert($data)
    {
        if (empty($data)) {
            throw new Exception("Can't insert an empty row");
        }
        return $this->_connection->execute(sprintf('INSERT INTO %s SET %2$s ON DUPLICATE KEY UPDATE %2$s', $this->_name->quoted(), $this->_buildSet($data)), array_merge(array_values($data), array_values($data)));
    }