Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0-ALPHA1
    • Fix Version/s: None
    • Component/s: Extensions
    • Labels:
      None
    • Environment:
      PHP 5.2.8, Doctrine 1.2.0 Alpha1, Vista, Sandbox 1.2.0 Alpha1

      Description

      After enabling Taggable extension, magic methods on the tables (e.g. getPopularTags)
      cannot be reached:

      Doctrine::getTable('Upload')->getPopularTags();

      Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method Doctrine_Table::getPopularTags' in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php:2608 Stack trace: #0 [internal function]: Doctrine_Table->__call('getPopularTags', Array) #1 C:\Users\user\www\extens.dev\index.php(7): Doctrine_Table->getPopularTags() #2

      {main}

      thrown in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php on line 2608

        Activity

        Hide
        admirau added a comment - - edited

        I have created separated issue for this:
        http://www.doctrine-project.org/jira/browse/DC-634

        And yes, this link is quite odd...
        There is a lot of crap,
        however there is a small link, to download improved code:

        Look for: "Save file to your PC: click here"

        Show
        admirau added a comment - - edited I have created separated issue for this: http://www.doctrine-project.org/jira/browse/DC-634 And yes, this link is quite odd... There is a lot of crap, however there is a small link, to download improved code: Look for: "Save file to your PC: click here"
        Hide
        Ivar Nesje added a comment -

        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).

        Show
        Ivar Nesje added a comment - 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).
        Hide
        admirau added a comment - - edited

        With 1.2.2 there is some progress.
        There was still 1 test failing (CASCADE),
        but with the version:
        http://www.2shared.com/file/12385197/c5911e42/Taggable.html
        provided by Benjamin Arthur Lupton
        all test are passing now.

        But now when I run:
        getTable('ArticleTaggableTest')->getPopularTags();
        I get: ERROR: column "i2__1" does not exist

        The failing query on PostgreSql is:

        SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0,
        (COUNT(DISTINCT i.id)) AS i__1
        FROM taggable_tag t
        LEFT JOIN cms_model_image_taggable_tag c ON (t.id = c.tag_id)
        LEFT JOIN image i ON i.id = c.id
        WHERE t.id IN
        (SELECT doctrine_subquery_alias.id
        FROM
        (SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1
        FROM taggable_tag t2
        LEFT JOIN cms_model_image_taggable_tag c2 ON (t2.id = c2.tag_id)
        LEFT JOIN image i2 ON i2.id = c2.id
        GROUP BY t2.id HAVING i2__1 > 0
        ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)
        GROUP BY t.id HAVING i__1 > 0
        ORDER BY i__1 DESC

        Seems that this just a PostgreSql issue.
        On Mysql it runs just fine.

        Show
        admirau added a comment - - edited With 1.2.2 there is some progress. There was still 1 test failing (CASCADE), but with the version: http://www.2shared.com/file/12385197/c5911e42/Taggable.html provided by Benjamin Arthur Lupton all test are passing now. But now when I run: getTable('ArticleTaggableTest')->getPopularTags(); I get: ERROR: column "i2__1" does not exist The failing query on PostgreSql is: SELECT t.id AS t_ id, t.name AS t name, COUNT(DISTINCT i.id) AS i _0, (COUNT(DISTINCT i.id)) AS i__1 FROM taggable_tag t LEFT JOIN cms_ model _image_taggable_tag c ON (t.id = c.tag_id) LEFT JOIN image i ON i.id = c.id WHERE t.id IN (SELECT doctrine_subquery_alias.id FROM (SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1 FROM taggable_tag t2 LEFT JOIN cms_ model _image_taggable_tag c2 ON (t2.id = c2.tag_id) LEFT JOIN image i2 ON i2.id = c2.id GROUP BY t2.id HAVING i2__1 > 0 ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias) GROUP BY t.id HAVING i__1 > 0 ORDER BY i__1 DESC Seems that this just a PostgreSql issue. On Mysql it runs just fine.
        Hide
        Benjamin Arthur Lupton added a comment -

        Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit.
        Although within the test it is written as:
        $test = Doctrine::getTable('TaggableTag')->getPopularTags(array('ArticleTaggableTest', 'ArticleTaggableTest2'));
        Rather than:
        $test = Doctrine::getTable('ArticleTaggableTest')->getPopularTags();
        which is what this problem is about.

        Although I do believe I've nailed the source of the problem - as well as others I've experienced.

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

        Hope that helps some people. Any changes I've made code can come under the same licence as doctrine, so no worries there.

        Show
        Benjamin Arthur Lupton added a comment - Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit. Although within the test it is written as: $test = Doctrine::getTable('TaggableTag')->getPopularTags(array('ArticleTaggableTest', 'ArticleTaggableTest2')); Rather than: $test = Doctrine::getTable('ArticleTaggableTest')->getPopularTags(); which is what this problem is about. Although I do believe I've nailed the source of the problem - as well as others I've experienced. Problems are introduced when using pear style model names. Indirectly fixed with: http://pastebin.com/DKGcgAht - links to fix in Doctrine/Record/Generator.php Problems are introduced when using custom names for the taggable field. Such as: http://pastebin.com/JdhqeG38 - example Problems are introduced when using inheritance for models. Such as: http://pastebin.com/Qwuwk0z1 - example Problems are introduced when using taggable relations when the record has not been inserted yet. Such as: http://pastebin.com/ahPpqTdK - example Having either of the above causes the system to fall down. I've applied a bunch of fixes/changes to taggable to ensure it works with my systems, such as http://sos.7dots.co.uk/ (still in staging) which uses all of the above mentioned problems, not sure how to do a diff but here is the file: http://www.2shared.com/file/12385197/c5911e42/Taggable.html Hope that helps some people. Any changes I've made code can come under the same licence as doctrine, so no worries there.
        Hide
        Brian Smith added a comment -

        This works for me:

        // load models that you want the tags from
        Doctrine::getTable('blog');
        Doctrine::getTable('products');
        // then you can get the tags for the models currently loaded
        $tags = Doctrine::getTable('TaggableTag')->getPopularTags();

        Show
        Brian Smith added a comment - This works for me: // load models that you want the tags from Doctrine::getTable('blog'); Doctrine::getTable('products'); // then you can get the tags for the models currently loaded $tags = Doctrine::getTable('TaggableTag')->getPopularTags();

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            admirau
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: