views:

35

answers:

0

Okay, please try to follow closely to understood the problem, it weird, I know.

I'm converting a working module to plug-in and did run to weird problem. Here is the schema.yml

Code: 
    Categories:
      actAs:
        I18n:
          fields:   [ name, description ]
        Timestampable:
        NestedSet:
      columns:
          name: string
          description:  string

So, this is the schema of module, plug-in has the same schema but different table name, of course.

In plug-in's PluginNcCatetegoriesTable.class.php I have this method: (same I have in the modules same file, of course)

Code: 
    public function getCategoriesResultSet()
    {         
        return Doctrine_Core::getTable('NcCategories')->findAll();
    }

This method is called from PluginNcCategoriesForm.class.php (and also the CategoriesForm.class.php) to populate a drop down element with all categories.

On edit action symfony executes one query before it goes to calling this method. Here is the query it executes:

Code: 
    SELECT n.id AS n__id, n.created_at AS n__created_at, n.updated_at AS n__updated_at, n.lft AS n__lft, n.rgt AS n__rgt, n.level AS n__level FROM nc_article_categories n WHERE (n.id = ?) - (6)

Okay, then it executes getCategoriesResultSet()-method call and the query fails cause it looks like this:

Code:
    Column not found: 1054 Unknown column 'n.name' in 'field list'. Failing Query: "SELECT n.id AS n__id, n.name AS n__name, n.description AS n__description, n.created_at AS n__created_at, n.updated_at AS n__updated_at, n.lft AS n__lft, n.rgt AS n__rgt, n.level AS n__level FROM nc_article_categories n"

Okay, cool still. The weird thing is that this does not happen on module from where I'm converting the plug-in. They are identical besides the abstract class definitions and different table names.

And even more weird is that if I move Doctrine_Core::getTable('NcCategories')->findAll() call to the executeEdit()-method on actions.class.php everything works just fine. And it does not matter if I use $q = Doctrine_Query::create()->select('n.*')->from('NcCategories n');, same thing happens with this one too. You understood what I'm explaining?

So, any ideas why this happens?