title: Symfony How Get ID Inside of Controller
body: <p>I am still learning symfony, so any help with this issue would be great!</p>
  
  <p>I have 3 tables: Reconciliation, ReconciliationItems, and Products.</p>
  
  <p>Reconciliation stores all my reconciliation reports.</p>
  
  <p>ReconciliationItems stores all the items that go into the reports.</p>
  
  <p>Products stores all the product information for the ReconciliationItems.</p>
  
  <p><strong>ReconciliationItems Table Basic Layout</strong></p>
  
  <pre><code> --------------------------------------
   id | product_id | reconciliation_id | 
   --------------------------------------
   1  | 1000       | 4                 |
   --------------------------------------
  </code></pre>
  
  <p>id = id in the reconciliationItems table.</p>
  
  <p>product_id = relates to the id in the products table. This column uses a many to one relationship to grab the id when I persist the data it to the db. </p>
  
  <p>reconciliation_id = relates to the id in the reconciliation table</p>
  
  <p><strong>My issue is:</strong> </p>
  
  <p>I am not able to directly grab the "product_id" inside of my controller when I access the repository for "ReconciliationItems". </p>
  
  <p><strong>Here is my code:</strong> </p>
  
  <pre><code> $getReconciliationRecords = $em-&gt;getRepository('WICReconciliationItemBundle:ReconciliationItem')-&gt;find(1);
   echo $productId = getReconciliationRecords-&gt;getProduct();
  </code></pre>
  
  <p><strong>Here is the error I get:</strong></p>
  
  <pre><code> Catchable Fatal Error: Object of class Proxies\__CG__\WIC\ProductBundle\Entity\Product could not be converted to string in /Applications/MAMP/htdocs/symfonydev/src/WIC/ReconciliationBundle/Controller/ReconciliationController.php line 187
  </code></pre>
  
  <p>I am sure that I am not able to grab the product_id directly from the ReconciliationItems table because the data for that information is stored in an object. I am just not sure how to get the object data to get my product id. Please educate me :)</p>
  
  <p>Thanks for any help that you guys can provide!</p>