0

私の質問は簡単ですが、解決策がありません。

カスタム クエリを作成して ShowFields を構成するにはどうすればよいですか?

したがって、configureListFields にはcreateQuery($context = 'list')関数があります... 同様のケースで、カスタム クエリを作成したいのですが、configureShowFields で行います。

4

1 に答える 1

0

私はこれを解決します:

これを行うための特定の関数が見つかりません。また、コントローラーで次のような関数showActionを作成します。

public function showAction($id = null) {
    $id = $this->get('request')->get($this->admin->getIdParameter());

    $object = $this->admin->getObject($id);
    $em = $this->getDoctrine()->getManager();

    if (!$object) {
        throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
    }

    if (false === $this->admin->isGranted('VIEW', $object)) {
        throw new AccessDeniedException();
    }
    $user = $em->getRepository('EsolvingEschoolUserBundle:User')->findOneByUserIdByLanguage($object->getId(), $this->getRequest()->getLocale());

    $this->admin->setSubject($object);

    return $this->render($this->admin->getTemplate('show'), array(
                'action' => 'show',
                'object' => $user,
                'elements' => $this->admin->getShow(),
    ));
}

だから私のリポジトリで私は私のカスタムクエリを行い、私は解決策を投稿しました、多分私が助けてくれる誰か

于 2013-02-20T03:52:36.023 に答える