所以我有一个实验实体,它有许多RNASeq实体.但是,当我尝试使用RNASeq条目(通过newAction)保存实验时,只保存实验部分.
我的控制器如下:
<?php
// src/AppBundle/Controller/ExperimentController.php
namespace AppBundle\Controller;
use AppBundle\Entity\Experiment;
use AppBundle\Entity\RNASeq;
use AppBundle\Form\Type\ExperimentType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
// TODO: deleteAction should be implemented.
class ExperimentController extends Controller {
/**
* @Route("/experiment/index", name="experiment_index")
*/
public function indexAction() {
// Grab all experiments from database and hand them to template.
$repository = $this->getDoctrine()->getRepository('AppBundle:Experiment');
$experiments = $repository->findAll();
return $this->render('experiment/index.html.twig',['experiments' => $experiments]);
}
/**
* @Route("/experiment/new", name="experiment_new")
*/
public function newAction(Request $request) {
$experiment = new Experiment();
$form …Run Code Online (Sandbox Code Playgroud)