<commit_before><?php

namespace Application\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ArrayCollection;

use Zend\Stdlib\Exception;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter as InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

use Dboss\PasswordHash;
use Dboss\Xtea;

/**
 * @ORM\Entity (repositoryClass="\Application\Repository\UserRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="user")
 **/
class User extends AbstractEntity implements InputFilterAwareInterface
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer", nullable=false)
     **/
    protected $user_id;

    /** @ORM\Column(type="integer", nullable=false) */
    protected $role_id;

    /** @ORM\Column(type="string", unique=true, nullable=false) */
    protected $user_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $first_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $last_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $password;

    /** @ORM\Column(type="datetime", nullable=false) */
    protected $creation_date;

    /** @ORM\Column(type="datetime", nullable=false) */
    protected $modification_date;

    /** @ORM\Column(type="datetime", nullable=true) */
    protected $deletion_date;

    /**
     * @ORM\ManyToOne(targetEntity="Role")
     * @ORM\JoinColumn(name="role_id", referencedColumnName="role_id")
     **/
    protected $role;

    /**
     * @ORM\OneToMany(targetEntity="Query", mappedBy="user")
     **/
    protected $queries;

    /**
     * @ORM\OneToMany(targetEntity="Connection", mappedBy="user")
     **/
    protected $connections;

    protected $fields;
    protected $security;
    protected $input_filter;

    /**
     *
     **/
    public function __construct()
    {
        $this->queries = new ArrayCollection();
        $this->servers = new ArrayCollection();
        $this->databases = new ArrayCollection();
    }

    /**
     * Only the properties that should be hydrated
     **/
    public function getFields()
    {
        if ($this->fields) {
            return $this->fields;
        }

        $this->fields = array(
            'user_id',
            'role_id',
            'user_name',
            'first_name',
            'last_name',
            'password'
        );

        return $this->fields;
    }

    /**
     * 
     **/
    public function setInputFilter(InputFilterInterface $inputFilter)
    {
        throw new \Exception("setInputFilter not used in " . __METHOD__);
    }

    /**
     * 
     **/
    public function getInputFilter()
    {
        if (! $this->input_filter) {
            $input_filter = new InputFilter();
            $factory = new InputFactory();

            $input_filter->add($factory->createInput(array(
                'name'     => 'user_id',
                'required' => true,
                'filters'  => array(
                    array('name' => 'Int'),
                ),
            )));

            $input_filter->add($factory->createInput(array(
                'name'     => 'user_name',
                'required' => true,<commit_msg>Added input filter for role_id<commit_after><?php

namespace Application\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ArrayCollection;

use Zend\Stdlib\Exception;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter as InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

use Dboss\PasswordHash;
use Dboss\Xtea;

/**
 * @ORM\Entity (repositoryClass="\Application\Repository\UserRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="user")
 **/
class User extends AbstractEntity implements InputFilterAwareInterface
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer", nullable=false)
     **/
    protected $user_id;

    /** @ORM\Column(type="integer", nullable=false) */
    protected $role_id;

    /** @ORM\Column(type="string", unique=true, nullable=false) */
    protected $user_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $first_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $last_name;

    /** @ORM\Column(type="string", nullable=false) */
    protected $password;

    /** @ORM\Column(type="datetime", nullable=false) */
    protected $creation_date;

    /** @ORM\Column(type="datetime", nullable=false) */
    protected $modification_date;

    /** @ORM\Column(type="datetime", nullable=true) */
    protected $deletion_date;

    /**
     * @ORM\ManyToOne(targetEntity="Role")
     * @ORM\JoinColumn(name="role_id", referencedColumnName="role_id")
     **/
    protected $role;

    /**
     * @ORM\OneToMany(targetEntity="Query", mappedBy="user")
     **/
    protected $queries;

    /**
     * @ORM\OneToMany(targetEntity="Connection", mappedBy="user")
     **/
    protected $connections;

    protected $fields;
    protected $security;
    protected $input_filter;

    /**
     *
     **/
    public function __construct()
    {
        $this->queries = new ArrayCollection();
        $this->servers = new ArrayCollection();
        $this->databases = new ArrayCollection();
    }

    /**
     * Only the properties that should be hydrated
     **/
    public function getFields()
    {
        if ($this->fields) {
            return $this->fields;
        }

        $this->fields = array(
            'user_id',
            'role_id',
            'user_name',
            'first_name',
            'last_name',
            'password'
        );

        return $this->fields;
    }

    /**
     * 
     **/
    public function setInputFilter(InputFilterInterface $inputFilter)
    {
        throw new \Exception("setInputFilter not used in " . __METHOD__);
    }

    /**
     * 
     **/
    public function getInputFilter()
    {
        if (! $this->input_filter) {
            $input_filter = new InputFilter();
            $factory = new InputFactory();

            $input_filter->add($factory->createInput(array(
                'name'     => 'user_id',
                'required' => true,
                'filters'  => array(
                    array('name' => 'Int'),
                ),
            )));

            $input_filter->add($factory->createInput(array(
                'name'     => 'role_id',
                'required' => true,
            )));

            $input_filter->add($factory->createInput(array(
                'name'     => 'user_name',
                'required' => true,
{'fraction_non_alphanumeric': 0.14680913348946137, 'fraction_numerical': 0.0, 'mean_word_length': 2.362696850393701, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '5894452', 'n_tokens_mistral': 2049, 'n_tokens_neox': 1969, 'n_words': 346}