<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 06:26:28 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-1716/DDC-1716.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-1716] Better unique constraints handling or even updateIfExists/findOneOrCreate</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1716</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It is too hard handle rows duplication now. As adviced here &lt;a href=&quot;http://stackoverflow.com/questions/3967226/checking-for-duplicate-keys-with-doctrine-2&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/3967226/checking-for-duplicate-keys-with-doctrine-2&lt;/a&gt; we should catch \PDOException with code 23000. This is bad behavior.&lt;/p&gt;

&lt;p&gt;So I propose:&lt;br/&gt;
a. Add DuplicateRowException wich will throwed by flush method (maybe wrapped PDOException) with method &quot;getDuplicatedProperties&quot; (based on sql error description parsing + mapping)&lt;br/&gt;
b. Add method findOneOrCreate (hello, Propel!) or updateIfExists to ObjectInterface, EntityManager&lt;br/&gt;
c. Combine a, b&lt;/p&gt;</description>
                <environment></environment>
            <key id="13542">DDC-1716</key>
            <summary>Better unique constraints handling or even updateIfExists/findOneOrCreate</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="koc">Konstantin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Mar 2012 21:11:04 +0000</created>
                <updated>Thu, 19 Apr 2012 09:15:57 +0000</updated>
                                    <version>2.2.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>5</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="17866" author="dynom" created="Thu, 19 Apr 2012 07:46:36 +0000"  >&lt;p&gt;I don&apos;t think it should be limited to the flush method, however, as this can occur with &quot;custom&quot; queries also. It would be ideal if the errors being generated can be much more easily (read: standardized) caught or read. &lt;/p&gt;

&lt;p&gt;I&apos;m in favor of letting the database handle integrity checks, and not run a query to decide wether or not the update or insert queries will violate. Hence the desire to handle this more gracefully.&lt;/p&gt;</comment>
                    <comment id="17867" author="lucasvanlierop" created="Thu, 19 Apr 2012 09:15:57 +0000"  >&lt;p&gt;The DBAL statement class (&lt;a href=&quot;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Statement.php&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Statement.php&lt;/a&gt;) has and execute method which might be a good place to catch and convert the generic PDOExceptions by wrapping the line&lt;/p&gt;

&lt;p&gt;$stmt = $this-&amp;gt;stmt-&amp;gt;execute($params);&lt;/p&gt;

&lt;p&gt;in a try/catch statement which then calls some kind of PDOException to Doctrine Exception method&lt;/p&gt;




</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>