Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically, you want to create a S2 service and inject your entity manager into it. Plenty of examples in the manual though I could post one if you really needed it.</p> <p>Repositories are great when dealing with one entity type but, as you found out, not so much when dealing with multiple types. I seldom them use them anymore. Just wrap up the functionality in a service.</p> <p>The INSERT ... ON DUPLICATE KEY UPDATE is unfortunately not standard sql and thus not supported by Doctrine though you could possible add it as a custom function. But your best bet is to just check to see if the key exists and then adjust accordingly. Be sure to catch any exceptions just in case.</p> <p>I didn't really go through your code in any detail but S2 does have a bunch of translation stuff in it. It's possible that some of it may help as well.</p> <p>UPDATE:</p> <p>Info on creating services can be found here: <a href="http://symfony.com/doc/current/book/service_container.html" rel="nofollow">http://symfony.com/doc/current/book/service_container.html</a></p> <p>In your services.xml file you might have something like:</p> <pre><code>&lt;service id="zayso.core.project.manager" class="Zayso\ZaysoBundle\Component\Manager\ProjectManager" public="true"&gt; &lt;argument type="service" id="doctrine.orm.entity_manager" /&gt; &lt;/service&gt; </code></pre> <p>You manager would have a __construct like:</p> <pre><code>class ProjectManager { protected $em = null; public function getEntityManager() { return $this-&gt;em; } public function __construct($em) { $this-&gt;em = $em; } </code></pre> <p>And then in your controller you would do something like:</p> <pre><code>$manager = $this-&gt;get(zayso.core.project.manager); $manager-&gt;newLogEntry($params); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload