Condition within foreach before saving template

1

In my% s of CakePHP a Controller was made by passing all the data of a form to a variable.

Now, how do I make a specific% wc, what would your goal be if the foreach is passing is empty, move on to the next?

foreach ($this->request->data['CursoNavigation'] as $indice => $valor) {
    if (empty($valor)) continue;
    // código para continuar e salvar as informações no 'CursoNavigation'
}
    
asked by anonymous 16.04.2015 / 20:09

1 answer

1

If you do not want a given field in your form not to be saved in the database, even though it is an empty string , you can treat this behavior in Model itself.

In your%

16.04.2015 / 20:54