<commit_before><?php


namespace Ec\Model;

use Zend\Db\TableGateway\TableGateway;

class UserTable
{
    protected $tableGateway;
    
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
        
    }
    
    public function fetchAll()
    {
        $resultSet = $this->tableGateway->select();
        return $resultSet;
    }
    
    // selectʸ
    public function getUser($id)
    {
        $id = (int) $id;
        $rowset = $this->tableGateway->select(array('id' => $id));
        $row = $rowset->current();
        if (!$row) {
            throw new \Exception("Could not find row $id");
        }
        return $row;
    }
    
    // 쥳ɿ
    public function saveUser(User $user)
    {
        $data = array(
            'name' => $user->name,
            'email' => $user->email,
            'password' => <PASSWORD>,
            'comment' => $user->comment,
            'url' => $user->url,
            
            );
        $id = (int)$user->id;
        if ($id == 0) {
            $this->tableGateway->insert($data);
            
        } else {
            if ( $this->getUser($id)){
                $this->tableGateway->update($data, array('id' => $id));
            } else {
                throw new \Exception('Form id does not exit');
            }
        }
    }
    
    // 쥳ɺ
    public function deleteUser($id)
    {
        $this->tableGateway->delete(array('id' => $id));
    }
}
<commit_msg>配列にidを追加<commit_after><?php


namespace Ec\Model;

use Zend\Db\TableGateway\TableGateway;

class UserTable
{
    protected $tableGateway;
    
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
        
    }
    
    // ƤΥ쥳ɤ
    public function fetchAll()
    {
        $resultSet = $this->tableGateway->select();
        return $resultSet;
    }
    
    // selectʸ
    public function getUser($id)
    {
        $id = (int) $id;
        $rowset = $this->tableGateway->select(array('id' => $id));
        $row = $rowset->current();
        if (!$row) {
            throw new \Exception("Could not find row $id");
        }
        return $row;
    }
    
    /* 쥳ɿ
     * 
     * @param array $user 桼ǥ륯饹
     */
    public function saveUser(User $user)
    {
        // ֤
        $data = array(
            'id' => $user->id,
            'name' => $user->name,
            'email' => $user->email,
            'password' => $<PASSWORD>,
            'comment' => $user->comment,
            'url' => $user->url,
            
            );
        $id = (int)$user->id;
        
        // IDʤINSERT
        if ($id == 0) {
            $this->tableGateway->insert($data);
        // IDUPDATE    
        } else {
            // IDȤ˥쥳ɼ
            if ( $this->getUser($id)){
                $this->tableGateway->update($data, array('id' => $id));
            } else {
                throw new \Exception('Form id does not exit');
            }
        }
    }
    
    // 쥳ɺ
    public function deleteUser($id)
    {
        $this->tableGateway->delete(array('id' => $id));
    }
}

{'fraction_non_alphanumeric': 0.15524967989756722, 'fraction_numerical': 0.0006402048655569782, 'mean_word_length': 1.4645110410094637, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 59, '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': '5984265', 'n_tokens_mistral': 996, 'n_tokens_neox': 1007, 'n_words': 187}