/** * @param null|TblIdentification $tblIdentification */ public function setTblIdentification(TblIdentification $tblIdentification = null) { $this->tblIdentification = null === $tblIdentification ? null : $tblIdentification->getId(); }
/** * @param string $Username * @param string $Password * @param TblIdentification $tblIdentification * * @return bool|TblAccount */ public function getAccountByCredential($Username, $Password, TblIdentification $tblIdentification = null) { $tblAccount = $this->Connection->getEntityManager()->getEntity('TblAccount')->findOneBy(array(TblAccount::ATTR_USERNAME => $Username, TblAccount::ATTR_PASSWORD => hash('sha256', $Password))); // Account not available if (null === $tblAccount) { return false; } $tblAuthentication = $this->Connection->getEntityManager()->getEntity('TblAuthentication')->findOneBy(array(TblAuthentication::ATTR_TBL_ACCOUNT => $tblAccount->getId(), TblAuthentication::ATTR_TBL_IDENTIFICATION => $tblIdentification->getId())); // Identification not valid if (null === $tblAuthentication) { return false; } return $tblAccount; }