thd/lib/form/doctrine/base/BaseThdFilmForm.class.php
author Julien Rougeron <julien.rougeron@iri.centrepompidou.fr>
Wed, 05 Sep 2012 11:59:22 +0200
changeset 69 98d445e789e4
parent 35 94a1dc255022
permissions -rw-r--r--
Hello world by Julien

<?php

/**
 * ThdFilm form base class.
 *
 * @package    form
 * @subpackage thd_film
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseThdFilmForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'ref'             => new sfWidgetFormDoctrineChoice(array('model' => 'ThdImage', 'add_empty' => false)),
      'title'           => new sfWidgetFormInput(),
      'pitch'           => new sfWidgetFormTextarea(),
      'duration'        => new sfWidgetFormInput(),
      'directors'       => new sfWidgetFormTextarea(),
      'actors'          => new sfWidgetFormTextarea(),
      'slug_url'        => new sfWidgetFormInput(),
      'original_title'  => new sfWidgetFormInput(),
      'production_year' => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm', 'column' => 'id', 'required' => false)),
      'ref'             => new sfValidatorDoctrineChoice(array('model' => 'ThdImage')),
      'title'           => new sfValidatorString(array('max_length' => 255)),
      'pitch'           => new sfValidatorString(array('max_length' => 2147483647)),
      'duration'        => new sfValidatorInteger(),
      'directors'       => new sfValidatorString(array('max_length' => 2147483647)),
      'actors'          => new sfValidatorString(array('max_length' => 2147483647)),
      'slug_url'        => new sfValidatorString(array('max_length' => 255)),
      'original_title'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'production_year' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('thd_film[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ThdFilm';
  }

}