<?php

/**
 * @property  id_cliente
 */
class visita extends TRecord
{
    const TABLENAME = 'tbl_visita';
    const PRIMARYKEY= 'id';
    const IDPOLICY =  'max'; // {max, serial}

    private $visitante;

    use SystemChangeLogTrait;

    public function __construct($id = NULL)
    {
        parent::__construct($id);
        parent::addAttribute('id_cliente');
        parent::addAttribute('tipo_cliente');
        parent::addAttribute('name');
        parent::addAttribute('entrada');
        parent::addAttribute('saida');
        parent::addAttribute('fechado');
    }
    public function get_nome()
    {
        // loads the associated object
        if (empty($this->visitante))
            $this->visitante = new cliente($this->id_cliente);

        // returns the associated object
        return $this->visitante->nome;
    }}
?>