<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 19 03:13:39 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-67/DC-67.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-67] Taggable not working</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-67</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;After enabling Taggable extension, magic methods on the tables (e.g. getPopularTags)&lt;br/&gt;
cannot be reached:&lt;/p&gt;

&lt;p&gt;Doctrine::getTable(&apos;Upload&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;

&lt;p&gt;Fatal error: Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method Doctrine_Table::getPopularTags&apos; in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php:2608 Stack trace: #0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array) #1 C:\Users\user\www\extens.dev\index.php(7): Doctrine_Table-&amp;gt;getPopularTags() #2 &lt;/p&gt;
{main}
&lt;p&gt; thrown in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php on line 2608&lt;/p&gt;</description>
                <environment>PHP 5.2.8, Doctrine 1.2.0 Alpha1, Vista, Sandbox 1.2.0 Alpha1</environment>
            <key id="10118">DC-67</key>
            <summary>Taggable not working</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="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="admirau">admirau</reporter>
                        <labels>
                    </labels>
                <created>Mon, 28 Sep 2009 10:49:57 +0000</created>
                <updated>Thu, 15 Apr 2010 14:50:14 +0000</updated>
                                    <version>1.2.0-ALPHA1</version>
                                                <component>Extensions</component>
                        <due></due>
                    <votes>4</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="10187" author="admirau" created="Thu, 8 Oct 2009 12:16:38 +0000"  >&lt;p&gt;The same with Alpha2&lt;/p&gt;</comment>
                    <comment id="10199" author="admirau" created="Sat, 10 Oct 2009 14:34:25 +0000"  >&lt;p&gt;Running the tests results in one failure:&lt;/p&gt;


&lt;p&gt;Doctrine Unit Tests&lt;br/&gt;
===================&lt;br/&gt;
Doctrine_Template_Taggable_TestCase.............................................failed&lt;/p&gt;


&lt;p&gt;Unexpected Doctrine_Connection_Sqlite_Exception thrown in &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine_Template_Taggable_TestCase&amp;#93;&lt;/span&gt; with message [SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;HY000&amp;#93;&lt;/span&gt;: General error: 1 no such column: a__2] in C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php on line 1067&lt;/p&gt;

&lt;p&gt;Trace&lt;br/&gt;
-------------&lt;/p&gt;

&lt;p&gt;#0 C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php(1015): Doctrine_Connection-&amp;gt;rethrowException(Object(PDOException), Object(Doctrine_Connection_Sqlite))&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(936): Doctrine_Connection-&amp;gt;execute(&apos;SELECT t.id AS ...&apos;, Array)&lt;br/&gt;
#2 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(990): Doctrine_Query_Abstract-&amp;gt;_execute(Array)&lt;br/&gt;
#3 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\lib\Doctrine\Template\TaggableTag.php(76): Doctrine_Query_Abstract-&amp;gt;execute(Array, 2)&lt;br/&gt;
#4 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Template_TaggableTag-&amp;gt;getPopularTagsTableProxy(Array)&lt;br/&gt;
#5 C:\Users\user\www\extens.dev\lib\Doctrine\Record.php(2569): call_user_func_array(Array, Array)&lt;br/&gt;
#6 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Record-&amp;gt;__call(&apos;getPopularTagsT...&apos;, Array)&lt;br/&gt;
#7 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: TaggableTag-&amp;gt;getPopularTagsTableProxy(Array)&lt;br/&gt;
#8 C:\Users\user\www\extens.dev\lib\Doctrine\Table.php(2605): call_user_func_array(Array, Array)&lt;br/&gt;
#9 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#10 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\Template\TaggableTestCase.php(216): Doctrine_Table-&amp;gt;getPopularTags(Array)&lt;br/&gt;
#11 C:\Users\user\www\extens.dev\tests\DoctrineTest\UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase-&amp;gt;testGetPopularTags()&lt;br/&gt;
#12 C:\Users\user\www\extens.dev\tests\DoctrineTest\GroupTest.php(61): UnitTestCase-&amp;gt;run()&lt;br/&gt;
#13 C:\Users\user\www\extens.dev\tests\DoctrineTest.php(180): GroupTest-&amp;gt;run(Object(DoctrineTest_Reporter_Cli), &apos;&apos;)&lt;br/&gt;
#14 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\run.php(29): DoctrineTest-&amp;gt;run()&lt;br/&gt;
#15 &lt;/p&gt;
{main}



&lt;p&gt;Tested: 1 test cases.&lt;br/&gt;
Successes: 26 passes.&lt;br/&gt;
Failures: 1 fails.&lt;br/&gt;
Number of new Failures: 0 &lt;br/&gt;
Number of fixed Failures: 0 &lt;/p&gt;

&lt;p&gt;Tests ran in 1 seconds and used 15279.15625 KB of memory&lt;/p&gt;</comment>
                    <comment id="10468" author="jwage" created="Tue, 3 Nov 2009 21:52:15 +0000"  >&lt;p&gt;The tests all pass now.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="10471" author="admirau" created="Wed, 4 Nov 2009 08:41:14 +0000"  >&lt;p&gt;It still does not work on my environment (Windows or Ubuntu 9.10, PHP 5.3/5.2.6)&lt;br/&gt;
The test result is a bit different, but still fails:&lt;/p&gt;

&lt;p&gt;Doctrine Unit Tests&lt;br/&gt;
===================&lt;br/&gt;
Doctrine_Template_Taggable_TestCase.............................................failed&lt;/p&gt;


&lt;p&gt;Unexpected Doctrine_Record_UnknownPropertyException thrown in &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine_Template_Taggable_TestCase&amp;#93;&lt;/span&gt; with message &lt;span class=&quot;error&quot;&gt;&amp;#91;Unknown record property / related component &amp;quot;total_num&amp;quot; on &amp;quot;TaggableTag&amp;quot;&amp;#93;&lt;/span&gt; in /home/user/doctrine12b/lib/Doctrine/Record/Filter/Standard.php on line 55&lt;/p&gt;

&lt;p&gt;Trace&lt;br/&gt;
-------------&lt;/p&gt;

&lt;p&gt;#0 /home/taat/doctrine12b/lib/Doctrine/Record.php(1359): Doctrine_Record_Filter_Standard-&amp;gt;filterGet(Object(TaggableTag), &apos;total_num&apos;)&lt;br/&gt;
#1 /home/taat/doctrine12b/lib/Doctrine/Record.php(1318): Doctrine_Record-&amp;gt;_get(&apos;total_num&apos;, true)&lt;br/&gt;
#2 /home/taat/doctrine12b/lib/Doctrine/Access.php(117): Doctrine_Record-&amp;gt;get(&apos;total_num&apos;)&lt;br/&gt;
#3 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/Template/TaggableTestCase.php(217): Doctrine_Access-&amp;gt;offsetGet(&apos;total_num&apos;)&lt;br/&gt;
#4 /home/taat/doctrine12b/tests/DoctrineTest/UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase-&amp;gt;testGetPopularTags()&lt;br/&gt;
#5 /home/taat/doctrine12b/tests/DoctrineTest/GroupTest.php(61): UnitTestCase-&amp;gt;run()&lt;br/&gt;
#6 /home/taat/doctrine12b/tests/DoctrineTest.php(180): GroupTest-&amp;gt;run(Object(DoctrineTest_Reporter_Cli), &apos;&apos;)&lt;br/&gt;
#7 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/run.php(29): DoctrineTest-&amp;gt;run()&lt;br/&gt;
#8 &lt;/p&gt;
{main}



&lt;p&gt;Tested: 1 test cases.&lt;br/&gt;
Successes: 26 passes.&lt;br/&gt;
Failures: 1 fails.&lt;br/&gt;
Number of new Failures: 0 &lt;br/&gt;
Number of fixed Failures: 0 &lt;/p&gt;</comment>
                    <comment id="10486" author="jwage" created="Wed, 4 Nov 2009 14:23:51 +0000"  >&lt;p&gt;Did you update Doctrine? I fixed something in Doctrine 1.2 that fixes it.&lt;/p&gt;</comment>
                    <comment id="10487" author="admirau" created="Wed, 4 Nov 2009 15:07:57 +0000"  >&lt;p&gt;Yes, the results above  (&quot;total_num&quot;) I get after updating to 1.2.0-BETA1.&lt;br/&gt;
At 1.2.0-ALPHA2 it was &quot;no such column: a__2&quot; (see above comments).&lt;/p&gt;

&lt;p&gt;Do the extensions work with 2.0, or they are 1.2 specific?&lt;/p&gt;</comment>
                    <comment id="10488" author="jwage" created="Wed, 4 Nov 2009 15:10:55 +0000"  >&lt;p&gt;1.2 specific. I don&apos;t get any fails now, can you try and troubleshoot it and figure out why it fails for you? They don&apos;t fail for me anywhere.&lt;/p&gt;</comment>
                    <comment id="10492" author="admirau" created="Wed, 4 Nov 2009 18:45:41 +0000"  >&lt;p&gt;Doctrine_Template_Taggable_TestCase::testGetPopularTags()&lt;br/&gt;
line 214:&lt;br/&gt;
$test = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(array(&apos;ArticleTaggableTest&apos;, &apos;ArticleTaggableTest2&apos;));&lt;/p&gt;

&lt;p&gt;// compare this with your results&lt;br/&gt;
echo serialize($test);&lt;br/&gt;
result:&lt;br/&gt;
C:19:&quot;Doctrine_Collection&quot;:169:{a:7:{s:4:&quot;data&quot;;a:0:{}s:6:&quot;_table&quot;;s:11:&quot;TaggableTag&quot;;s:9:&quot;_snapshot&quot;;a:0:{}s:14:&quot;referenceField&quot;;N;s:9:&quot;keyColumn&quot;;s:4:&quot;name&quot;;s:8:&quot;_locator&quot;;N;s:10:&quot;_resources&quot;;a:0:{}}}&lt;/p&gt;

&lt;p&gt;When I try to var_dump($test),&lt;br/&gt;
I get circular dependency.&lt;br/&gt;
I tried to save results of var_dump($test) to disk, by I get 1,5GB file, and still growing...&lt;/p&gt;

&lt;p&gt;Maybe this article helps somehow:&lt;br/&gt;
&lt;a href=&quot;http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency&quot; class=&quot;external-link&quot;&gt;http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Can I see the fix you mentioned above?&lt;/p&gt;

&lt;p&gt;I&apos;m sorry, but I do not know what else I can do.&lt;br/&gt;
Any ideas?&lt;/p&gt;</comment>
                    <comment id="10568" author="jwage" created="Tue, 10 Nov 2009 17:30:55 +0000"  >&lt;p&gt;I am not sure what to say since it is working for me on all the machines I test. I&apos;ll be happy to look if I can get something to fail so I can troubleshoot it.&lt;/p&gt;</comment>
                    <comment id="10584" author="admirau" created="Wed, 11 Nov 2009 12:19:34 +0000"  >&lt;p&gt;I&apos;ve tested on PLD Linux too.&lt;br/&gt;
The same thing.&lt;/p&gt;

&lt;p&gt;Could you provide sample server/php configuration on which the tests are passing?&lt;/p&gt;

&lt;p&gt;Can you describe the fix you&apos;ve made to correct the errors with &apos;&apos;Unknown method Doctrine_Table::getPopularTags&apos;.&lt;br/&gt;
Maybe I can manage to investigate it, but I do not know where to start.&lt;/p&gt;</comment>
                    <comment id="10592" author="admirau" created="Wed, 11 Nov 2009 14:24:04 +0000"  >&lt;p&gt;Sorry for reopening this again.&lt;/p&gt;

&lt;p&gt;After upgrading to BETA2 all Taggable tests are passing OK for me too.&lt;/p&gt;

&lt;p&gt;However, in the code I still get &apos;Unknown method BlogPostTable::getPopularTags&apos; in /tools\sandbox\lib\Doctrine\Table.php:2793&apos;&lt;br/&gt;
Isn&apos;t it a regression of the bug you&apos;ve already fixed before ALPHA2?&lt;/p&gt;


&lt;p&gt;Here is the description of how I came to this exception.&lt;/p&gt;

&lt;p&gt;At the very end of config.php:&lt;/p&gt;

&lt;p&gt;$manager-&amp;gt;registerExtension(&apos;Taggable&apos;);&lt;/p&gt;

&lt;p&gt;In the index.php:&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;/p&gt;

&lt;p&gt;require_once(&apos;config.php&apos;);&lt;/p&gt;

&lt;p&gt;$models = Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;

&lt;p&gt;$post = new BlogPost();&lt;br/&gt;
$post-&amp;gt;title = &apos;This is a sample blog post&apos;;&lt;br/&gt;
$post-&amp;gt;description = &apos;Cool!&apos;;&lt;br/&gt;
$post-&amp;gt;setTags(&apos;2009, symfony, doctrine&apos;);&lt;br/&gt;
$post-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;$table = Doctrine::getTable(&apos;BlogPost&apos;);&lt;br/&gt;
echo get_class($table);     // echoes Doctrine_Collection&lt;br/&gt;
$table-&amp;gt;getPopularTags();   // this throws the exception&lt;/p&gt;

&lt;p&gt;Then in the console:&lt;br/&gt;
php doctrine.php create-db&lt;br/&gt;
php doctrine.php generate-models-yaml (BaseBlogPost, BlogPost, BlogPostTable were generated)&lt;br/&gt;
php doctrine.php generate-sql (see SQL below)&lt;br/&gt;
php doctrine.php create-tables&lt;br/&gt;
(all ok)&lt;/p&gt;

&lt;p&gt;php index.php&lt;/p&gt;

&lt;p&gt;result:&lt;/p&gt;

&lt;p&gt;BlogPostTablePHP Fatal error:  Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method BlogPostTable::getPopularTags&apos; in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable-&amp;gt;getPopularTags()&lt;br/&gt;
#2 &lt;/p&gt;
{main}&lt;br/&gt;
  thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793&lt;br/&gt;
Fatal error: Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method BlogPostTable::getPopularTags&apos; in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable-&amp;gt;getPopularTags()&lt;br/&gt;
#2 {main}
&lt;p&gt;  thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793&lt;/p&gt;

&lt;p&gt;And here is the generated SQL:&lt;/p&gt;

&lt;p&gt;CREATE TABLE taggable_tag (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) UNIQUE);&lt;br/&gt;
CREATE TABLE blog_post_taggable_tag (id INTEGER, tag_id INTEGER, PRIMARY KEY(id, tag_id));&lt;br/&gt;
CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL);&lt;/p&gt;</comment>
                    <comment id="10616" author="jwage" created="Thu, 12 Nov 2009 20:50:21 +0000"  >&lt;p&gt;When I test your code, it is working for me. You sure you don&apos;t have some old versions of PHP or something?&lt;/p&gt;</comment>
                    <comment id="10619" author="admirau" created="Thu, 12 Nov 2009 21:33:08 +0000"  >&lt;p&gt;Everything is up to date.&lt;br/&gt;
