Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to select a record field for filtering unused FindFirst or FindFirstby?

How to select a record field for filtering unused FindFirst or FindFirstby? I want to make a query of a record filtering by the code, but the commands findfirstby FindFirst or does not return any data, MYSQL work with the same data in Oracle where I work does not work, take two months and the truth and I gave up . So I want to make a single query using a different method

public $CONT_CODIGO;
public $CONT_CEDULA;
public $CONT_RUCIDE;
public $CONT_NOMBRE;
public $CON_ESTADO;
public $CONT_TELEFO;
public $CONT_DIRECC;
public $CONT_AREA;
public $CONT_CARGO;
public $CONT_TIPOXX;
public $CONT_EMAIL;
public $CONT_USUARIO;
public $CONT_CLAVE;
public $CONT_CLAVEE;
public function initialize()
{
    $this->setSchema("SPOLS");
    $this->setSource("'SPM_CONTACTO'");
    $this->hasMany('CONT_CODIGO', 'SpmReferencia', 'CONT_CODIGO', array('alias' => 'SpmReferencia'));
    $this->hasMany('CONT_CODIGO', 'SptDetalle', 'CONT_CODIGO', array('alias' => 'SptDetalle'));
    $this->hasMany('CONT_CODIGO', 'SptEncabezado', 'CONT_CODIGO', array('alias' => 'SptEncabezado'));
}
public static function find($parameters = null)
{
    return parent::find($parameters);
}public static function findFirst($parameters = null)
{
    return parent::findFirst($parameters);
}public function getSource()
{
    return 'SPM_CONTACTO';
}
public function columnMap()
{
    return array(
        'CONT_CODIGO' => 'CONT_CODIGO',
        'CONT_CEDULA' => 'CONT_CEDULA',
        'CONT_RUCIDE' => 'CONT_RUCIDE',
        'CONT_NOMBRE' => 'CONT_NOMBRE',
        'CON_ESTADO' => 'CON_ESTADO',
        'CONT_TELEFO' => 'CONT_TELEFO',
        'CONT_DIRECC' => 'CONT_DIRECC',
        'CONT_AREA' => 'CONT_AREA',
        'CONT_CARGO' => 'CONT_CARGO',
        'CONT_TIPOXX' => 'CONT_TIPOXX',
        'CONT_EMAIL' => 'CONT_EMAIL',
        'CONT_USUARIO' => 'CONT_USUARIO',
        'CONT_CLAVE' => 'CONT_CLAVE',
        'CONT_CLAVEE' => 'CONT_CLAVEE'
    );
}


37.8k
Accepted
answer

Hey

You can use query builder Phalcon or pdo, see more https://docs.phalconphp.com/en/latest/api/Phalcon_Db_Adapter_Pdo.html