// pessoa.php
<?php
class Pessoa extends ModelBase //ModelBamble
{
    /**
     *
     * @var integer
     */
    protected $id_pessoa;
    /**
     *
     * @var string
     */
    protected $nome;
    /**
     *
     * @var string
     */
    protected $data_nasc;
    /**
     *
     * @var string
     */
    protected $sexo;
    /**
     *
     * @var string
     */
    protected $pai;
    /**
     *
     * @var string
     */
    protected $mae;
    /**
     *
     * @var integer
     */
    protected $cod_foto;
    /**
     *
     * @var double
     */
    protected $cpf;
    /**
     *
     * @var integer
     */
    protected $cod_cidade;
    /**
     * Method to set the value of field id_pessoa
     *
     * @param integer $id_pessoa
     * @return $this
     */
    public function setIdPessoa($id_pessoa)
    {
        $this->id_pessoa = $id_pessoa;
        return $this;
    }
    /**
     * Method to set the value of field nome
     *
     * @param string $nome
     * @return $this
     */
    public function setNome($nome)
    {
        $this->nome = $nome;
        return $this;
    }
    /**
     * Method to set the value of field data_nasc
     *
     * @param string $data_nasc
     * @return $this
     */
    public function setDataNasc($data_nasc)
    {
        $this->data_nasc = $data_nasc;
        return $this;
    }
    /**
     * Method to set the value of field sexo
     *
     * @param string $sexo
     * @return $this
     */
    public function setSexo($sexo)
    {
        $this->sexo = $sexo;
        return $this;
    }
    /**
     * Method to set the value of field pai
     *
     * @param string $pai
     * @return $this
     */
    public function setPai($pai)
    {
        $this->pai = $pai;
        return $this;
    }
    /**
     * Method to set the value of field mae
     *
     * @param string $mae
     * @return $this
     */
    public function setMae($mae)
    {
        $this->mae = $mae;
        return $this;
    }
    /**
     * Method to set the value of field cod_foto
     *
     * @param integer $cod_foto
     * @return $this
     */
    public function setCodFoto($cod_foto)
    {
        $this->cod_foto = $cod_foto;
        return $this;
    }
    /**
     * Method to set the value of field cpf
     *
     * @param double $cpf
     * @return $this
     */
    public function setCpf($cpf)
    {
        $this->cpf = $cpf;
        return $this;
    }
    /**
     * Method to set the value of field cod_cidade
     *
     * @param integer $cod_cidade
     * @return $this
     */
    public function setCodCidade($cod_cidade)
    {
        $this->cod_cidade = $cod_cidade;
        return $this;
    }
    /**
     * Returns the value of field id_pessoa
     *
     * @return integer
     */
    public function getIdPessoa()
    {
        return $this->id_pessoa;
    }
    /**
     * Returns the value of field nome
     *
     * @return string
     */
    public function getNome()
    {
        return $this->nome;
    }
    /**
     * Returns the value of field data_nasc
     *
     * @return string
     */
    public function getDataNasc()
    {
        return $this->data_nasc;
    }
    /**
     * Returns the value of field sexo
     *
     * @return string
     */
    public function getSexo()
    {
        return $this->sexo;
    }
    /**
     * Returns the value of field pai
     *
     * @return string
     */
    public function getPai()
    {
        return $this->pai;
    }
    /**
     * Returns the value of field mae
     *
     * @return string
     */
    public function getMae()
    {
        return $this->mae;
    }
    /**
     * Returns the value of field cod_foto
     *
     * @return integer
     */
    public function getCodFoto()
    {
        return $this->cod_foto;
    }
    /**
     * Returns the value of field cpf
     *
     * @return double
     */
    public function getCpf()
    {
        return $this->cpf;
    }
    /**
     * Returns the value of field cod_cidade
     *
     * @return integer
     */
    public function getCodCidade()
    {
        return $this->cod_cidade;
    }
    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("sch_pessoa");
        $this->hasMany('id_pessoa', 'Usuario', 'id_usuario', \NULL);
        parent::initialize();
    }
    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'pessoa';
    }
    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return Pessoa[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }
    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return Pessoa
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }
    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'id_pessoa' => 'id_pessoa',
            'nome' => 'nome',
            'data_nasc' => 'data_nasc',
            'sexo' => 'sexo',
            'pai' => 'pai',
            'mae' => 'mae',
            'cod_foto' => 'cod_foto',
            'cpf' => 'cpf',
            'cod_cidade' => 'cod_cidade'
        );
    }
}
<?php
class Usuario extends ModelBamble
{
    /**
     *
     * @var integer
     */
    protected $id_usuario;
    /**
     *
     * @var string
     */
    protected $login;
    /**
     *
     * @var string
     */
    protected $senha;
    /**
     *
     * @var string
     */
    protected $last_login;
    /**
     *
     * @var string
     */
    protected $pre_last_login;
    /**
     *
     * @var integer
     */
    protected $ativo;
    /**
     * Method to set the value of field id_usuario
     *
     * @param integer $id_usuario
     * @return $this
     */
    public function setIdUsuario($id_usuario)
    {
        $this->id_usuario = $id_usuario;
        return $this;
    }
    /**
     * Method to set the value of field login
     *
     * @param string $login
     * @return $this
     */
    public function setLogin($login)
    {
        $this->login = $login;
        return $this;
    }
    /**
     * Method to set the value of field senha
     *
     * @param string $senha
     * @return $this
     */
    public function setSenha($senha)
    {
        $this->senha = $senha;
        return $this;
    }
    /**
     * Method to set the value of field last_login
     *
     * @param string $last_login
     * @return $this
     */
    public function setLastLogin($last_login)
    {
        $this->last_login = $last_login;
        return $this;
    }
    /**
     * Method to set the value of field pre_last_login
     *
     * @param string $pre_last_login
     * @return $this
     */
    public function setPreLastLogin($pre_last_login)
    {
        $this->pre_last_login = $pre_last_login;
        return $this;
    }
    /**
     * Method to set the value of field ativo
     *
     * @param integer $ativo
     * @return $this
     */
    public function setAtivo($ativo)
    {
        $this->ativo = $ativo;
        return $this;
    }
    /**
     * Returns the value of field id_usuario
     *
     * @return integer
     */
    public function getIdUsuario()
    {
        return $this->id_usuario;
    }
    /**
     * Returns the value of field login
     *
     * @return string
     */
    public function getLogin()
    {
        return $this->login;
    }
    /**
     * Returns the value of field senha
     *
     * @return string
     */
    public function getSenha()
    {
        return $this->senha;
    }
    /**
     * Returns the value of field last_login
     *
     * @return string
     */
    public function getLastLogin()
    {
        return $this->last_login;
    }
    /**
     * Returns the value of field pre_last_login
     *
     * @return string
     */
    public function getPreLastLogin()
    {
        return $this->pre_last_login;
    }
    /**
     * Returns the value of field ativo
     *
     * @return integer
     */
    public function getAtivo()
    {
        return $this->ativo;
    }
    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("sch_usuario");
        $this->hasMany('id_usuario', 'GrupoUsuario', 'gu_cod_usuario', NULL);
        $this->hasMany('id_usuario', 'Permissao', 'p_cod_usuario', NULL);
        $this->belongsTo('id_usuario', 'Pessoa', 'id_pessoa', array('foreignKey' => true, 'alias' => 'Pessoa'));
        parent::initialize();
    }
    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return Usuario[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }
    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return Usuario
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }
    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'id_usuario' => 'id_usuario',
            'login' => 'login',
            'senha' => 'senha',
            'last_login' => 'last_login',
            'pre_last_login' => 'pre_last_login',
            'ativo' => 'ativo'
        );
    }
    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'usuario';
    }
}