--- a/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Mar 24 14:54:32 2010 +0100
@@ -2,7 +2,7 @@
// Charge le player
flowplayer("player", "<?php echo flash_path('/flashes/flowplayer-3.1.2.swf') ?>",
{
- clip: {url: "<?php echo video_path($filmVideo['file'].'.f4v'); ?>",
+ clip: {url: "<?php echo video_path($filmVideo['file']); ?>",
autoPlay: false,
autoBuffering: true,
onSeek: function() {
--- a/web/thdProject/config/doctrine/schema.yml Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/config/doctrine/schema.yml Wed Mar 24 14:54:32 2010 +0100
@@ -3,9 +3,11 @@
columns:
id:
type: integer(4)
+ unsigned: 1
primary: true
+ autoincrement: true
ref:
- type: integer(4)
+ type: string(255)
notnull: true
title:
type: string(255)
@@ -42,29 +44,27 @@
columns:
id:
type: integer(4)
+ unsigned: 1
primary: true
autoincrement: true
- film_ref:
- type: integer(4)
- notnull: true
type:
type: integer(1)
notnull: true
file:
type: string(255)
notnull: true
+ film_id:
+ type: integer(4)
+ unsigned: 1
+ notnull: true
relations:
- ThdFilm:
- foreignAlias: images
- local: film_ref
- foreign: ref
- type: one
- foreignType: many
+ ThdFilm: { onDelete: CASCADE, local: film_id, foreign: id, foreignAlias: images }
ThdSegment:
tableName: thd_segment
columns:
id:
type: integer(4)
+ unsigned: 1
primary: true
autoincrement: true
title:
@@ -94,38 +94,34 @@
uniqueid:
type: string(36)
notnull: true
+ video_id:
+ type: integer(4)
+ unsigned: 1
+ notnull: true
indexes:
uniqueidindex:
fields: [uniqueid]
- type: unique
+ type: unique
relations:
- ThdVideo:
- foreignAlias: segments
- local: video_ref
- foreign: ref
- type: one
- foreignType: many
+ ThdVideo: { onDelete: CASCADE, local: video_id, foreign: id, foreignAlias: segments }
ThdVideo:
tableName: thd_video
columns:
id:
type: integer(4)
+ unsigned: 1
primary: true
autoincrement: true
ref:
- type: integer(4)
- notnull: true
- film_ref:
- type: integer(4)
+ type: string(255)
notnull: true
file:
type: string(255)
notnull: true
title: string(255)
+ film_id:
+ type: integer(4)
+ unsigned: 1
+ notnull: true
relations:
- ThdFilm:
- foreignAlias: videos
- local: film_ref
- foreign: ref
- type: one
- foreignType: many
+ ThdFilm: { onDelete: CASCADE, local: film_id, foreign: id, foreignAlias: videos }
\ No newline at end of file
--- a/web/thdProject/data/fixtures/data.yml Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/data/fixtures/data.yml Wed Mar 24 14:54:32 2010 +0100
@@ -1,6 +1,6 @@
ThdFilm:
ThdFilm_1:
- images: ThdImage_29001
+ ref: '029001'
title: '17, rue Bleue'
pitch: '1967 : cinq ans après sa fuite d''Algérie, Adda vit à Paris, avec ses deux enfants et ses deux soeurs. Elle vit une aventure amoureuse avec son patron, mais ce sont les fantômes du passé qui sont les plus forts...'
duration: '95'
@@ -12,7 +12,7 @@
production_year: '2000'
uniqueid: '1'
ThdFilm_2:
- images: ThdImage_25001
+ ref: '025001'
title: 'A travers la forêt'
pitch: 'Armelle n''arrive pas à oublier Renaud. Elle le voit, elle chante pour lui, elle l''étreint. Elle lui parle toujours. Pourtant, Renaud est mort... Mais pas pour elle. C''est un accident de moto ; Armelle n''arrive pas à l''oublier et croit que son amant continue à vivre auprès d''elle. Et puis elle rencontre Hippolyte, qui ressemble trait pour trait à Renaud.'
duration: '65'
@@ -24,7 +24,7 @@
production_year: '2004'
uniqueid: '2'
ThdFilm_3:
- images: ThdImage_13002
+ ref: '039031'
title: 'Après lui'
pitch: 'Camille voit sa vie brisée par la disparition de son fils dans un accident de la route. Incapable de faire le deuil, elle s''attache à Franck, le meilleur ami de celui-ci, qui est aussi le responsable du drame. Qu''importe le scandale, Franck devient l''objet consentant de son affection. Mais, peu à peu, il va prendre conscience que l''obsession de Camille le met en danger.'
duration: '93'
@@ -36,7 +36,7 @@
production_year: '2006'
uniqueid: '3'
ThdFilm_4:
- images: ThdImage_39031
+ ref: '013002'
title: 'Buenos Aires 100 km'
pitch: 'A 100 km de Buenos Aires, un village comme tant d''autres, où le temps semble suspendu. Cinq amis de toujours y passent l''été de leurs 13 ans. Ils observent, rêvent, discutent, questionnent. C''est aussi l''été des premières fois : l''amour, le sexe, les cigarettes... Les secrets du village sont leurs principales préoccupations, en même temps que l''envie d''en partir.'
duration: '93'
@@ -49,35 +49,39 @@
uniqueid: '4'
ThdImage:
ThdImage_1:
- ThdFilm: ThdFilm_39031
+ ThdFilm: ThdFilm_1
type: '1'
file: 1482b3f8-7c56-11de-94a8-99b39278c804
ThdImage_2:
- ThdFilm: ThdFilm_13002
+ ThdFilm: ThdFilm_2
type: '1'
file: 2b95e3dc-7c56-11de-b8e9-8d849c1c2c06
ThdImage_3:
- ThdFilm: ThdFilm_25001
+ ThdFilm: ThdFilm_1
type: '1'
file: 0625c797-7c56-11de-bfb5-5b02eae1fc54
ThdImage_4:
- ThdFilm: ThdFilm_29001
+ ThdFilm: ThdFilm_2
type: '1'
file: 0c45e138-7c56-11de-a235-375dca301e99
ThdVideo:
ThdVideo_1:
- ThdFilm: ThdFilm_29001
- file: 029001_17-rue-bleue
+ ThdFilm: ThdFilm_1
+ ref: '029001'
+ file: 029001_17-rue-bleue.f4v
title: 'Trailer 17 rue bleue'
ThdVideo_2:
- ThdFilm: ThdFilm_25001
- file: 025001_a-travers-la-foret
+ ThdFilm: ThdFilm_2
+ ref: '025001'
+ file: 025001_a-travers-la-foret.f4v
title: 'Trailer à travers la forêt'
ThdVideo_3:
- ThdFilm: ThdFilm_39031
- file: 039031_buenos-aires-100-km
+ ThdFilm: ThdFilm_3
+ ref: '039031'
+ file: 039031_buenos-aires-100-km.f4v
title: 'Trailer Buenos Aires 100km'
ThdVideo_4:
- ThdFilm: ThdFilm_13002
- file: 013002_apres-lui
+ ThdFilm: ThdFilm_4
+ ref: '013002'
+ file: 013002_apres-lui.f4v
title: 'Trailer Après lui'
--- a/web/thdProject/data/sql/schema.sql Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/data/sql/schema.sql Wed Mar 24 14:54:32 2010 +0100
@@ -1,7 +1,7 @@
-CREATE TABLE thd_film (id INT, ref INT NOT NULL, title VARCHAR(255) NOT NULL, pitch TEXT NOT NULL, duration INT NOT NULL, directors TEXT NOT NULL, actors TEXT NOT NULL, slug_url VARCHAR(255) NOT NULL, original_title VARCHAR(255), production_countries TEXT NOT NULL, production_year BIGINT, uniqueid VARCHAR(36) NOT NULL, UNIQUE INDEX uniqueidindex_idx (uniqueid), PRIMARY KEY(id)) ENGINE = INNODB;
-CREATE TABLE thd_image (id INT AUTO_INCREMENT, film_ref INT NOT NULL, type TINYINT NOT NULL, file VARCHAR(255) NOT NULL, INDEX film_ref_idx (film_ref), PRIMARY KEY(id)) ENGINE = INNODB;
-CREATE TABLE thd_video (id INT AUTO_INCREMENT, ref INT NOT NULL, film_ref INT NOT NULL, file VARCHAR(255) NOT NULL, title VARCHAR(255), INDEX film_ref_idx (film_ref), PRIMARY KEY(id)) ENGINE = INNODB;
-CREATE TABLE thd_segment (id INT AUTO_INCREMENT, title VARCHAR(255), tags TEXT, description TEXT, video_ref INT NOT NULL, start DOUBLE NOT NULL, end DOUBLE NOT NULL, user_id INT NOT NULL, creation_date DATETIME NOT NULL, uniqueid VARCHAR(36) NOT NULL, UNIQUE INDEX uniqueidindex_idx (uniqueid), INDEX video_ref_idx (video_ref), PRIMARY KEY(id)) ENGINE = INNODB;
-ALTER TABLE thd_image ADD FOREIGN KEY (film_ref) REFERENCES thd_film(ref);
-ALTER TABLE thd_video ADD FOREIGN KEY (film_ref) REFERENCES thd_film(ref);
-ALTER TABLE thd_segment ADD FOREIGN KEY (video_ref) REFERENCES thd_video(ref);
+CREATE TABLE thd_film (id INT UNSIGNED AUTO_INCREMENT, ref VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, pitch TEXT NOT NULL, duration INT NOT NULL, directors TEXT NOT NULL, actors TEXT NOT NULL, slug_url VARCHAR(255) NOT NULL, original_title VARCHAR(255), production_countries TEXT NOT NULL, production_year BIGINT, uniqueid VARCHAR(36) NOT NULL, UNIQUE INDEX uniqueidindex_idx (uniqueid), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE thd_image (id INT UNSIGNED AUTO_INCREMENT, type TINYINT NOT NULL, file VARCHAR(255) NOT NULL, film_id INT UNSIGNED NOT NULL, INDEX film_id_idx (film_id), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE thd_video (id INT UNSIGNED AUTO_INCREMENT, ref VARCHAR(255) NOT NULL, file VARCHAR(255) NOT NULL, title VARCHAR(255), film_id INT UNSIGNED NOT NULL, INDEX film_id_idx (film_id), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE thd_segment (id INT UNSIGNED AUTO_INCREMENT, title VARCHAR(255), tags TEXT, description TEXT, video_ref INT NOT NULL, start DOUBLE NOT NULL, end DOUBLE NOT NULL, user_id INT NOT NULL, creation_date DATETIME NOT NULL, uniqueid VARCHAR(36) NOT NULL, video_id INT UNSIGNED NOT NULL, UNIQUE INDEX uniqueidindex_idx (uniqueid), INDEX video_id_idx (video_id), PRIMARY KEY(id)) ENGINE = INNODB;
+ALTER TABLE thd_image ADD FOREIGN KEY (film_id) REFERENCES thd_film(id) ON DELETE CASCADE;
+ALTER TABLE thd_video ADD FOREIGN KEY (film_id) REFERENCES thd_film(id) ON DELETE CASCADE;
+ALTER TABLE thd_segment ADD FOREIGN KEY (video_id) REFERENCES thd_video(id) ON DELETE CASCADE;
--- a/web/thdProject/lib/filter/doctrine/base/BaseThdFilmFormFilter.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/filter/doctrine/base/BaseThdFilmFormFilter.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -14,7 +14,7 @@
public function setup()
{
$this->setWidgets(array(
- 'ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdImage', 'add_empty' => true)),
+ 'ref' => new sfWidgetFormFilterInput(),
'title' => new sfWidgetFormFilterInput(),
'pitch' => new sfWidgetFormFilterInput(),
'duration' => new sfWidgetFormFilterInput(),
@@ -28,7 +28,7 @@
));
$this->setValidators(array(
- 'ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdImage', 'column' => 'id')),
+ 'ref' => new sfValidatorPass(array('required' => false)),
'title' => new sfValidatorPass(array('required' => false)),
'pitch' => new sfValidatorPass(array('required' => false)),
'duration' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
@@ -57,7 +57,7 @@
{
return array(
'id' => 'Number',
- 'ref' => 'ForeignKey',
+ 'ref' => 'Text',
'title' => 'Text',
'pitch' => 'Text',
'duration' => 'Number',
--- a/web/thdProject/lib/filter/doctrine/base/BaseThdImageFormFilter.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/filter/doctrine/base/BaseThdImageFormFilter.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -14,15 +14,15 @@
public function setup()
{
$this->setWidgets(array(
- 'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
- 'type' => new sfWidgetFormFilterInput(),
- 'file' => new sfWidgetFormFilterInput(),
+ 'type' => new sfWidgetFormFilterInput(),
+ 'file' => new sfWidgetFormFilterInput(),
+ 'film_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
));
$this->setValidators(array(
- 'film_ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdFilm', 'column' => 'id')),
- 'type' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
- 'file' => new sfValidatorPass(array('required' => false)),
+ 'type' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
+ 'file' => new sfValidatorPass(array('required' => false)),
+ 'film_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdFilm', 'column' => 'id')),
));
$this->widgetSchema->setNameFormat('thd_image_filters[%s]');
@@ -40,10 +40,10 @@
public function getFields()
{
return array(
- 'id' => 'Number',
- 'film_ref' => 'ForeignKey',
- 'type' => 'Number',
- 'file' => 'Text',
+ 'id' => 'Number',
+ 'type' => 'Number',
+ 'file' => 'Text',
+ 'film_id' => 'ForeignKey',
);
}
}
\ No newline at end of file
--- a/web/thdProject/lib/filter/doctrine/base/BaseThdSegmentFormFilter.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/filter/doctrine/base/BaseThdSegmentFormFilter.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -17,24 +17,26 @@
'title' => new sfWidgetFormFilterInput(),
'tags' => new sfWidgetFormFilterInput(),
'description' => new sfWidgetFormFilterInput(),
- 'video_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => true)),
+ 'video_ref' => new sfWidgetFormFilterInput(),
'start' => new sfWidgetFormFilterInput(),
'end' => new sfWidgetFormFilterInput(),
'user_id' => new sfWidgetFormFilterInput(),
'creation_date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
'uniqueid' => new sfWidgetFormFilterInput(),
+ 'video_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => true)),
));
$this->setValidators(array(
'title' => new sfValidatorPass(array('required' => false)),
'tags' => new sfValidatorPass(array('required' => false)),
'description' => new sfValidatorPass(array('required' => false)),
- 'video_ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdVideo', 'column' => 'id')),
+ 'video_ref' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
'start' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
'end' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
'user_id' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
'creation_date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
'uniqueid' => new sfValidatorPass(array('required' => false)),
+ 'video_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdVideo', 'column' => 'id')),
));
$this->widgetSchema->setNameFormat('thd_segment_filters[%s]');
@@ -56,12 +58,13 @@
'title' => 'Text',
'tags' => 'Text',
'description' => 'Text',
- 'video_ref' => 'ForeignKey',
+ 'video_ref' => 'Number',
'start' => 'Number',
'end' => 'Number',
'user_id' => 'Number',
'creation_date' => 'Date',
'uniqueid' => 'Text',
+ 'video_id' => 'ForeignKey',
);
}
}
\ No newline at end of file
--- a/web/thdProject/lib/filter/doctrine/base/BaseThdVideoFormFilter.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/filter/doctrine/base/BaseThdVideoFormFilter.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -14,17 +14,17 @@
public function setup()
{
$this->setWidgets(array(
- 'ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdSegment', 'add_empty' => true)),
- 'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
- 'file' => new sfWidgetFormFilterInput(),
- 'title' => new sfWidgetFormFilterInput(),
+ 'ref' => new sfWidgetFormFilterInput(),
+ 'file' => new sfWidgetFormFilterInput(),
+ 'title' => new sfWidgetFormFilterInput(),
+ 'film_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
));
$this->setValidators(array(
- 'ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdSegment', 'column' => 'id')),
- 'film_ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdFilm', 'column' => 'id')),
- 'file' => new sfValidatorPass(array('required' => false)),
- 'title' => new sfValidatorPass(array('required' => false)),
+ 'ref' => new sfValidatorPass(array('required' => false)),
+ 'file' => new sfValidatorPass(array('required' => false)),
+ 'title' => new sfValidatorPass(array('required' => false)),
+ 'film_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdFilm', 'column' => 'id')),
));
$this->widgetSchema->setNameFormat('thd_video_filters[%s]');
@@ -42,11 +42,11 @@
public function getFields()
{
return array(
- 'id' => 'Number',
- 'ref' => 'ForeignKey',
- 'film_ref' => 'ForeignKey',
- 'file' => 'Text',
- 'title' => 'Text',
+ 'id' => 'Number',
+ 'ref' => 'Text',
+ 'file' => 'Text',
+ 'title' => 'Text',
+ 'film_id' => 'ForeignKey',
);
}
}
\ No newline at end of file
--- a/web/thdProject/lib/form/doctrine/base/BaseThdFilmForm.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/form/doctrine/base/BaseThdFilmForm.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -13,7 +13,7 @@
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
- 'ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdImage', 'add_empty' => false)),
+ 'ref' => new sfWidgetFormInput(),
'title' => new sfWidgetFormInput(),
'pitch' => new sfWidgetFormTextarea(),
'duration' => new sfWidgetFormInput(),
@@ -28,7 +28,7 @@
$this->setValidators(array(
'id' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm', 'column' => 'id', 'required' => false)),
- 'ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdImage')),
+ 'ref' => new sfValidatorString(array('max_length' => 255)),
'title' => new sfValidatorString(array('max_length' => 255)),
'pitch' => new sfValidatorString(array('max_length' => 2147483647)),
'duration' => new sfValidatorInteger(),
--- a/web/thdProject/lib/form/doctrine/base/BaseThdImageForm.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/form/doctrine/base/BaseThdImageForm.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -12,17 +12,17 @@
public function setup()
{
$this->setWidgets(array(
- 'id' => new sfWidgetFormInputHidden(),
- 'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => false)),
- 'type' => new sfWidgetFormInput(),
- 'file' => new sfWidgetFormInput(),
+ 'id' => new sfWidgetFormInputHidden(),
+ 'type' => new sfWidgetFormInput(),
+ 'file' => new sfWidgetFormInput(),
+ 'film_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => false)),
));
$this->setValidators(array(
- 'id' => new sfValidatorDoctrineChoice(array('model' => 'ThdImage', 'column' => 'id', 'required' => false)),
- 'film_ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm')),
- 'type' => new sfValidatorInteger(),
- 'file' => new sfValidatorString(array('max_length' => 255)),
+ 'id' => new sfValidatorDoctrineChoice(array('model' => 'ThdImage', 'column' => 'id', 'required' => false)),
+ 'type' => new sfValidatorInteger(),
+ 'file' => new sfValidatorString(array('max_length' => 255)),
+ 'film_id' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm')),
));
$this->widgetSchema->setNameFormat('thd_image[%s]');
--- a/web/thdProject/lib/form/doctrine/base/BaseThdSegmentForm.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/form/doctrine/base/BaseThdSegmentForm.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -16,12 +16,13 @@
'title' => new sfWidgetFormInput(),
'tags' => new sfWidgetFormTextarea(),
'description' => new sfWidgetFormTextarea(),
- 'video_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => false)),
+ 'video_ref' => new sfWidgetFormInput(),
'start' => new sfWidgetFormInput(),
'end' => new sfWidgetFormInput(),
'user_id' => new sfWidgetFormInput(),
'creation_date' => new sfWidgetFormDateTime(),
'uniqueid' => new sfWidgetFormInput(),
+ 'video_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => false)),
));
$this->setValidators(array(
@@ -29,12 +30,13 @@
'title' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
'tags' => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
'description' => new sfValidatorString(array('max_length' => 2147483647, 'required' => false)),
- 'video_ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo')),
+ 'video_ref' => new sfValidatorInteger(),
'start' => new sfValidatorNumber(),
'end' => new sfValidatorNumber(),
'user_id' => new sfValidatorInteger(),
'creation_date' => new sfValidatorDateTime(),
'uniqueid' => new sfValidatorString(array('max_length' => 36)),
+ 'video_id' => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo')),
));
$this->validatorSchema->setPostValidator(
--- a/web/thdProject/lib/form/doctrine/base/BaseThdVideoForm.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/form/doctrine/base/BaseThdVideoForm.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -12,19 +12,19 @@
public function setup()
{
$this->setWidgets(array(
- 'id' => new sfWidgetFormInputHidden(),
- 'ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdSegment', 'add_empty' => false)),
- 'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => false)),
- 'file' => new sfWidgetFormInput(),
- 'title' => new sfWidgetFormInput(),
+ 'id' => new sfWidgetFormInputHidden(),
+ 'ref' => new sfWidgetFormInput(),
+ 'file' => new sfWidgetFormInput(),
+ 'title' => new sfWidgetFormInput(),
+ 'film_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => false)),
));
$this->setValidators(array(
- 'id' => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo', 'column' => 'id', 'required' => false)),
- 'ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdSegment')),
- 'film_ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm')),
- 'file' => new sfValidatorString(array('max_length' => 255)),
- 'title' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
+ 'id' => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo', 'column' => 'id', 'required' => false)),
+ 'ref' => new sfValidatorString(array('max_length' => 255)),
+ 'file' => new sfValidatorString(array('max_length' => 255)),
+ 'title' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
+ 'film_id' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm')),
));
$this->widgetSchema->setNameFormat('thd_video[%s]');
--- a/web/thdProject/lib/model/doctrine/base/BaseThdFilm.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/model/doctrine/base/BaseThdFilm.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -10,13 +10,15 @@
$this->setTableName('thd_film');
$this->hasColumn('id', 'integer', 4, array(
'type' => 'integer',
+ 'unsigned' => '1',
'primary' => true,
+ 'autoincrement' => true,
'length' => '4',
));
- $this->hasColumn('ref', 'integer', 4, array(
- 'type' => 'integer',
+ $this->hasColumn('ref', 'string', 255, array(
+ 'type' => 'string',
'notnull' => true,
- 'length' => '4',
+ 'length' => '255',
));
$this->hasColumn('title', 'string', 255, array(
'type' => 'string',
@@ -80,11 +82,11 @@
public function setUp()
{
$this->hasMany('ThdImage as images', array(
- 'local' => 'ref',
- 'foreign' => 'film_ref'));
+ 'local' => 'id',
+ 'foreign' => 'film_id'));
$this->hasMany('ThdVideo as videos', array(
- 'local' => 'ref',
- 'foreign' => 'film_ref'));
+ 'local' => 'id',
+ 'foreign' => 'film_id'));
}
}
\ No newline at end of file
--- a/web/thdProject/lib/model/doctrine/base/BaseThdImage.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/model/doctrine/base/BaseThdImage.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -10,15 +10,11 @@
$this->setTableName('thd_image');
$this->hasColumn('id', 'integer', 4, array(
'type' => 'integer',
+ 'unsigned' => '1',
'primary' => true,
'autoincrement' => true,
'length' => '4',
));
- $this->hasColumn('film_ref', 'integer', 4, array(
- 'type' => 'integer',
- 'notnull' => true,
- 'length' => '4',
- ));
$this->hasColumn('type', 'integer', 1, array(
'type' => 'integer',
'notnull' => true,
@@ -29,12 +25,19 @@
'notnull' => true,
'length' => '255',
));
+ $this->hasColumn('film_id', 'integer', 4, array(
+ 'type' => 'integer',
+ 'unsigned' => '1',
+ 'notnull' => true,
+ 'length' => '4',
+ ));
}
public function setUp()
{
$this->hasOne('ThdFilm', array(
- 'local' => 'film_ref',
- 'foreign' => 'ref'));
+ 'local' => 'film_id',
+ 'foreign' => 'id',
+ 'onDelete' => 'CASCADE'));
}
}
\ No newline at end of file
--- a/web/thdProject/lib/model/doctrine/base/BaseThdSegment.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/model/doctrine/base/BaseThdSegment.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -10,6 +10,7 @@
$this->setTableName('thd_segment');
$this->hasColumn('id', 'integer', 4, array(
'type' => 'integer',
+ 'unsigned' => '1',
'primary' => true,
'autoincrement' => true,
'length' => '4',
@@ -56,6 +57,12 @@
'notnull' => true,
'length' => '36',
));
+ $this->hasColumn('video_id', 'integer', 4, array(
+ 'type' => 'integer',
+ 'unsigned' => '1',
+ 'notnull' => true,
+ 'length' => '4',
+ ));
$this->index('uniqueidindex', array(
@@ -70,7 +77,8 @@
public function setUp()
{
$this->hasOne('ThdVideo', array(
- 'local' => 'video_ref',
- 'foreign' => 'ref'));
+ 'local' => 'video_id',
+ 'foreign' => 'id',
+ 'onDelete' => 'CASCADE'));
}
}
\ No newline at end of file
--- a/web/thdProject/lib/model/doctrine/base/BaseThdVideo.class.php Wed Mar 24 14:27:53 2010 +0100
+++ b/web/thdProject/lib/model/doctrine/base/BaseThdVideo.class.php Wed Mar 24 14:54:32 2010 +0100
@@ -10,19 +10,15 @@
$this->setTableName('thd_video');
$this->hasColumn('id', 'integer', 4, array(
'type' => 'integer',
+ 'unsigned' => '1',
'primary' => true,
'autoincrement' => true,
'length' => '4',
));
- $this->hasColumn('ref', 'integer', 4, array(
- 'type' => 'integer',
+ $this->hasColumn('ref', 'string', 255, array(
+ 'type' => 'string',
'notnull' => true,
- 'length' => '4',
- ));
- $this->hasColumn('film_ref', 'integer', 4, array(
- 'type' => 'integer',
- 'notnull' => true,
- 'length' => '4',
+ 'length' => '255',
));
$this->hasColumn('file', 'string', 255, array(
'type' => 'string',
@@ -33,16 +29,23 @@
'type' => 'string',
'length' => '255',
));
+ $this->hasColumn('film_id', 'integer', 4, array(
+ 'type' => 'integer',
+ 'unsigned' => '1',
+ 'notnull' => true,
+ 'length' => '4',
+ ));
}
public function setUp()
{
$this->hasOne('ThdFilm', array(
- 'local' => 'film_ref',
- 'foreign' => 'ref'));
+ 'local' => 'film_id',
+ 'foreign' => 'id',
+ 'onDelete' => 'CASCADE'));
$this->hasMany('ThdSegment as segments', array(
- 'local' => 'ref',
- 'foreign' => 'video_ref'));
+ 'local' => 'id',
+ 'foreign' => 'video_id'));
}
}
\ No newline at end of file