1
I’m having a question about the default php project.
I have a class DAO
which has a selection method, well what happens is that I had to put in this method some HTML code stylized with bootstrap, what I did this correct?
class CategoriaDao {
public function selecionaTudo($sql) {
$conexao = new PDOUtil();
$consulta = $conexao->conectar()->query($sql);
while ($sqlSeleciona = $consulta->fetch(PDO::FETCH_OBJ)){
echo "<td>" . $sqlSeleciona->descricao . "</td>";
echo '<td><a href="index.php?action=update&id='.$sqlSeleciona->id_categoria_pagina.'" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Editar</a></td>';
echo '<td><a href="index.php?action=delete&id='.$sqlSeleciona->id_categoria_pagina.'" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-remove"></span> Excluir</a></td>';
echo "</tr>";
}
}
Obs: I’m not having problems related to logic but refer to design patterns.
– André Martins
Look.. The standard is Voce that does why the project is yours.. But to stay a beautiful business and with this "pattern" that Oce seeks would be recommended that there is no HTML so in internal classes and yes in the pages in which the class is manipulated..
– Elaine
Research on MVC at first.
– Daniel Omine
Model view and controller is smooth on architectures like JSF or Spring the problem is that I am not using any framework, this was set at the beginning of the project, php does not have a more closed architecture which in my humble view is worse because it ends up accepting gambiarras like this.
– André Martins