コード例 #1
0
 /**
  * Delete maker (del flg).
  *
  * @param Maker $Maker
  *
  * @return bool
  */
 public function delete(Maker $Maker)
 {
     $em = $this->getEntityManager();
     try {
         $Maker->setDelFlg(Constant::ENABLED);
         $em->persist($Maker);
         $em->flush($Maker);
     } catch (\Exception $e) {
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * Create maker
  *
  * @param int $rank
  *
  * @return Maker
  */
 protected function createMaker($rank = null)
 {
     /**
      * @var Generator $faker
      */
     $faker = $this->getFaker();
     if (!$rank) {
         $rank = $faker->randomNumber(3);
     }
     $Maker = new Maker();
     $Maker->setName($faker->word);
     $Maker->setRank($rank);
     $Maker->setDelFlg(Constant::DISABLED);
     $this->app['orm.em']->persist($Maker);
     $this->app['orm.em']->flush($Maker);
     return $Maker;
 }
コード例 #3
0
 /**
  * @param  \Plugin\Maker\Entity\Maker $Maker
  * @return bool
  */
 public function delete(\Plugin\Maker\Entity\Maker $Maker)
 {
     $em = $this->getEntityManager();
     $em->getConnection()->beginTransaction();
     try {
         $Maker->setDelFlg(1);
         $em->persist($Maker);
         $em->flush();
         $em->getConnection()->commit();
     } catch (\Exception $e) {
         $em->getConnection()->rollback();
         return false;
     }
     return true;
 }