We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

findFirstBy returns no records in oracle

Cuando yo genero un scaffold con las developer tools al intentar editar or eliminar al momento de filtrar con la funcion llamada "findFirstByid" no retorno ningun dato mientras yo uso oracle, pero cuando hago el mismo proceso con los mismos datos en mysql si funciona no se porque sera esto o porque funcion debo reemplazar In mysql I have

public function editAction($id) { if (!$this->request->isPost()) { $cliente = Clientes::findFirstByid($id); if (!$cliente) { $this->flash->error("cliente was not found"); return $this->dispatcher->forward(array( "controller" => "clientes", "action" => "index" )); } $this->view->id = $cliente->id; $this->tag->setDefault("id", $cliente->id); $this->tag->setDefault("nombre", $cliente->nombre); $this->tag->setDefault("apellido", $cliente->apellido); $this->tag->setDefault("fecha_nac", $cliente->fecha_nac); $this->tag->setDefault("peso", $cliente->peso);

    }} 

while in oracle I have

public function editAction($CONT_CODIGO) { if (!$this->request->isPost()) { $SPM_CONTACTO = SpmContacto::findFirstByCONT_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);

    }
}
But Oracle does not return data

Please respect the community and post in english... findFirstByid is wrong, DB fields will get camelcased. It should read findFirstById. Check the Phalcon\Text::camelize() function what your DB field names will be converted to.



81.2k

Thanks, excuse me is that I thought I had posted bad, because I'm not very adept at English, since I did not work findFirstByid longer find myself reading the documentation to check the function will write anything



81.2k
Accepted
answer
edited Dec '15

In the current version already they got this problem solving

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