私はPHPの初心者です。私はWadoService
サービスとStudiesRestController
コントローラを持っています。私はこのサービスでコントローラデータを使用したいと思います。サービスで使用可能な変数
public function getPatientAction(Request $request, $studyUID)
{
$studyRepository = new StudyRepository(
$this->get('nexus_db'),
$this->get('logger'),
$this->get('translator')
);
$study = $studyRepository->getStudy($studyUID);
if (!$study) {
throw new NotFoundHttpException("No study found with studyuid $studyUID");
}
$patientInfo = new RestResponse(
SerializerBuilder::create()
->build()
->serialize($study->getPatient(), 'json')
);
return $patientInfo;
}
これは可能ですか?私は結果なしで機能getPatientAction()
でこれを入れて試してみました:
/* @var $wadoService WadoService */
$wadoService = $this->container->get(WadoService::SERVICE_NAME);
$wadoService = new RestResponse(
SerializerBuilder::create()
->build()
->serialize($study->getPatient(), 'json')
);
あなたはどの技術を使用していますか? Drupal 8? Symfony?ラーヴェル? – teeyo
あなたが何を求めているのかは不明です。投稿したコード例は、質問に関連していません。 – SirDarius
@teeyo 私はSymfonyを使用しています。 – Floriane