<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Mon May 20 14:32:17 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/DC-362/DC-362.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>[DC-362] Doctrine fails to create correct table structure if model is named &quot;User&quot;</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-362</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When building models and database structure from YAML schema, Doctrine ignores the behaviors and relations on models if it is named &quot;User&quot;:&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-none&quot;&gt;...

User:  
  actAs:
    Timestampable:
    Sluggable:
      unique: true
      fields: username
      canUpdate: true
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    company_id
      type: integer(4)
    timezone_id:
      type: integer(1)
    role_id:
      type: integer(1)
    email:
      type: string(255)
    username:
      type: string(255)
      unique: true
    password:
      type: string(40)
    firstname:
      type: string(255)
    lastname:
      type: string(255)
    last_login:
      type: datetime
  relations:
    Company:
      local: company_id
      foreign: id
    Timezone:
      local: timezone_id
      foreign: id
    Role:
      local: role_id
      foreign: id

...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This creates the following table structure:&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-sql&quot;&gt;CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) DEFAULT NULL,
  `timezone_id` tinyint(4) DEFAULT NULL,
  `role_id` tinyint(4) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `password` varchar(40) DEFAULT NULL,
  `firstname` varchar(255) DEFAULT NULL,
  `lastname` varchar(255) DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The table structure is both missing foreign key constraints to Company, Timezone and Role. It is also missing columns &lt;tt&gt;updated_at&lt;/tt&gt; and &lt;tt&gt;created_at&lt;/tt&gt; for Timestampable behavior. The &lt;tt&gt;slug&lt;/tt&gt; column for Sluggable behavior is missing, as well.&lt;/p&gt;

&lt;p&gt;When looking at the BaseUser::setUp() method it looks as it is supposed to:&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-none&quot;&gt;class BaseUser extends Doctrine_Record
{

    ....

    public function setUp()
    {
        parent::setUp();
        $this-&amp;gt;hasOne(&apos;Company&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;company_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $this-&amp;gt;hasOne(&apos;Timezone&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;timezone_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $this-&amp;gt;hasOne(&apos;Role&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;role_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $sluggable0 = new Doctrine_Template_Sluggable(array(
             &apos;unique&apos; =&amp;gt; true,
             &apos;fields&apos; =&amp;gt; &apos;username&apos;,
             &apos;canUpdate&apos; =&amp;gt; true,
        ));
        $this-&amp;gt;actAs($timestampable0);
        $this-&amp;gt;actAs($sluggable0);
    }

    ....

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

&lt;p&gt;So the only area where it goes wrong, is when generating the queries for creating the model tables. I don&apos;t know if the same problem appears with other model names, but it doesn&apos;t like models named &quot;User&quot;.&lt;/p&gt;

&lt;p&gt;If I rename the model to &quot;Person&quot; and rebuild, it all works perfectly as it should.&lt;/p&gt;</description>
                <environment>Mac OS X 10.6.2 (10C540) (Snow Leopard) with MAMP 1.8 bundle: &lt;br/&gt;
PHP Version: 5.2.10,&lt;br/&gt;
MySQL Version: 5.1.37&lt;br/&gt;
</environment>
            <key id="10623">DC-362</key>
            <summary>Doctrine fails to create correct table structure if model is named &quot;User&quot;</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="michenriksen">Michael Henriksen</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Dec 2009 13:59:26 +0000</created>
                <updated>Fri, 8 Jan 2010 20:31:09 +0000</updated>
                                    <version>1.2.0-RC1</version>
                                                <component>Behaviors</component>
                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11201" author="michenriksen" created="Wed, 16 Dec 2009 14:04:39 +0000"  >&lt;p&gt;Forgot to mention, that it works perfectly when renaming model to something else than &quot;User&quot;&lt;/p&gt;</comment>
                    <comment id="11357" author="neographikal" created="Fri, 8 Jan 2010 20:31:09 +0000"  >&lt;p&gt;Have the same problem in 1.2.1 at PostgreSQL 8.4&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>