/** * @param \Eccube\Entity\Member $Member * @return bool */ public function save(\Eccube\Entity\Member $Member) { $em = $this->getEntityManager(); $em->getConnection()->beginTransaction(); try { if (!$Member->getId()) { $rank = $this->createQueryBuilder('m')->select('MAX(m.rank)')->getQuery()->getSingleScalarResult(); if (!$rank) { $rank = 0; } $Member->setRank($rank + 1)->setDelFlg(0)->setSalt($this->createSalt(5)); } $em->persist($Member); $em->flush(); $em->getConnection()->commit(); } catch (\Exception $e) { $em->getConnection()->rollback(); return false; } return true; }
/** * {@inheritDoc} */ public function getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); }