/** * @param \Eccube\Entity\Member $Member * @return bool */ public function delete(\Eccube\Entity\Member $Member) { $em = $this->getEntityManager(); $em->getConnection()->beginTransaction(); try { $rank = $Member->getRank(); $em->createQueryBuilder()->update('Eccube\\Entity\\Member', 'm')->set('m.rank', 'm.rank - 1')->where('m.rank > :rank')->setParameter('rank', $rank)->getQuery()->execute(); $Member->setDelFlg(1)->setRank(0); $em->persist($Member); $em->flush(); $em->getConnection()->commit(); } catch (\Exception $e) { $em->getConnection()->rollback(); return false; } return true; }
/** * {@inheritDoc} */ public function getRank() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRank', array()); return parent::getRank(); }