title: composite and foreign keys as primary key doctrine 2 + zend framework 2
body: <p>I have been wondering why my mappings and the controller actions are not working. For this I need to refer to my previous post, where I have described my entities and database schema, which can be found <a href="https://stackoverflow.com/questions/12693023/save-entities-in-database-using-one-to-many-relationship-using-doctrine-2-and-ze">here</a>. I need to start a new post since there were no further updates and I thought this the only way to get attention of the Doctrine + Zend Pros. </p>
  
  <p>As described in my previous post, I have a Zend Form, the user can enter teamId and teamName, further he has the choice to select multiple players from the drop down list on the form and can allocate players to the team. So basically that is my goal to achieve with Doctrine and Zend. For that I wrote my entities described in the previous post and right now I want to add the code from my controller to persist the entities. </p>
  
  <p>Controller:</p>
  
  <pre><code> public function addAction()
      {
          $form = new TeamForm($this-&gt;getEntityManager());
  
          $form-&gt;get('submit')-&gt;setAttribute('value', 'Add');
  
          $request = $this-&gt;getRequest();
  
          if ($request-&gt;isPost())
          {
              $team = new Team();
              $player = new Player();
              $teamPlayers = new TeamPlayer();
  
              $form-&gt;setInputFilter($typeset-&gt;getInputFilter());
  
              $form-&gt;setData($request-&gt;getPost());
  
              if ($form-&gt;isValid())
              {
                  $team-&gt;populate($form-&gt;getData());
  
                  $teamPlayers-&gt;setPlayer($player);
                  $teamPlayers-&gt;setTeam($team);
  
                  $this-&gt;getEntityManager()-&gt;persist($teamPlayers);
  
                  $this-&gt;getEntityManager()-&gt;flush();
  
                 //Reroute to the index page once the data is successfully added
              }
          }
          //return form array
          return array(
              'form' =&gt; $form
              );
      }
  </code></pre>
  
  <p>So that is basically what Im doing in my controller to save the entities into two tables (team Table and teamPlayer Table), as already the player Table is populated with data. So I want to add players to the team and assign that values in these two tables.</p>
  
  <p>Right now I can see my form and when I enter the data and press submit nothing is happening, i can see the form with no action. When the data is successfully saved into the database then I reroute it to the index page which is not happening. </p>
  
  <p>Any help would be appreciated, to point out the error Im making either in mapping section or in the controller side.</p>
  
  <p>The official documentation especially from Doctrine 2 is too global and is particulary not that clear for my requirement. </p>