<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 20:32:47 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://doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-2012/DDC-2012.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://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-2012] Inserting a new entity with a custom mapping type does not call convertToDatabaseValueSQL() when using InheritanceType(&quot;JOINED&quot;)</title>
                <link>http://doctrine-project.org/jira/browse/DDC-2012</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When using class type inheritance - @InheritanceType(&quot;JOINED&quot;) and inserting new entity with a custom mapping type, custom type method convertToDatabaseValueSQL() is never called.&lt;/p&gt;

&lt;p&gt;Here is sample class mapping:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt; 
/**
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;item&quot;&lt;/span&gt;)
 * @Entity
 * @InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;JOINED&quot;&lt;/span&gt;)
 * @DiscriminatorColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;type_id&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;smallint&quot;&lt;/span&gt;)
 * @DiscriminatorMap({1 = &lt;span class=&quot;code-quote&quot;&gt;&quot;ItemPerson&quot;&lt;/span&gt;})
 */
class Item {

	/**
	 * @Column(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;tsv&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;tsvector&quot;&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $tsv;
}

/**
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;item_person&quot;&lt;/span&gt;)
 * @Entity
 */
class ItemPerson &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Item
{
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;I am using the same custom TsvectorType with simple entities and even Mapped Superclasses and it works perfectly, however on InheritanceType(&quot;JOINED&quot;) method convertToDatabaseValueSQL() is never called :/&lt;br/&gt;
Hope someone knows how to fix this. &lt;br/&gt;
Thank you.&lt;/p&gt;
</description>
                <environment>PHP</environment>
            <key id="14012">DDC-2012</key>
            <summary>Inserting a new entity with a custom mapping type does not call convertToDatabaseValueSQL() when using InheritanceType(&quot;JOINED&quot;)</summary>
                <type id="1" iconUrl="http://doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="5" iconUrl="http://doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="fabio.bat.silva">Fabio B. Silva</assignee>
                                <reporter username="darklow">Kaspars Spro&#291;is</reporter>
                        <labels>
                    </labels>
                <created>Tue, 4 Sep 2012 10:02:03 +0000</created>
                <updated>Wed, 3 Oct 2012 11:57:09 +0000</updated>
                    <resolved>Wed, 3 Oct 2012 10:52:45 +0000</resolved>
                            <version>2.2.3</version>
                                <fixVersion>2.2.4</fixVersion>
                <fixVersion>2.3.1</fixVersion>
                                <component>Mapping Drivers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18704" author="fabio.bat.silva" created="Mon, 24 Sep 2012 00:00:03 +0000"  >&lt;p&gt;Hi Kaspars,&lt;/p&gt;


&lt;p&gt;I can&apos;t reproduce, &lt;br/&gt;
Could you change the added testcase and try to make it fails ?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="18735" author="darklow" created="Wed, 26 Sep 2012 16:26:25 +0000"  >&lt;p&gt;@Fabio thanks for looking into my problem&lt;br/&gt;
I attached test where you can detect the problem.&lt;/p&gt;

&lt;p&gt;It was quite strange, all i did was changed column that uses custom type to array and some minimal convertToDatabaseValue and convertToDatabaseValueSQL logic and convertToDatabaseValueSQL was never called. &lt;/p&gt;

&lt;p&gt;One more thing i noticed, this bug only appears on persist and not on merge. &lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="18741" author="fabio.bat.silva" created="Sat, 29 Sep 2012 17:57:34 +0000"  >&lt;p&gt;Thanks Kaspars &lt;img class=&quot;emoticon&quot; src=&quot;http://doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;But sorry, I dont get your use case.&lt;/p&gt;

&lt;p&gt;Notice that convertToDatabaseValueSQL is called just when using queries to find a object by a especific columns which is your mapping type.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://docs.doctrine-project.org/en/2.1/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html#the-mapping-type&quot; class=&quot;external-link&quot;&gt;http://docs.doctrine-project.org/en/2.1/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html#the-mapping-type&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="18743" author="darklow" created="Sat, 29 Sep 2012 22:15:09 +0000"  >&lt;p&gt;I am using PostgreSQL tsvector data type for full text search.&lt;/p&gt;

&lt;p&gt;Here is my tsvector custom data type class:&lt;br/&gt;
&lt;a href=&quot;https://gist.github.com/3129096&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/3129096&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only way to update this field in postgresql is to use postgresql function to_tsvector(&apos;some text&apos;).&lt;br/&gt;
And everything works fine, if i persist simple entity, this method transforms insert query as needed:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
	&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; sprintf(&apos;to_tsvector(%s)&apos;, $sqlExpr);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But when i use inheritance, then by some reason convertToDatabaseValueSQL method is not called and tsv field is updated with simple text as returned by convertToDatabaseValue() method.&lt;br/&gt;
I modified the Ticket Test so that you can see exact moment of when it is not called, which is exactly my problem.&lt;/p&gt;

&lt;p&gt;Here is the result after persisting (for persist it failed)&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$person = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ItemPerson();
$person-&amp;gt;setName(&apos;some words &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; test&apos;);
$em-&amp;gt;persist($person);
$em-&amp;gt;flush();

DB Result:
Name                | Tsv
--------------------|------------------------------------
some words &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; test | &apos;&lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt;&apos; &apos;some&apos; &apos;test&apos; &apos;words&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here is the result after second time update (now by tsv format you can see it worked):&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$person-&amp;gt;setName(&apos;some more words &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; test&apos;);
$em-&amp;gt;flush();

DB Result:
Name                | Tsv
--------------------|------------------------------------
some words &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; test | &apos;test&apos;:5 &apos;word&apos;:3
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="18744" author="fabio.bat.silva" created="Sun, 30 Sep 2012 18:32:40 +0000"  >&lt;p&gt;Thanks Kaspars&lt;/p&gt;

&lt;p&gt;Now i saw the problem&lt;/p&gt;

&lt;p&gt;Writing a patch ...&lt;/p&gt;</comment>
                    <comment id="18766" author="darklow" created="Wed, 3 Oct 2012 11:07:02 +0000"  >&lt;p&gt;Just tested fixed version and everything works perfectly now.&lt;br/&gt;
Thank you!&lt;/p&gt;</comment>
                    <comment id="18767" author="fabio.bat.silva" created="Wed, 3 Oct 2012 11:57:09 +0000"  >&lt;p&gt;Fixed by : &lt;a href=&quot;https://github.com/doctrine/doctrine2/commit/91caff1d8965c20b72d5fdd04ffadf3ab063c1ba&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/commit/91caff1d8965c20b72d5fdd04ffadf3ab063c1ba&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11327" name="DDC2012Test.php" size="4473" author="darklow" created="Wed, 26 Sep 2012 16:24:17 +0000" />
                    <attachment id="11326" name="DDC2012Test.php" size="4372" author="fabio.bat.silva" created="Mon, 24 Sep 2012 00:00:03 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>