Tested on different servers, with different operating systems, different versions PHP, different versions of Doctrine, by different people.&lt;/p&gt;

&lt;p&gt;Common thing for all these machines is that PHP (&amp;gt;5.2.10 &amp;lt;= 5.3.1) was installed from precompiled builds, not from source.&lt;/p&gt;

&lt;p&gt;The error I get now is the same error I got earlier (at the beginning of this topic), which disapperared after your fix.&lt;br/&gt;
Then appeared the second error, which was fixed in BETA2, but the previous error is back. (strange, but the tests are passing now, despite the errors in the regular code).&lt;/p&gt;

&lt;p&gt;When I find some spare time I&apos;ll try to trace the changes you&apos;ve made since the beginning of the topic.&lt;/p&gt;</comment>
                    <comment id="10733" author="admirau" created="Wed, 18 Nov 2009 14:12:11 +0000"  >&lt;p&gt;Maybe the models are generated not properly.&lt;br/&gt;
Here are my models (three) for the reproduction procedure (above):&lt;/p&gt;

&lt;p&gt;class BlogPostTable extends Doctrine_Table {}&lt;/p&gt;

&lt;p&gt;class BlogPost extends BaseBlogPost {}&lt;/p&gt;

&lt;p&gt;abstract class BaseBlogPost extends Doctrine_Record&lt;br/&gt;
{&lt;br/&gt;
    public function setTableDefinition()&lt;/p&gt;
    {
        $this-&amp;gt;setTableName(&apos;blog_post&apos;);
        $this-&amp;gt;hasColumn(&apos;title&apos;, &apos;string&apos;, 255, array(
        											   &apos;type&apos; =&amp;gt; &apos;string&apos;,
        											   &apos;notnull&apos; =&amp;gt; true,
        											   &apos;length&apos; =&amp;gt; &apos;255&apos;,
        											   ));
        $this-&amp;gt;hasColumn(&apos;description&apos;, &apos;string&apos;, 255, array(
        													 &apos;type&apos; =&amp;gt; &apos;string&apos;,
        													 &apos;notnull&apos; =&amp;gt; true,
        													 &apos;length&apos; =&amp;gt; &apos;255&apos;,
        													 ));
    }

&lt;p&gt;    public function setUp()&lt;/p&gt;
    {
        parent::setUp();
        $taggable0 = new Doctrine_Template_Taggable();
        $this-&amp;gt;actAs($taggable0);
    }
&lt;p&gt;}&lt;/p&gt;</comment>
                    <comment id="10758" author="jwage" created="Wed, 18 Nov 2009 22:11:51 +0000"  >&lt;p&gt;I have everything generated the same as you.&lt;/p&gt;</comment>
                    <comment id="10811" author="balupton" created="Sat, 21 Nov 2009 12:12:04 +0000"  >&lt;p&gt;Also getting this. Using doctrine 1.2.0-beta3 and also tried with latest SVN. Taggable is latest available.&lt;/p&gt;

