Koshceyshka

Untitled

Dec 14th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 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. // use bootstrap;
  12.  
  13. // require_once __ROOT__ .'bootstrap.php';
  14.  
  15. class MainController extends AppController {
  16.  
  17.  
  18.  // public function __construct(EntityManagerInterface $entityManager)
  19.  //    {
  20.  //        $this->repository = $entityManager->getRepository('Student');
  21.  //    }
  22.  
  23.  
  24. public function index(){
  25.         // echo 'Hello test';
  26.     }
  27.    
  28.  
  29. public function new(){
  30.  
  31.  
  32. // $studentRepository = $this->$entityManager->getRepository('Student');
  33. // $student = $productRepository->findAll();
  34. // echo $student->getId();
  35.  
  36.  
  37. $name = 'Ura';
  38. $surname = 'Greachka';
  39. $entity = 'Student';
  40.  
  41. // $entityManager = $this->getRepository('StudentRepository');
  42.  
  43. $entityManager = new Student();
  44. $entityManager->setName($name);
  45. $entityManager->setSurname($surname);
  46. persist($entityManager);
  47. flush();
  48. echo 'KEK!';
  49.  
  50.    
  51. }
  52.  
  53.  
  54. public function remove(){
  55.  
  56. }
  57.  
  58.  
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment