Created
January 16, 2017 19:54
-
-
Save jlamim/7f5614a9fb636ac1834634d1239cea10 to your computer and use it in GitHub Desktop.
Doctrine e CodeIgniter - Controller
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
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Categoria extends CI_Controller { | |
public function add() | |
{ | |
// Instancia o objeto Categoria | |
$categoria = new Entity\Categoria(); | |
// Define um nome para a categoria | |
$categoria->setNome('Teste 2'); | |
// Aplica a persistência dos dados e executa a inserção no banco | |
$this->doctrine->em->persist($categoria); | |
$this->doctrine->em->flush(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment