[DC-67] Taggable not working Created: 28/Sep/09 Updated: 15/Apr/10 |
|
| Status: | Reopened |
| Project: | Doctrine 1 |
| Component/s: | Extensions |
| Affects Version/s: | 1.2.0-ALPHA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | admirau | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 4 |
| 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) 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 |
| Comments |
| Comment by admirau [ 08/Oct/09 ] |
|
The same with Alpha2 |
| Comment by admirau [ 10/Oct/09 ] |
|
Running the tests results in one failure: Doctrine Unit Tests Unexpected Doctrine_Connection_Sqlite_Exception thrown in [Doctrine_Template_Taggable_TestCase] with message [SQLSTATE[HY000]: General error: 1 no such column: a__2] in C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php on line 1067 Trace #0 C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php(1015): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Sqlite)) Tested: 1 test cases. Tests ran in 1 seconds and used 15279.15625 KB of memory |
| Comment by Jonathan H. Wage [ 03/Nov/09 ] |
|
The tests all pass now. http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests |
| Comment by admirau [ 04/Nov/09 ] |
|
It still does not work on my environment (Windows or Ubuntu 9.10, PHP 5.3/5.2.6) Doctrine Unit Tests Unexpected Doctrine_Record_UnknownPropertyException thrown in [Doctrine_Template_Taggable_TestCase] with message [Unknown record property / related component "total_num" on "TaggableTag"] in /home/user/doctrine12b/lib/Doctrine/Record/Filter/Standard.php on line 55 Trace #0 /home/taat/doctrine12b/lib/Doctrine/Record.php(1359): Doctrine_Record_Filter_Standard->filterGet(Object(TaggableTag), 'total_num') Tested: 1 test cases. |
| Comment by Jonathan H. Wage [ 04/Nov/09 ] |
|
Did you update Doctrine? I fixed something in Doctrine 1.2 that fixes it. |
| Comment by admirau [ 04/Nov/09 ] |
|
Yes, the results above ("total_num") I get after updating to 1.2.0-BETA1. Do the extensions work with 2.0, or they are 1.2 specific? |
| Comment by Jonathan H. Wage [ 04/Nov/09 ] |
|
1.2 specific. I don't get any fails now, can you try and troubleshoot it and figure out why it fails for you? They don't fail for me anywhere. |
| Comment by admirau [ 04/Nov/09 ] |
|
Doctrine_Template_Taggable_TestCase::testGetPopularTags() // compare this with your results When I try to var_dump($test), Maybe this article helps somehow: Can I see the fix you mentioned above? I'm sorry, but I do not know what else I can do. |
| Comment by Jonathan H. Wage [ 10/Nov/09 ] |
|
I am not sure what to say since it is working for me on all the machines I test. I'll be happy to look if I can get something to fail so I can troubleshoot it. |
| Comment by admirau [ 11/Nov/09 ] |
|
I've tested on PLD Linux too. Could you provide sample server/php configuration on which the tests are passing? Can you describe the fix you've made to correct the errors with ''Unknown method Doctrine_Table::getPopularTags'. |
| Comment by admirau [ 11/Nov/09 ] |
|
Sorry for reopening this again. After upgrading to BETA2 all Taggable tests are passing OK for me too. However, in the code I still get 'Unknown method BlogPostTable::getPopularTags' in /tools\sandbox\lib\Doctrine\Table.php:2793' Here is the description of how I came to this exception. At the very end of config.php: $manager->registerExtension('Taggable'); In the index.php: <?php require_once('config.php'); $models = Doctrine_Core::loadModels('models'); $post = new BlogPost(); $table = Doctrine::getTable('BlogPost'); Then in the console: php index.php result: BlogPostTablePHP Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method BlogPostTable::getPopularTags' in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793 thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793 Fatal error: Uncaught exception 'Doctrine_Table_Exception' with message 'Unknown method BlogPostTable::getPopularTags' in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793 Stack trace: #0 [internal function]: Doctrine_Table->__call('getPopularTags', Array) #1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable->getPopularTags() #2 {main} thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793 And here is the generated SQL: CREATE TABLE taggable_tag (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) UNIQUE); |
| Comment by Jonathan H. Wage [ 12/Nov/09 ] |
|
When I test your code, it is working for me. You sure you don't have some old versions of PHP or something? |
| Comment by admirau [ 12/Nov/09 ] |
|
Everything is up to date. Common thing for all these machines is that PHP (>5.2.10 <= 5.3.1) was installed from precompiled builds, not from source. The error I get now is the same error I got earlier (at the beginning of this topic), which disapperared after your fix. When I find some spare time I'll try to trace the changes you've made since the beginning of the topic. |
| Comment by admirau [ 18/Nov/09 ] |
|
Maybe the models are generated not properly. class BlogPostTable extends Doctrine_Table {} class BlogPost extends BaseBlogPost {} abstract class BaseBlogPost extends Doctrine_Record public function setUp() { parent::setUp(); $taggable0 = new Doctrine_Template_Taggable(); $this->actAs($taggable0); }} |
| Comment by Jonathan H. Wage [ 18/Nov/09 ] |
|
I have everything generated the same as you. |
| Comment by Benjamin Arthur Lupton [ 21/Nov/09 ] |
|
Also getting this. Using doctrine 1.2.0-beta3 and also tried with latest SVN. Taggable is latest available. PHP 5.3.0 running on Zend Server version 5.0.0Beta2 |
| Comment by admirau [ 24/Nov/09 ] |
|
No changes after upgrade to 1.2.0-RC1. |
| Comment by admirau [ 24/Nov/09 ] |
|
Maybe this helps somehow: // Following line throws: // This line returns collection of tags, as expected $rel = Doctrine::getTable('BlogPost')->getRelations(); // is int(2) |
| Comment by Brian Smith [ 16/Dec/09 ] |
|
Symfony 1.3 SVN updated as of this post. Ubuntu Karmic with PHP 5.3.1 I have installed Taggable in mysymfonyproject/lib/doctrine_extensions/Taggable I have two example tables defined with Taggable: Video: columns: content_id: { type: integer, notnull: true }title: { type: string(255) }description: { type: clob } relations: Photo: columns: content_id: { type: integer, notnull: true }title: { type: string(255) }description: { type: clob }uri: { type: string(255) } relations: The following code functions and populates the database: The following code errors: 500 | Internal Server Error | Doctrine_Table_Exception The following code errors: 500 | Internal Server Error | Doctrine_Exception |
| Comment by Sorin Neacsu [ 20/Jan/10 ] |
|
Dont know if its related to this issue or not, but for some reason Doctrine::getTable('TaggableTag') throws a " {Doctrine_Exception}Couldn't find class TaggableTag" exception I understand that you would normally do this: |
| Comment by Jonathan H. Wage [ 01/Mar/10 ] |
|
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. |
| Comment by Benjamin Arthur Lupton [ 01/Mar/10 ] |
|
Will create a test case this weekend for this and a few other problems I've across (with fixes). Nothing more frustrating than not being able to reproduce a problem, so I feel your pain. |
| Comment by Ivar Nesje [ 02/Mar/10 ] |
|
I think this bug i related to the bug in the documentation http://www.doctrine-project.org/jira/browse/DC-378 to get the popular tags you will first have to load the models you want the tags for. // 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(); |
| Comment by Brian Smith [ 07/Mar/10 ] |
|
This works for me: // load models that you want the tags from |
| Comment by Benjamin Arthur Lupton [ 01/Apr/10 ] |
|
Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit. 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: Hope that helps some people. Any changes I've made code can come under the same licence as doctrine, so no worries there. |
| Comment by admirau [ 15/Apr/10 ] |
|
With 1.2.2 there is some progress. But now when I run: The failing query on PostgreSql is: SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0, Seems that this just a PostgreSql issue. |
| Comment by Ivar Nesje [ 15/Apr/10 ] |
|
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). |
| Comment by admirau [ 15/Apr/10 ] |
|
I have created separated issue for this: And yes, this link is quite odd... Look for: "Save file to your PC: click here" |