protected function insert($values)
    {
        $id = db_insert($this->table)->fields($values)->execute();

        $query = db_select($this->table, 'T');
        $query->fields('T');
        $query->condition($this->primary_key, $id);

        return $query->execute()->fetchObject();
    }
protected function insert($values)
    {
        $id = db_insert($this->table)->fields($values)->execute();

        $query = db_select($this->table, 'T');
        $query->fields('T');
        $query->condition($this->primary_key, $id);

        return $query->execute()->fetchObject();
    }
protected function insert ( $ values ) { $ id = db_insert ( $ this -> table ) -> fields ( $ values ) -> execute ( ) ; $ query = db_select ( $ this -> table , 'T' ) ; $ query -> fields ( 'T' ) ; $ query -> condition ( $ this -> primary_key , $ id ) ; return $ query -> execute ( ) -> fetchObject ( ) ; }
Insert data into the db and obtain the inserted records.

@param $values
@throws \Exception
@return \stdClass
Insert data into the db and obtain the inserted records .