Revision: 22461
Updated Code
at January 13, 2010 11:15 by rccc
Updated Code
# config/schema.yml
propel:
demo_ad:
id: ~
title: { type: varchar(255), required: true }
description: { type: longvarchar, required: true }
price: float
type: { type: varchar(255), required: true }
demo_ad_type_house:
id: ~
demo_ad_id: { type: integer, foreignTable: demo_ad, foreignReference: id, required: true }
square_footage: { type: integer, required: true }
nb_beds: { type: integer, required: true }
nb_baths: { type: integer, required: true }
year: { type: varchar(255), required: true }
demo_ad_type_car:
id: ~
demo_ad_id: { type: integer, foreignTable: demo_ad, foreignReference: id, required: true }
make: { type: varchar(255), required: true }
model: { type: varchar(255), required: true }
year: { type: varchar(255), required: true }
color: { type: varchar(255), required: true }
#/data/fixtures.yml
DemoAd:
house_1:
title: Farm
description: |
250 acres with irrigation, several shares of water rights, creek, spring and a well.
price: 2225000
type: house
car_1:
title: Honda Accor
description: |
Honda accord fully loaded, power windows, sun roof, new timing belt, new brakes, a/c , cd player.
price: 6900
type: car
DemoAdTypeHouse:
house_1_desc:
demo_ad_id: house_1
square_footage: 4500
nb_beds: 4
nb_baths: 3
year: 1910
DemoAdTypeCar:
car_1_desc:
demo_ad_id: car_1
make: honda
model: accor
year: 2002
color: green
Revision: 22460
Updated Code
at January 13, 2010 11:14 by rccc
Updated Code
# config/schema.yml
propel:
demo_ad:
id: ~
title: { type: varchar(255), required: true }
description: { type: longvarchar, required: true }
price: float
type: { type: varchar(255), required: true }
demo_ad_type_house:
id: ~
demo_ad_id: { type: integer, foreignTable: demo_ad, foreignReference: id, required: true }
square_footage: { type: integer, required: true }
nb_beds: { type: integer, required: true }
nb_baths: { type: integer, required: true }
year: { type: varchar(255), required: true }
demo_ad_type_car:
id: ~
demo_ad_id: { type: integer, foreignTable: demo_ad, foreignReference: id, required: true }
make: { type: varchar(255), required: true }
model: { type: varchar(255), required: true }
year: { type: varchar(255), required: true }
color: { type: varchar(255), required: true }
#/data/fixtures.yml
Revision: 22459
Updated Code
at January 13, 2010 04:03 by rccc
Updated Code
propel:
blog_article:
_attripropel:
blog_article:
_attributes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:butes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:
Symfony understands the usual column types: boolean, integer, float, date, varchar(size), longvarchar (converted, for instance, to text in MySQL), and so on.
For text content over 256 characters, you need to use the longvarchar type, which has no size (but cannot exceed 65KB in MySQL).
Revision: 22458
Updated Code
at January 13, 2010 03:59 by rccc
Updated Code
propel:
blog_article:
_attripropel:
blog_article:
_attributes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:butes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:
Symfony understands the usual column types: boolean, integer, float, date, varchar(size), longvarchar (converted, for instance, to text in MySQL), and so on. For text content over 256 characters, you need to use the longvarchar type, which has no size (but cannot exceed 65KB in MySQL).
Revision: 22457
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 13, 2010 03:57 by rccc
Initial Code
propel:
blog_article:
_attripropel:
blog_article:
_attributes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:butes: { phpName: Article }
id:
title: varchar(255)
content: longvarchar
created_at:
blog_comment:
_attributes: { phpName: Comment }
id:
article_id:
author: varchar(255)
content: longvarchar
created_at:
A table contains columns. The column value can be defined in three different ways:
* If you define nothing, symfony will guess the best attributes according to the column name and a few conventions that will be described in the "Empty Columns" section later in this chapter. For instance, the id column in Listing 8-3 doesn't need to be defined. Symfony will make it an auto-incremented integer, primary key of the table. The article_id in the blog_comment table will be understood as a foreign key to the blog_article table (columns ending with _id are considered to be foreign keys, and the related table is automatically determined according to the first part of the column name). Columns called created_at are automatically set to the timestamp type. For all these columns, you don't need to specify any type. This is one of the reasons why schema.yml is so easy to write.
* If you define only one attribute, it is the column type. Symfony understands the usual column types: boolean, integer, float, date, varchar(size), longvarchar (converted, for instance, to text in MySQL), and so on. For text content over 256 characters, you need to use the longvarchar type, which has no size (but cannot exceed 65KB in MySQL). Note that the date and timestamp types have the usual limitations of Unix dates and cannot be set to a date prior to 1970-01-01. As you may need to set older dates (for instance, for dates of birth), a format of dates "before Unix" can be used with bu_date and bu_timestamp.
* If you need to define other column attributes (like default value, required, and so on), you should write the column attributes as a set of key: value. This extended schema syntax is described later in the chapter.
A table contains columns. The column value can be defined in three different ways:
* If you define nothing, symfony will guess the best attributes according to the column name and a few conventions that will be described in the "Empty Columns" section later in this chapter. For instance, the id column in Listing 8-3 doesn't need to be defined. Symfony will make it an auto-incremented integer, primary key of the table. The article_id in the blog_comment table will be understood as a foreign key to the blog_article table (columns ending with _id are considered to be foreign keys, and the related table is automatically determined according to the first part of the column name). Columns called created_at are automatically set to the timestamp type. For all these columns, you don't need to specify any type. This is one of the reasons why schema.yml is so easy to write.
* If you define only one attribute, it is the column type. Symfony understands the usual column types: boolean, integer, float, date, varchar(size), longvarchar (converted, for instance, to text in MySQL), and so on. For text content over 256 characters, you need to use the longvarchar type, which has no size (but cannot exceed 65KB in MySQL). Note that the date and timestamp types have the usual limitations of Unix dates and cannot be set to a date prior to 1970-01-01. As you may need to set older dates (for instance, for dates of birth), a format of dates "before Unix" can be used with bu_date and bu_timestamp.
* If you need to define other column attributes (like default value, required, and so on), you should write the column attributes as a set of key: value. This extended schema syntax is described later in the chapter.
Initial URL
http://www.symfony-project.org/blog/2008/11/10/call-the-expert-nested-forms-a-real-implementation
Initial Description
Initial Title
schema.yml template
Initial Tags
Initial Language
XML