Created
October 18, 2015 18:53
-
-
Save devalexandre/fb84a407c534c3427646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onEdit($param) | |
{ | |
try | |
{ | |
if (isset($param['key'])) | |
{ | |
$key=$param['key']; // get the parameter $key | |
TTransaction::open('sample'); // open a transaction | |
$object = new Clientes($key); // instantiates the Active Record | |
$obj = new stdClass(); | |
$obj->id = $object->id; | |
$obj->nome = $object->nome; | |
//array de telefones vazio | |
$telefones = array(); | |
//pega os telefones | |
foreach($object->gettelefones() as $t): | |
coloca o telefone no array | |
$telefones[] = $t->id; | |
endforeach; | |
// aqui que da o pau | |
// não coloca os telefones no multfield | |
$obj->telefone = $telefones; | |
$this->form->setData($obj); // fill the form | |
TTransaction::close(); // close the transaction | |
} | |
else | |
{ | |
$this->form->clear(); | |
} | |
} | |
catch (Exception $e) // in case of exception | |
{ | |
new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // shows the exception error message | |
TTransaction::rollback(); // undo all pending operations | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment