Ask your Symfony questions! Pay money and get answers fast! (more info)

I need help with schema and propel-build-model in Symfony 1.0 Symfony

  • SOLVED

Symfony version 1.0.20

This is the first time I've ever worked with version 1.0 of Symfony (I started using Symfony at version 1.1 and have never before had to work on an old installation).

I'm converting an old Java site to Symfony. I am just starting on this project, but the project has been ongoing. Parts of the Symfony site have been under development for 2 years. This company is slowly changing all of their code from the 90s and early 00s over to Symfony. However, for some reason they chose not to use the YAML files. They hand coded all their model classes.

I just created the first entry for a table in the top level config/schema.yml:

propel:
oracle_import:
id: { type:integer, required: true, primaryKey: true, autoIncrement: true }
type_id: { type:integer, required:false }
title: { type:varchar(255), required:false }
byline: { type:varchar(255), required:false }
header: { type:longvarchar, required:false }
subheader: { type:longvarchar, required:false }
body: { type:longvarchar, required:false }
footer: { type:longvarchar, required:false }
live_flag: { type:varchar(1), required:false }
date: { type:timestamp, required:false }
created_by_user: { type:varchar(30), required:false }
modify_by_user: { type:varchar(30), required:false }


I wanted to auto-generate the model class for this. I looked here to find the right command for version 1.0 of Symfony:

http://www.symfony-project.org/book/1_0/08-Inside-the-Model-Layer

Then I ran this command:

symfony propel-build-model

I got this error:

Fatal error: Unsupported operand types in /usr/share/php/symfony/util/Spyc.class.php on line 667

Does anyone know what this means? How to troubleshoot this?

Answers (5)

2010-04-05

Wouter Peschier answers:

It could be a problem with not having space after the colon.

So instead of writing:
id: { type:integer, required: true, primaryKey: true, autoIncrement: true }
type_id: { type:integer, required:false }
etc.

write it like this:
id: { type: integer, required: true, primaryKey: true, autoIncrement: true }
type_id: { type: integer, required: false }
etc.

2010-04-05

Arturo Linares answers:

You need a space after each colon.

Replace:
id: { type:integer ...
with
id: { type: integer

2010-04-05

Marcos IbaƱez answers:

You have to put a blank space between every colon and it's value.

Do that for each pair of label-value and it will work without problems.

Here is the correct yaml file:


propel:
oracle_import:
id: { type: integer, required: true, primaryKey: true, autoIncrement: true }
type_id: { type: integer, required: false }
title: { type: varchar(255), required: false }
byline: { type: varchar(255), required: false }
header: { type: longvarchar, required: false }
subheader: { type: longvarchar, required: false }
body: { type: longvarchar, required: false }
footer: { type: longvarchar, required: false }
live_flag: { type: varchar(1), required: false }
date: { type: timestamp, required: false }
created_by_user: { type: varchar(30), required: false }
modify_by_user: { type: varchar(30), required: false }

I attach an image of how the text should be formatted for it to work.

2010-04-05

Dan Tudor answers:

The yaml you posted works fine with symfony 1.2.3

What version of symfony are you using ? (./symfony -V)


Dan Tudor comments:

Just noticed you posted your symfony version in the question...
You should upgrade to version 1.3 as 1.0 is no longer maintained.

2010-04-05

casivaagustin answers:

The problem its the spaces like the other answers say. You must put a blank space after the semicolon, just like Marcos explained.

After you change your schema you must run.

symfony propel-build-model

And don't forget

symfony cc

Cheers