<commit_before><?php

namespace App\Services;

class PeopleService extends BaseService
{

    public function getAll()
    {
        return $this->db->fetchAll("SELECT * FROM people");
    }
    
    public function findOneByUsername($username)
    {
    	return $this->db->fetchAssoc('SELECT * FROM users WHERE username = ?;',array($username)) ;
    }
    
    public function findAllOrderByNameLastname()
    {
    	$sql = 'SELECT u.*,t.name as teamname
				FROM users u
				INNER JOIN teams t ON t.id = u.id_team			
				ORDER BY t.name, lastname, firstname';
    	
    	return $this->db->fetchAll($sql) ;
    }
    
    public function findByTeamname($name)
    {
    	$sql='SELECT *
				FROM users u 
				INNER JOIN teams t ON t.`id` = u.`id_team`
				WHERE t.`name` = ?;';
    	
     	return $this->db->fetchAll($sql,array($name)) ;
    }
    
    public function findByTeamId($id)
    {
    	$sql='SELECT *
				FROM users u 
				WHERE u.`id_team` = ?;';
    	
     	return $this->db->fetchAll($sql,array($id)) ;
    }
    
    public function findByTechnoCode($code)
    {
    	$sql='SELECT *
				FROM users u 
				INNER JOIN `team_techno` tt ON tt.`id_team` = u.`id_team`
				INNER JOIN techno t ON t.`id` = tt.`id_techno`
				WHERE
				t.`code` = ?;';
    	 
    	return $this->db->fetchAll($sql,array($code)) ;
    }

    public function updateDescription($id, $description){
        $userDesc = array(
            'id'   => $id,
            'description' => $description,
        );
        $types = array(
                'id' => PDO::PARAM_INT,
                'description' => PDO::PARAM_STR,
        );

        $sql = 'UPDATE users
        SET description = ?
        WHERE id = ?;';
        
        return $this->db->query($sql, $userDesc, $types);
    }

    function save($person)
    {
        $this->db->insert("people", $person);
        return $this->db->lastInsertId();
    }

    function update($id, $person)
    {
        return $this->db->update('people', $person, ['id' => $id]);
    }
}<commit_msg>fixing update description on profil of user<commit_after><?php

namespace App\Services;
use PDO;

class PeopleService extends BaseService
{

    public function getAll()
    {
        return $this->db->fetchAll("SELECT * FROM people");
    }
    
    public function findOneByUsername($username)
    {
    	return $this->db->fetchAssoc('SELECT * FROM users WHERE username = ?;',array($username)) ;
    }
    
    public function findAllOrderByNameLastname()
    {
    	$sql = 'SELECT u.*,t.name as teamname
				FROM users u
				INNER JOIN teams t ON t.id = u.id_team			
				ORDER BY t.name, lastname, firstname';
    	
    	return $this->db->fetchAll($sql) ;
    }
    
    public function findByTeamname($name)
    {
    	$sql='SELECT *
				FROM users u 
				INNER JOIN teams t ON t.`id` = u.`id_team`
				WHERE t.`name` = ?;';
    	
     	return $this->db->fetchAll($sql,array($name)) ;
    }
    
    public function findByTeamId($id)
    {
    	$sql='SELECT *
				FROM users u 
				WHERE u.`id_team` = ?;';
    	
     	return $this->db->fetchAll($sql,array($id)) ;
    }
    
    public function findByTechnoCode($code)
    {
    	$sql='SELECT *
				FROM users u 
				INNER JOIN `team_techno` tt ON tt.`id_team` = u.`id_team`
				INNER JOIN techno t ON t.`id` = tt.`id_techno`
				WHERE
				t.`code` = ?;';
    	 
    	return $this->db->fetchAll($sql,array($code)) ;
    }

    public function updateDescription($id, $description){
        $userDesc = array(
            'description' => $description,
        	'id'   => $id
        );

        return $this->db->update('users', $userDesc,  ['id' => $id]);
    }

    function save($person)
    {
        $this->db->insert("people", $person);
        return $this->db->lastInsertId();
    }

    function update($id, $person)
    {
        return $this->db->update('people', $person, ['id' => $id]);
    }
}
{'fraction_non_alphanumeric': 0.151709951144253, 'fraction_numerical': 0.0, 'mean_word_length': 2.16260162601626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7569827', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1310, 'n_words': 284}