Koshceyshka

Untitled

Dec 13th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. namespace app\controllers;
  4.  
  5. use Doctrine\ORM\Tools\Setup;
  6. use App\Entities\Student;
  7. use Doctrine\ORM\EntityManager;
  8.  
  9.  
  10.  
  11. class MainController extends AppController {
  12.  
  13.  
  14.  
  15. public function index(){
  16.         // echo 'Hello test';
  17.     }
  18.    
  19.  
  20. public function new(){
  21.  
  22.  
  23. // $studentRepository = $this->$entityManager->getRepository('Student');
  24. // $student = $productRepository->findAll();
  25. // echo $student->getId();
  26.  
  27. $name = 'Ura';
  28. $surname = 'Greachka';
  29.  
  30. $manager = new EnityManager();
  31. $entityManager = $manager->getDoctrine()->getManager();
  32. $student = new Student();
  33. $student->setName($name);
  34. $student->setSurname($surname);
  35. $entityManager->persist($student);
  36. $entityManager->flush();
  37.  
  38.  
  39.    
  40. }
  41.  
  42.  
  43. public function remove(){
  44.  
  45. }
  46.  
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment