예제 #1
0
 /**
  * Remove estu
  *
  * @param \AppBundle\Entity\SeccionEstu $estu
  */
 public function removeEstu(\AppBundle\Entity\SeccionEstu $estu)
 {
     $this->estu->removeElement($estu);
 }
예제 #2
0
 public function loadSeccionEstu(ObjectManager $manager)
 {
     $seccionEstu = array(array(1, 1, 12), array(2, 1, 14), array(3, 1, 40), array(4, 1, 41), array(5, 1, 65), array(6, 1, 66), array(7, 1, 67), array(8, 1, 78), array(9, 1, 84), array(10, 1, 87), array(11, 2, 65), array(12, 8, 69), array(13, 8, 63), array(14, 8, 55), array(15, 8, 72), array(16, 8, 48), array(17, 8, 56), array(18, 8, 50), array(19, 9, 69), array(20, 9, 63), array(21, 9, 55), array(22, 9, 72), array(23, 9, 48), array(24, 9, 56), array(25, 9, 50), array(26, 10, 69), array(27, 10, 63), array(28, 10, 55), array(29, 10, 72), array(30, 10, 48), array(31, 10, 56), array(32, 10, 50), array(33, 11, 69), array(34, 11, 63), array(35, 11, 55), array(36, 11, 72), array(37, 11, 48), array(38, 11, 56), array(39, 11, 50), array(40, 12, 69), array(41, 12, 63), array(42, 12, 55), array(43, 12, 72), array(44, 12, 48), array(45, 12, 56), array(46, 12, 50), array(47, 2, 12), array(48, 2, 40), array(49, 2, 41), array(50, 2, 66), array(51, 2, 67), array(52, 2, 87), array(53, 2, 78), array(54, 3, 12), array(55, 3, 40), array(56, 3, 87), array(57, 3, 41), array(58, 3, 66), array(59, 3, 67), array(60, 3, 14), array(61, 3, 84), array(62, 3, 65), array(63, 3, 78), array(64, 2, 14), array(65, 2, 84), array(66, 4, 12), array(67, 4, 14), array(68, 4, 40), array(69, 4, 41), array(70, 4, 65), array(71, 4, 66), array(72, 4, 67), array(73, 4, 78), array(74, 4, 87), array(75, 4, 84), array(76, 5, 12), array(77, 5, 14), array(78, 5, 40), array(79, 5, 41), array(80, 5, 66), array(81, 5, 67), array(82, 5, 78), array(83, 5, 84), array(84, 5, 65), array(85, 5, 87), array(86, 6, 14), array(87, 6, 12), array(88, 6, 40), array(89, 6, 41), array(90, 6, 65), array(91, 6, 66), array(92, 6, 67), array(93, 6, 78), array(94, 6, 84), array(95, 6, 87), array(96, 7, 12), array(97, 7, 14), array(98, 7, 40), array(99, 7, 41), array(100, 7, 65), array(101, 7, 66), array(102, 7, 67), array(103, 7, 78), array(104, 7, 84), array(105, 7, 87), array(106, 13, 48), array(107, 13, 50), array(108, 13, 63), array(109, 13, 56), array(110, 13, 64), array(111, 13, 69), array(112, 13, 72), array(113, 13, 73), array(114, 13, 55), array(115, 8, 64), array(116, 8, 73), array(117, 11, 64), array(118, 11, 73), array(119, 9, 64), array(120, 9, 73), array(121, 10, 64), array(122, 10, 73), array(123, 12, 64), array(124, 12, 73), array(125, 14, 48), array(126, 14, 55), array(127, 14, 50), array(128, 14, 63), array(129, 14, 56), array(130, 14, 64), array(131, 14, 69), array(132, 14, 72), array(133, 14, 73), array(134, 15, 50), array(135, 15, 48), array(136, 15, 56), array(137, 15, 55), array(138, 15, 63), array(139, 15, 64), array(140, 15, 72), array(141, 15, 73), array(142, 15, 69), array(143, 16, 48), array(144, 16, 50), array(145, 16, 55), array(146, 16, 56), array(147, 16, 63), array(148, 16, 64), array(149, 16, 72), array(150, 16, 73), array(151, 16, 69), array(152, 17, 48), array(153, 17, 50), array(154, 17, 55), array(155, 17, 56), array(156, 17, 63), array(157, 17, 64), array(158, 17, 69), array(159, 17, 72), array(160, 17, 73), array(161, 18, 48), array(162, 18, 50), array(163, 18, 55), array(164, 18, 56), array(165, 18, 63), array(166, 18, 64), array(167, 18, 69), array(168, 18, 72), array(169, 18, 73), array(170, 19, 48), array(171, 19, 50), array(172, 19, 55), array(173, 19, 56), array(174, 19, 63), array(175, 19, 64), array(176, 19, 69), array(177, 19, 72), array(178, 19, 73), array(179, 20, 48), array(180, 20, 50), array(181, 20, 55), array(182, 20, 56), array(183, 20, 63), array(184, 20, 64), array(185, 20, 69), array(186, 20, 72), array(187, 20, 73), array(188, 21, 48), array(189, 21, 50), array(190, 21, 55), array(191, 21, 56), array(192, 21, 63), array(193, 21, 64), array(194, 21, 69), array(195, 21, 72), array(196, 21, 73), array(197, 22, 48), array(198, 22, 50), array(199, 22, 55), array(200, 22, 56), array(201, 22, 63), array(202, 22, 64), array(203, 22, 69), array(204, 22, 72), array(205, 22, 73), array(206, 23, 48), array(207, 23, 55), array(208, 23, 50), array(209, 23, 56), array(210, 23, 63), array(211, 23, 64), array(212, 23, 69), array(213, 23, 72), array(214, 23, 73), array(215, 24, 48), array(216, 24, 50), array(217, 24, 55), array(218, 24, 56), array(219, 24, 63), array(220, 24, 64), array(221, 24, 69), array(222, 24, 72), array(223, 24, 73), array(224, 25, 48), array(225, 25, 50), array(226, 25, 55), array(227, 25, 56), array(228, 25, 63), array(229, 25, 64), array(230, 25, 69), array(231, 25, 72), array(232, 25, 73), array(233, 26, 48), array(234, 26, 50), array(235, 26, 55), array(236, 26, 56), array(237, 26, 63), array(238, 26, 64), array(239, 26, 69), array(240, 26, 72), array(241, 26, 73), array(242, 27, 48), array(243, 27, 50), array(244, 27, 55), array(245, 27, 56), array(246, 27, 63), array(247, 27, 64), array(248, 27, 69), array(249, 27, 72), array(250, 27, 73), array(251, 28, 48), array(252, 28, 50), array(253, 28, 55), array(254, 28, 56), array(255, 28, 63), array(256, 28, 64), array(257, 28, 69), array(258, 28, 72), array(259, 28, 73), array(260, 29, 48), array(261, 29, 50), array(262, 29, 55), array(263, 29, 56), array(264, 29, 63), array(265, 29, 64), array(266, 29, 69), array(267, 29, 72), array(268, 29, 73), array(269, 30, 48), array(270, 30, 50), array(271, 30, 55), array(272, 30, 56), array(273, 30, 63), array(274, 30, 64), array(275, 30, 73), array(276, 30, 69), array(277, 30, 72), array(278, 31, 48), array(279, 31, 50), array(280, 31, 55), array(281, 31, 56), array(282, 31, 63), array(283, 31, 64), array(284, 31, 69), array(285, 31, 72), array(286, 31, 73), array(287, 32, 48), array(288, 32, 50), array(289, 32, 55), array(290, 32, 56), array(291, 32, 63), array(292, 32, 64), array(293, 32, 69), array(294, 32, 72), array(295, 32, 73), array(296, 33, 48), array(297, 33, 50), array(298, 33, 55), array(299, 33, 56), array(300, 33, 63), array(301, 33, 64), array(302, 33, 69), array(303, 33, 72), array(304, 33, 73), array(305, 34, 48), array(306, 34, 50), array(307, 34, 55), array(308, 34, 56), array(309, 34, 63), array(310, 34, 64), array(311, 34, 69), array(312, 34, 72), array(313, 34, 73), array(314, 35, 48), array(315, 35, 50), array(316, 35, 55), array(317, 35, 56), array(318, 35, 63), array(319, 35, 64), array(320, 35, 69), array(321, 35, 72), array(322, 35, 73), array(323, 36, 48), array(324, 36, 50), array(325, 36, 55), array(326, 36, 56), array(327, 36, 63), array(328, 36, 64), array(329, 36, 69), array(330, 36, 72), array(331, 36, 73), array(332, 37, 48), array(333, 37, 50), array(334, 37, 55), array(335, 37, 56), array(336, 37, 63), array(337, 37, 64), array(338, 37, 69), array(339, 37, 72), array(340, 37, 73), array(341, 38, 48), array(342, 38, 50), array(343, 38, 55), array(344, 38, 56), array(345, 38, 63), array(346, 38, 64), array(347, 38, 69), array(348, 38, 72), array(349, 38, 73), array(350, 39, 48), array(351, 39, 50), array(352, 39, 55), array(353, 39, 56), array(354, 39, 63), array(355, 39, 64), array(356, 39, 72), array(357, 39, 73), array(358, 39, 69), array(359, 40, 48), array(360, 40, 50), array(361, 40, 56), array(362, 40, 55), array(363, 40, 63), array(364, 40, 64), array(365, 40, 69), array(366, 40, 72), array(367, 40, 73), array(368, 41, 48), array(369, 41, 50), array(370, 41, 55), array(371, 41, 56), array(372, 41, 63), array(373, 41, 64), array(374, 41, 69), array(375, 41, 72), array(376, 41, 73), array(377, 45, 18), array(378, 45, 39), array(379, 45, 49), array(380, 45, 32), array(381, 45, 85), array(382, 46, 68), array(383, 47, 62), array(384, 49, 70), array(385, 50, 53), array(386, 51, 24), array(387, 52, 80), array(388, 53, 86));
     $em = $this->container->get('doctrine')->getEntityManager('default');
     foreach ($seccionEstu as $data) {
         $entitySeccionEstu = new SeccionEstu();
         //$entitySeccionEstu->setId($data[0]);
         $entityPersona = $em->getRepository('AppBundle:Persona')->find($data[1]);
         $entitySeccionEstu->setPersona($entityPersona);
         $entitySeccion = $em->getRepository('AppBundle:Seccion')->find($data[2]);
         $entitySeccionEstu->setSecc($entitySeccion);
         $manager->persist($entitySeccionEstu);
     }
     $manager->flush();
 }
 /**
  * Create || Update a SeccionEstu entity.
  *
  * @View(serializerEnableMaxDepthChecks=true)
  *
  * @param Request $request
  *
  * @return Response
  *
  */
 public function postAsigAction(Request $request)
 {
     $secc = $request->request->get('secc');
     $estus = $request->request->get('persona');
     $em = $this->getDoctrine()->getManager();
     $entitySeccionEstu = $em->getRepository('AppBundle:SeccionEstu')->findBy(array('secc' => $secc));
     $seccionEstuIds = array();
     foreach ($entitySeccionEstu as $key => $enti) {
         $idPersona = $enti->getPersona()->getId();
         if (in_array($idPersona, $estus)) {
             if (($key = array_search($idPersona, $estus)) !== false) {
                 unset($estus[$key]);
             }
         } else {
             $seccionEstuIds[] = $enti;
         }
     }
     //delete entity
     foreach ($seccionEstuIds as $key => $value) {
         $em->remove($value);
     }
     if ($seccionEstuIds) {
         $em->flush();
     }
     //add entity Estudiante
     $seccEstus = array();
     foreach ($estus as $key => $value) {
         $entityPersona = $em->getRepository('AppBundle:Persona')->find($value);
         if ($entityPersona) {
             $entitySeccion = $em->getRepository('AppBundle:Seccion')->find($secc);
             $entitySeccionEstu = new SeccionEstu();
             $entitySeccionEstu->setSecc($entitySeccion);
             $entitySeccionEstu->setPersona($entityPersona);
             $em->persist($entitySeccionEstu);
             array_push($seccEstus, $entitySeccionEstu);
         }
     }
     if (count($estus)) {
         $em->flush();
     }
     return $seccEstus;
 }