<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu Jun 20 06:10:36 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-1048/DDC-1048.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-1048] Boolean type issue</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1048</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;m having issues working with Doctrine2 boolean type. My mapping is basic:	&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;	/**
	 * @orm:Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;&quot;&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, name=&lt;span class=&quot;code-quote&quot;&gt;&quot;is_deleted&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $isDeleted;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When I&apos;m trying to flush the object with $isDeleted=false (or true), the entity is not being added to the db. However when I set  $isDeleted=&apos;0&apos; (or &apos;1&apos;) everything works fine.&lt;/p&gt;

&lt;p&gt;I saw plenty of examples where people were using true and false, instead of &apos;0&apos; and &apos;1&apos;. But with MySQL it doesn&apos;t work. Doctrine maps boolean field as TINYINT(1) in MySQL.  And I can see in Symfony2 Profiler the parameter in the query is &quot;false&quot;/&quot;true&quot;, so here is data type conflict.&lt;/p&gt;

&lt;p&gt;Doctrine doesn&apos;t transform true/false to 1/0 values.&lt;/p&gt;</description>
                <environment>MySQL, pdo_mysql, Symfony2</environment>
            <key id="12432">DDC-1048</key>
            <summary>Boolean type issue</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="5">Cannot Reproduce</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="websirnik">Nikita Korotaev</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Feb 2011 11:32:39 +0000</created>
                <updated>Fri, 12 Apr 2013 01:10:32 +0000</updated>
                    <resolved>Thu, 15 Mar 2012 21:46:08 +0000</resolved>
                            <version>2.0</version>
                                                <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="15454" author="beberlei" created="Fri, 4 Mar 2011 17:09:02 +0000"  >&lt;p&gt;Boolean works fine for me with MySQL since forever, i cannot reproduce this. Can you come up with a reproducable test-case in our Testsuite? Otherwise odds are pretty slim to fix this, as i need to see whats happening.&lt;/p&gt;</comment>
                    <comment id="15457" author="websirnik" created="Fri, 4 Mar 2011 18:29:31 +0000"  >&lt;p&gt;Sorry don&apos;t know how to use your Testsuite.&lt;/p&gt;

&lt;p&gt;So basically what I have:&lt;/p&gt;

&lt;p&gt;Symfony 2 PR6 standard sandbox with the following config:&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;doctrine:
   dbal:
       dbname:   shop
       user:     root
       password: ~
       logging:  %kernel.debug%
   orm:
       auto_generate_proxy_classes: %kernel.debug%
       mappings:
           HelloBundle: ~
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then I have simple entity:&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;&amp;lt;?php

namespace Sensio\HelloBundle\Entity;

/**
 * @orm:Entity()
 * @orm:Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;product&quot;&lt;/span&gt;)
 */
class Product
{
    /**
     * @orm:Id
     * @orm:GeneratedValue
     * @orm:Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;

    /** @orm:Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;text&quot;&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $name;

    
    /** @orm:Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;&quot;&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $inStock;
    
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getId()
    {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setName($name)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;name = $name;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getName()
    {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;name;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setInStock($inStock)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;inStock = $inStock;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getInStock()
    {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;inStock;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run the following commands:&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;php app/console doctrine:database:create
php app/console doctrine:schema:create
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And finally I have simple action in the HelloController:&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;&amp;lt;?php

namespace Sensio\HelloBundle\Controller;

use Sensio\HelloBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class HelloController &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Controller
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function indexAction($name)
    {
         $product = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Product();
         $product-&amp;gt;setName($name);
         $product-&amp;gt;setInStock(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
		
         $em = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;get(&apos;doctrine.orm.default_entity_manager&apos;);
         $em-&amp;gt;persist($product);
         $em-&amp;gt;flush();

         &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;render(&apos;HelloBundle:Hello:index.html.twig&apos;, array(&apos;name&apos; =&amp;gt; $name));

    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Go to the &lt;a href=&quot;http://localhost/web/app_dev.php/hello/Product1&quot; class=&quot;external-link&quot;&gt;http://localhost/web/app_dev.php/hello/Product1&lt;/a&gt;&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
When I set &apos;true&apos; for inStock attribute, and then flush object to the DB, it doesn&apos;t create a row. However when I write $product-&amp;gt;setInStock(&apos;1&apos;) - that&apos;s works and the row appears in the DB. And $product-&amp;gt;setInStock(1) that&apos;s doen&apos;t work again. That&apos;s a very strange behaviour, and I couldn&apos;t explain it anyhow.&lt;/p&gt;</comment>
                    <comment id="16585" author="beberlei" created="Sat, 15 Oct 2011 08:25:02 +0000"  >&lt;p&gt;This is pretty old. Do you still use boolean types and does it work? The code suggests you maybe used Doctrine 2.0.x back then, does this work with Doctrine 2.1.x for you?&lt;/p&gt;</comment>
                    <comment id="16780" author="asm89" created="Tue, 8 Nov 2011 22:11:46 +0000"  >&lt;p&gt;Lowered the priority of this issue until we receive more feedback. &lt;/p&gt;</comment>
                    <comment id="17598" author="asm89" created="Thu, 15 Mar 2012 21:46:08 +0000"  >&lt;p&gt;Closing because we were unable to reproduce and no further feedback was provided.&lt;/p&gt;</comment>
                    <comment id="17942" author="wildlyinaccurate" created="Sun, 13 May 2012 17:33:08 +0000"  >&lt;p&gt;Hi guys, I was able to reproduce similar behaviour. Simply adding a boolean column to an entity prevents Doctrine from persisting new entities to the database. I am using a freshly-checked-out 2.2.2 with the Laravel PHP framework. Boolean columns have worked for me previously and I wondered whether Laravel&apos;s autoloaders were interfering with Doctrine somehow (just a stab in the dark).&lt;/p&gt;

&lt;p&gt;Here is my Test entity:&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;&amp;lt;?php

namespace Entity;

/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;test_entry&quot;&lt;/span&gt;)
 */
class Test
{

