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.

public function editAction returns no data

The "findFirst" does not return data in MySQL, and Oracle but not in another function that does not need to be replaced to get the same results, My code is as follows:

public function editAction($CONT_CODIGO) { if (!$this->request->isPost()) { $SPM_CONTACTO = SpmContacto::findFirst(array('CONT_CODIGO'=>$CONT_CODIGO)); if (!$SPM_CONTACTO) { $this->flash->error("El contacto buscado no fue encontrado " . $CONT_CODIGO); return $this->dispatcher->forward(array( "controller" => "spm_contacto", "action" => "index" )); } $this->view->CONT_CODIGO = $SPM_CONTACTO->CONT_CODIGO; $this->tag->setDefault("CONT_CODIGO", $SPM_CONTACTO->CONT_CODIGO); $this->tag->setDefault("CONT_CEDULA", $SPM_CONTACTO->CONT_CEDULA); $this->tag->setDefault("CONT_RUCIDE", $SPM_CONTACTO->CONT_RUCIDE); $this->tag->setDefault("CONT_NOMBRE", $SPM_CONTACTO->CONT_NOMBRE); $this->tag->setDefault("CON_ESTADO", $SPM_CONTACTO->CON_ESTADO); $this->tag->setDefault("CONT_TELEFO", $SPM_CONTACTO->CONT_TELEFO); $this->tag->setDefault("CONT_DIRECC", $SPM_CONTACTO->CONT_DIRECC); $this->tag->setDefault("CONT_AREA", $SPM_CONTACTO->CONT_AREA); $this->tag->setDefault("CONT_CARGO", $SPM_CONTACTO->CONT_CARGO); $this->tag->setDefault("CONT_TIPOXX", $SPM_CONTACTO->CONT_TIPOXX); } }

edited Oct '15

I am sorry but I can't read your question ....

your question:

public function editAction($CONT_CODIGO) {

    if (!$this->request->isPost()) {

        $SPM_CONTACTO = SpmContacto::findFirst(array('CONTCODIGO'=>$CONTCODIGO)); 

        if (!$SPM_CONTACTO) { 

            $this->flash->error("El contacto buscado no fue encontrado " . $CONT_CODIGO); 
            return $this->dispatcher->forward(array( "controller" => "spm_contacto", "action" => "index" )); 

        $this->tag->setDefault("CONT_CODIGO", $SPM_CONTACTO->CONT_CODIGO); 
        $this->tag->setDefault("CONT_CEDULA", $SPMCONTACTO->CONTCEDULA);
        $this->tag->setDefault("CONT_RUCIDE", $SPM_CONTACTO->CONT_RUCIDE);
        $this->tag->setDefault("CONT_NOMBRE", $SPMCONTACTO->CONTNOMBRE);
        $this->tag->setDefault("CON_ESTADO", $SPM_CONTACTO->CON_ESTADO);
        $this->tag->setDefault("CONT_TELEFO", $SPMCONTACTO->CONTTELEFO);
        $this->tag->setDefault("CONT_DIRECC", $SPM_CONTACTO->CONT_DIRECC);
        $this->tag->setDefault("CONT_AREA", $SPMCONTACTO->CONTAREA);
        $this->tag->setDefault("CONT_CARGO", $SPM_CONTACTO->CONT_CARGO);
        $this->tag->setDefault("CONT_TIPOXX", $SPMCONTACTO->CONTTIPOXX); 


now ... what is the value of $CONT_CODIGO ?

try print_r($SPM_CONTACTO); and look trought the giant object to see if you can spot part of the query it self ( you have to dig a bit inside but it sohuld be there ). After you are the quesry is corrrect, check if the database really has this value

edited Oct '15

This is not a valid parameter for findFirst:

$SPM_CONTACTO = SpmContacto::findFirst(array('CONTCODIGO'=>$CONTCODIGO)); 

You could either use magic methods:

$SPM_CONTACTO = SpmContacto::findFirstByContcodigo($CONTCODIGO); 

Or the more refined parameters:

$SPM_CONTACTO = SpmContacto::findFirst(array('CONTCODIGO=?0', 'bind'=>array($CONTCODIGO)));
// the parameters array index 0 and 'conditions' are the same:
$SPM_CONTACTO = SpmContacto::findFirst(array('conditions'=>'CONTCODIGO=?0', 'bind'=>array($CONTCODIGO))); 


In the first method returns the form with camelcase me "Can not resolve attribute 'Contcodigo' in the model," In the second case my answer is "Column 'CONTCODIGO' does not belong to any of the selected models (1) When preparing : SELECT [SpmContacto] * FROM [SpmContacto] WHERE CONTCODIGO = 0 LIMIT:.? APL0 ", in the third case if it works the bounce message is that no data found


The database has the values in the "1724908809001" I put the prints submitted values have reviewed if it gives some error in the browser, the query statement is not as review it here in falcon but at least in those Shipping cases and verificaion data in the database if done so if I start to verify lso are special characters because I have a short, talves script is that

edited Dec '15

In the current version already they got this problem solving

git clone  git://
cd cphalcon/ext
git checkout 2.0.x
sudo ./install(edited)