views:

91

answers:

3

I keep getting: Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.

This happens when I include data for 'asset' in the 'Upload' table in my fixture.

See part of the schema.yml below:

    
detect_relations: true
options:
  collate: utf8_general_ci
  charset: utf8
  type: InnoDB

Asset:
  actAs: { Timestampable: ~ }
  columns:
    asset_id:
      type: integer
      primary: true
      notnull: true
      autoincrement: true
    asset_type_id:
      type: integer
      notnull: true
    user_id:
      type: integer(4)
      notnull: true
    name:
      type: string(45)


Upload:
  actAs: { Timestampable: ~ }
  columns:
    upload_id:
      type: integer
      primary: true
      notnull: true
      autoincrement: true
    asset_id:
      type: integer
      notnull: true
  relations:
    Asset:
      class: Asset
      local: asset_id
      foreign: asset_id
      foreignAlias: Assets
      type: many
      foreignType: one

Here's part of the Fixture:

Asset:
  sp_asset1:
    AssetType: Spain
    sfGuardUser: User_1
    name: The great Spanish song
    Category: Category_3
    description: The best Spanish Thing
    preview: http://www.google.com/sample.mp3
  sp_asset2:
    AssetType: British
    sfGuardUser: User_1
    name: The best mountains scok
    Category: Category_3
    description: A great example of British

## the problem happens below ##
Upload:
  Upload_1:
    asset: sp_asset1
  Upload_2:
    asset: sp_asset2

This happens when I include data for 'asset' in the 'Upload' table in my fixture Does anyone have an idea about this 'Couldn't call Doctrine_Core::set(), second argument...' problem?

A: 

Try:

Upload:
  Upload_1:
    asset: [sp_asset1]
  Upload_2:
    asset: [sp_asset2]
jeremy
A: 

Unfortunately, adding the brackets didn't prevent the error. Any other suggestions?

atentaten
A: 

Hi,

I hope you solved your problem.
I have a close question, and thinks it can be caused by the encoding.

Thks for your help !

Romain