但是我已经@ORM\Entity(repositoryClass="Repair\StoreBundle\Entity\registrationRepository")
在注册实体中添加了,但我仍然在附近出现错误createQuery()
;
我的registrationRepository.php是
use Doctrine\ORM\EntityRepository;
/**
* registrationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class registrationRepository extends EntityRepository
{
function __construct() {
}
public function auth($name,$password)
{
$em = $this->getEntityManager();
$result = $em->createQuery("SELECT r.username,r.password FROM RepairStoreBundle:registration r where r.username='".$name."' and r.password='".$password."'")->getResult();
return $query;
}
}
我的控制器以这种方式调用
$test = new registrationRepository();
$result = $test->auth($name);