        /**
         * @Id
         * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
         * @GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
         */
        &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;

        /**
         * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, length=40, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
         */
        &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $string_col;

        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getId()
        {
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id;
        }

        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setStringCol($string_col)
        {
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;string_col = $string_col;
        }

        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getStringCol()
        {
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;string_col;
        }

}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Persisting a new Test entity like this works fine.&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;$test = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Entity\Test;
$test-&amp;gt;setStringCol(&apos;&lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; value&apos;);
$em-&amp;gt;persist($test);
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However, if I add a boolean column to the entity, the persist/flush operations seem to fail silently and the record is not inserted. The boolean column looks like this:&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;/**
 * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;&quot;&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
 */
&lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $bool_col = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="17943" author="wildlyinaccurate" created="Sun, 13 May 2012 17:35:01 +0000"  >&lt;p&gt;Sorry, forgot to say that explicitly setting the value of bool_col doesn&apos;t make a difference. I have also tried setting the value to (int) 1 or 0, with the same results.&lt;/p&gt;</comment>
                    <comment id="18026" author="tobre" created="Tue, 29 May 2012 11:40:01 +0000"  >&lt;p&gt;My development environment is Ubuntu Linux, these boolean types is working well. After new developer put project up on his Windows 7 WAMP machine exactly the same problem happened.&lt;br/&gt;
Firstly thought that MySQL is acting differently, but no, we connected MySQL to Linux server, still same problem. The solution was to replace boolean types to integers.&lt;/p&gt;

&lt;p&gt;So perhaps you couldn&apos;t reproduce it because you tested it in Linux. You should run the same test on the Windows machine.&lt;/p&gt;</comment>
                    <comment id="19159" author="piotrjura" created="Thu, 20 Dec 2012 11:26:01 +0000"  >&lt;p&gt;Run into same problem here with Doctrine 2.3.x and MySQL 5.5.16 running on Windows 7 with Symfony2. Using query builder:&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;
-&amp;gt;where($qb-&amp;gt;expr()-&amp;gt;eq(&apos;c.&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt;&apos;, &apos;&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;&apos;))
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I have to use literal &apos;false&apos; or 0.&lt;/p&gt;</comment>
                    <comment id="19943" author="cordoval" created="Fri, 5 Apr 2013 05:55:27 +0000"  >&lt;p&gt;@beberlei @ocramius this should be reopened it is a present bug on 2.3+, i had the same problem rolled back and it works again.&lt;/p&gt;</comment>
                    <comment id="19944" author="ocramius" created="Fri, 5 Apr 2013 07:52:48 +0000"  >&lt;p&gt;Won&apos;t reopen without failing test case&lt;/p&gt;</comment>
                    <comment id="19971" author="cordoval" created="Wed, 10 Apr 2013 03:36:38 +0000"  >&lt;p&gt;&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/647&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/647&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="19984" author="ocramius" created="Fri, 12 Apr 2013 01:10:32 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=cordoval&quot; class=&quot;user-hover&quot; rel=&quot;cordoval&quot;&gt;Luis Cordova&lt;/a&gt; your test is not related with this issue :\&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                <outwardlinks description="relates to">
                            <issuelink>
            <issuekey id="13045">DDC-1394</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>