Advertisement
Koshceyshka

Untitled

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