&lt;p&gt;PHP 5.3.0 running on Zend Server version 5.0.0Beta2&lt;/p&gt;</comment>
                    <comment id="10832" author="admirau" created="Tue, 24 Nov 2009 07:59:51 +0000"  >&lt;p&gt;No changes after upgrade to 1.2.0-RC1.&lt;/p&gt;</comment>
                    <comment id="10848" author="admirau" created="Tue, 24 Nov 2009 20:30:36 +0000"  >&lt;p&gt;Maybe this helps somehow:&lt;/p&gt;

&lt;p&gt;// Following line throws:&lt;br/&gt;
// Doctrine_Table_Exception: Unknown method Doctrine_Table::getPopularTags in /home/user/doctrine12rc1/lib/Doctrine/Table.php on line 2799&lt;br/&gt;
$tags = Doctrine::getTable(&apos;BlogPost&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;


&lt;p&gt;// This line returns collection of tags, as expected&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(&apos;BlogPost&apos;);&lt;/p&gt;


&lt;p&gt;$rel = Doctrine::getTable(&apos;BlogPost&apos;)-&amp;gt;getRelations();          // is int(2)&lt;br/&gt;
$rel = Doctrine::getTable(&apos;TagableTag&apos;)-&amp;gt;getRelations();     // is int(2)&lt;/p&gt;


</comment>
                    <comment id="11202" author="wormling" created="Wed, 16 Dec 2009 16:46:38 +0000"  >&lt;p&gt;Symfony 1.3 SVN updated as of this post.&lt;/p&gt;

&lt;p&gt;Ubuntu Karmic with PHP 5.3.1&lt;/p&gt;

&lt;p&gt;I have installed Taggable in mysymfonyproject/lib/doctrine_extensions/Taggable&lt;/p&gt;

&lt;p&gt;I have two example tables defined with Taggable:&lt;/p&gt;

&lt;p&gt;Video:&lt;br/&gt;
  actAs: &lt;/p&gt;
{ Taggable: ~, Timestampable: ~ }
&lt;p&gt;  columns:&lt;br/&gt;
    id: &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    content_id: &lt;/p&gt;
{ type: integer, notnull: true }
&lt;p&gt;    title: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    description: &lt;/p&gt;
{ type: clob }
&lt;p&gt;  relations:&lt;br/&gt;
    Content: &lt;/p&gt;
{ local: content_id, foreign: id }

&lt;p&gt;Photo:&lt;br/&gt;
  actAs: &lt;/p&gt;
{ Taggable: ~, Timestampable: ~ }
&lt;p&gt;  columns:&lt;br/&gt;
    id: &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    content_id: &lt;/p&gt;
{ type: integer, notnull: true }
&lt;p&gt;    title: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    description: &lt;/p&gt;
{ type: clob }
&lt;p&gt;    uri: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;  relations:&lt;br/&gt;
    Content: &lt;/p&gt;
{ local: content_id, foreign: id }

&lt;p&gt;The following code functions and populates the database:&lt;br/&gt;
$video = new Video();&lt;br/&gt;
...&lt;br/&gt;
$video-&amp;gt;setTags(implode(&quot;, &quot;, $tags));&lt;br/&gt;
$video-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;The following code errors:&lt;br/&gt;
$tags = Doctrine::getTable(&apos;Video&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;

&lt;p&gt;500 | Internal Server Error | Doctrine_Table_Exception&lt;br/&gt;
Unknown method VideoTable::getPopularTags&lt;/p&gt;

&lt;p&gt;The following code errors:&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(&apos;Video&apos;);&lt;/p&gt;

&lt;p&gt;500 | Internal Server Error | Doctrine_Exception&lt;br/&gt;
Couldn&apos;t find class TagableTag&lt;/p&gt;</comment>
                    <comment id="11434" author="sorin" created="Wed, 20 Jan 2010 13:36:07 +0000"  >&lt;p&gt;Dont know if its related to this issue or not, but for some reason Doctrine::getTable(&apos;TaggableTag&apos;) throws a &quot;&lt;/p&gt;
{Doctrine_Exception}
&lt;p&gt; Couldn&apos;t find class TaggableTag&quot; exception&lt;/p&gt;

&lt;p&gt;I understand that you would normally do this:&lt;br/&gt;
Doctrine::getTable(&apos;Video&apos;)-&amp;gt;getTags() &lt;br/&gt;
but I just want plain access to the TaggableTag model and Doctrine doesnt seem to generate any model classess for TaggableTag &lt;/p&gt;</comment>
                    <comment id="11900" author="jwage" created="Mon, 1 Mar 2010 16:18:10 +0000"  >&lt;p&gt;I have tested everything everyone has provided and it is all working for me. The only thing I can suggest now is that someone creates a Doctrine failing test case so that I can run it to see the failure.&lt;/p&gt;</comment>
                    <comment id="11938" author="balupton" created="Mon, 1 Mar 2010 20:23:35 +0000"  >&lt;p&gt;Will create a test case this weekend for this and a few other problems I&apos;ve across (with fixes). Nothing more frustrating than not being able to reproduce a problem, so I feel your pain.&lt;/p&gt;</comment>
                    <comment id="11984" author="ivarne" created="Tue, 2 Mar 2010 14:04:20 +0000"  >&lt;p&gt;I think this bug i related to the bug in the documentation &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-378&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-378&lt;/a&gt; to get the popular tags you will first have to load the models you want the tags for.&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-comment&quot;&gt;// load models that you want the tags from
&lt;/span&gt;Doctrine::getTable(&apos;blog&apos;);
Doctrine::getTable(&apos;products&apos;);
&lt;span class=&quot;code-comment&quot;&gt;// then you can get the tags &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the models currently loaded
&lt;/span&gt;$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12047" author="wormling" created="Sun, 7 Mar 2010 00:41:57 +0000"  >&lt;p&gt;This works for me:&lt;/p&gt;

&lt;p&gt;// load models that you want the tags from&lt;br/&gt;
Doctrine::getTable(&apos;blog&apos;);&lt;br/&gt;
Doctrine::getTable(&apos;products&apos;);&lt;br/&gt;
// then you can get the tags for the models currently loaded&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;</comment>
                    <comment id="12541" author="balupton" created="Thu, 1 Apr 2010 07:00:29 +0000"  >&lt;p&gt;Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit.&lt;br/&gt;
Although within the test it is written as:&lt;br/&gt;
$test = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(array(&apos;ArticleTaggableTest&apos;, &apos;ArticleTaggableTest2&apos;));&lt;br/&gt;
Rather than:&lt;br/&gt;
$test = Doctrine::getTable(&apos;ArticleTaggableTest&apos;)-&amp;gt;getPopularTags();&lt;br/&gt;
which is what this problem is about.&lt;/p&gt;


&lt;p&gt;Although I do believe I&apos;ve nailed the source of the problem - as well as others I&apos;ve experienced.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Problems are introduced when using pear style model names. Indirectly fixed with: &lt;a href=&quot;http://pastebin.com/DKGcgAht&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/DKGcgAht&lt;/a&gt; - links to fix in Doctrine/Record/Generator.php&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using custom names for the taggable field. Such as: &lt;a href=&quot;http://pastebin.com/JdhqeG38&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/JdhqeG38&lt;/a&gt; - example&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using inheritance for models.  Such as: &lt;a href=&quot;http://pastebin.com/Qwuwk0z1&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/Qwuwk0z1&lt;/a&gt; - example&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using taggable relations when the record has not been inserted yet. Such as: &lt;a href=&quot;http://pastebin.com/ahPpqTdK&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/ahPpqTdK&lt;/a&gt; - example&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Having either of the above causes the system to fall down. I&apos;ve applied a bunch of fixes/changes to taggable to ensure it works with my systems, such as &lt;a href=&quot;http://sos.7dots.co.uk/&quot; class=&quot;external-link&quot;&gt;http://sos.7dots.co.uk/&lt;/a&gt; (still in staging) which uses all of the above mentioned problems, not sure how to do a diff but here is the file:&lt;br/&gt;
&lt;a href=&quot;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&quot; class=&quot;external-link&quot;&gt;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope that helps some people. Any changes I&apos;ve made code can come under the same licence as doctrine, so no worries there.&lt;/p&gt;</comment>
                    <comment id="12672" author="admirau" created="Thu, 15 Apr 2010 11:12:28 +0000"  >&lt;p&gt;With 1.2.2 there is some progress.&lt;br/&gt;
There was still 1 test failing (CASCADE),&lt;br/&gt;
but with the version:&lt;br/&gt;
&lt;a href=&quot;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&quot; class=&quot;external-link&quot;&gt;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&lt;/a&gt;&lt;br/&gt;
provided by Benjamin Arthur Lupton &lt;br/&gt;
all test are passing now.&lt;/p&gt;

&lt;p&gt;But now when I run:&lt;br/&gt;
getTable(&apos;ArticleTaggableTest&apos;)-&amp;gt;getPopularTags();&lt;br/&gt;
I get: ERROR: column &quot;i2__1&quot; does not exist&lt;/p&gt;


&lt;p&gt;The failing query on PostgreSql is:&lt;/p&gt;

&lt;p&gt;SELECT t.id AS t_&lt;em&gt;id, t.name AS t&lt;/em&gt;&lt;em&gt;name, COUNT(DISTINCT i.id) AS i&lt;/em&gt;_0,&lt;br/&gt;
                                                          (COUNT(DISTINCT i.id)) AS i__1&lt;br/&gt;
FROM taggable_tag t&lt;br/&gt;
LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c ON (t.id = c.tag_id)&lt;br/&gt;
LEFT JOIN image i ON i.id = c.id&lt;br/&gt;
WHERE t.id IN&lt;br/&gt;
    (SELECT doctrine_subquery_alias.id&lt;br/&gt;
     FROM&lt;br/&gt;
       (SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1&lt;br/&gt;
        FROM taggable_tag t2&lt;br/&gt;
        LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c2 ON (t2.id = c2.tag_id)&lt;br/&gt;
        LEFT JOIN image i2 ON i2.id = c2.id&lt;br/&gt;
        GROUP BY t2.id HAVING i2__1 &amp;gt; 0&lt;br/&gt;
        ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)&lt;br/&gt;
GROUP BY t.id HAVING i__1 &amp;gt; 0&lt;br/&gt;
ORDER BY i__1 DESC&lt;/p&gt;


&lt;p&gt;Seems that this just a PostgreSql issue.&lt;br/&gt;
On Mysql it runs just fine.&lt;/p&gt;</comment>
                    <comment id="12680" author="ivarne" created="Thu, 15 Apr 2010 14:28:58 +0000"  >&lt;p&gt;The last comment is concerning how the poular tags are found and rated (on PostgreSql). I think this is unrelated to the rest of this issue and should be moved to a separate issue. (also I only got junk ads when I tried to get the file you are linking to).&lt;/p&gt;</comment>
                    <comment id="12681" author="admirau" created="Thu, 15 Apr 2010 14:40:28 +0000"  >&lt;p&gt;I have created separated issue for this:&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-634&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-634&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And yes, this link is quite odd...&lt;br/&gt;
There is a lot of crap,&lt;br/&gt;
however there is a small link, to download improved code:&lt;/p&gt;

&lt;p&gt;Look for: &quot;Save file to your PC: click here&quot;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>