-2
QueryBuilder를 사용자 정의 단축키 함수와 함께 사용하고 싶습니다. exemple 들어 는 :symfony에서 doctrine QueryBuilder 클래스를 확장하는 가장 좋은 방법
$this->createQueryBuilder('post')->where(...)->andwhere(...)
사용 뭔가 같은 : 대신 내 환매 특약에 쓰기의
isPublished()
여러 querybuilder 기능 (
->where(...)->andwhere(...)
)
에 대한 shorcut 방법의 종류
$this->createQueryBuilder('post')->isPublished()
입니다
Thx 사전에 도움을 받으십시오.
. 대신에 메서드/함수'isPublished (QueryBuilder $ qb)'를 시체가'$ qb-> where (...) -> andwhere (...) '로 부른다. 이 방법으로 코드를 재사용 할 수 있습니다. 이것은 내가 생각하기에, 당신이하고 싶은 코드입니다. –
@JanMares와 마찬가지로, 이렇게하려면 저장소 기능을 만드십시오. – Richard