#1550: Relation errors with sfDoctrineGuardPlugin
----------------------------+-----------------------------------------------
  Reporter:  tbaa           |       Owner:  jwage                
      Type:  defect         |      Status:  new                  
  Priority:  minor          |   Milestone:  1.0.3                
 Component:  Import/Export  |     Version:  1.0.2                
Resolution:                 |    Keywords:  schema               
  Has_test:  0              |    Mystatus:  Pending Core Response
 Has_patch:  0              |  
----------------------------+-----------------------------------------------
Old description:

> I use symfony 1.2 Dev with sfDoctrineGuard and profiles.
> My schemafile looks like that:
> ...
>
> {{{
> Profile:
>   columns:
>     id: { type: integer, primary: true, autoincrement: true}
>     user_id: { type: integer(4), notnull: false }
>   relations:
>     User:
>       foreign: id
>       local: user_id
>       class: sfGuardUser
>       onDelete: SET NULL
>
> sfGuardUser:
>   Dieter:
>     username:       Dieter
>     password:       asd
>
> Profile:
>   DieterProfile:
>     sfGuardUser: Dieter
> ----
> my app.yml:
> all:
>   sf_guard_plugin:
>     profile_class:      Profile
>     profile_field_name: user_id
> ----
> the error while loading the data is: Invalid fixture element "User" under
> "DieterProfile"
> }}}
>
> ----
> the solution for me was to merge the two arrays instead of replacing it.
> I changed the line 602 in Schema.php:
> {{{
>             $array[$className]['relations'] = $relations;
> }}}
> into:
> {{{
>             $array[$className]['relations'] =
> array_merge($array[$className]['relations'],$relations);
> }}}
>
> schema.yml:

New description:

 I use symfony 1.2 Dev with sfDoctrineGuard and profiles.

 {{{
 // schema file
 Profile:
   columns:
     id: { type: integer, primary: true, autoincrement: true}
     user_id: { type: integer(4), notnull: false }
   relations:
     User:
       foreign: id
       local: user_id
       class: sfGuardUser
       onDelete: SET NULL

 // data fixtures
 sfGuardUser:
   Dieter:
     username:       Dieter
     password:       asd

 Profile:
   DieterProfile:
     sfGuardUser: Dieter

 // app.yml
 all:
   sf_guard_plugin:
     profile_class:      Profile
     profile_field_name: user_id
 }}}

 the error while loading the data is: Invalid fixture element "User" under
 "DieterProfile"

 ----
 the solution for me was to merge the two arrays instead of replacing it.
 I changed the line 602 in Schema.php:
 {{{
             $array[$className]['relations'] = $relations;
 }}}
 into:
 {{{
             $array[$className]['relations'] =
 array_merge($array[$className]['relations'],$relations);
 }}}

 schema.yml:

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1550#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to