Hello,

I am trying Doctrine for a new project, so my Doctrine level is newbie.

I would like to have nested albums with one root album per client, so I
set up the table like this:

Album:
  actAs:
    NestedSet: {hasManyRoots: true, rootColumnName: client_id }
  columns:
    path: { type: string, length: 255, notnull: true}
    client_id: { type: integer, notnull: true, name: "client_id as
clientID" }
  relations:
    Client: { local: client_id, foreign: id, foreignAlias: Albums,
onDelete: CASCADE }
  indexes:
    pathAndClientAreUnique:
      fields: [path, client_id]
      type: unique

And then I try to set the root node like this:

                $root = new Album();
                $root->path = "/";
                $root->clientID = sfConfig::get('app_clientid');
                $tree = Doctrine::getTable('Album')->getTree();
                $tree->createRoot($root);

And this does not work. It seems that there is a problem with the alias
for client_id. If I run it with yaml table file like above, I get an
exception:

Doctrine_Record_UnknownPropertyException
Unknown record property / related component "client_id" on "Album"

But if I change the yaml file to

    NestedSet: {hasManyRoots: true, rootColumnName: clientID }

it finds the right column, but then the mysql query is wrong:

Doctrine_Connection_Mysql_Exception
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'clientid' in
'field list'
Doctrine_Connection->exec('INSERT INTO album (path, clientid,
image_size, thumbnail_size, priceset_id, lft, rgt, level) VALUES (?, ?,
?, ?, ?, ?, ?, ?)', array('/', 1, 600, 150, 1, '1', '2', 0))

Here Doctrine uses the alias name instead of the mysql column name.

What can I do (unless removing my alias is the only solution)?

Georg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to