示例#1
0
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $product = new Entity\Product();
     $product->setName('Teste');
     $this->doctrine->em->persist($product);
     $this->doctrine->em->flush();
 }
 function index()
 {
     $product = new Entity\Product();
     $product->setName('Teste');
     $this->doctrine->em->persist($product);
     $this->doctrine->em->flush();
     //$this->load->view('Home/home_v');
     $data['title'] = 'hello zeca';
     $this->parser->parse("home_v", $data);
 }
 public function testExistingProductWouldBeDeleted()
 {
     $indexer = $this->getIndexer();
     $product = new Entity\Product();
     $product->setName('This Product Is Doomed To Die');
     $this->persistAndFlush($product);
     $id = $product->getId();
     $indexer->reset();
     $this->assertEquals(array(), $indexer->deletions);
     $this->removeAndFlush($product);
     $this->assertEquals(array(metaenv('Product_dev') => array($this->getObjectID(['id' => $id]))), $indexer->deletions);
 }
 public function testCreateUpdateDeleteCallbacksAreCalledInRelationsToo()
 {
     $supplier = new Entity\Supplier();
     $supplier->setName("Algolia");
     $product = new Entity\Product();
     $product->setName('Search As a Service');
     $this->assertEquals(null, $product->getTestProp('create_callback'));
     $supplier->addProduct($product);
     $this->persistAndFlush($supplier);
     $this->assertEquals('called', $product->getTestProp('create_callback'));
     $this->assertEquals(null, $product->getTestProp('update_callback'));
     $product->setPrice(29.99);
     $this->persistAndFlush($supplier);
     $this->assertEquals('called', $product->getTestProp('update_callback'));
     $this->assertEquals(null, $product->getTestProp('delete_callback'));
     $this->removeAndFlush($supplier);
     $this->assertEquals('called', $product->getTestProp('delete_callback'));
 }
示例#5
0
 public function crearProducto()
 {
     $product = new \Entity\Product();
     //$product->setId(1);
     $product->setName('jhon');
     $this->em->persist($product);
     $this->em->flush();
 }