Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### my schema.yml
- Codecs:
- tableName: codecs
- columns:
- ...
- relations:
- DetalhamentoSip:
- class: DetalhamentoSip
- refClass: DetalhamentoSipCodecs
- local: codecs_id
- foreign: detalhamento_sip_id
- DetalhamentoSipCodecs:
- tableName: detalhamento_sip_codecs
- columns:
- id:
- type: integer(4)
- primary: true
- autoincrement: true
- codecs_id:
- type: integer(4)
- detalhamento_sip_id:
- type: integer(4)
- DetalhamentoSip:
- tableName: detalhamento_sip
- columns:
- ...
- relations:
- Codecs:
- class: Codecs
- refClass: DetalhamentoSipCodecs
- local: detalhamento_sip_id
- foreign: codecs_id
- #### my form:
- <?php
- /**
- * DetalhamentoSip form.
- *
- * @package neuwald
- * @subpackage form
- * @author Your name here
- * @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
- */
- class DetalhamentoSipForm extends BaseDetalhamentoSipForm
- {
- public function configure()
- {
- $this->setWidgets(array(
- 'id' => new sfWidgetFormInputHidden(),
- 'nome_do_dispositivo' => new sfWidgetFormInputText(),
- 'habilitado' => new sfWidgetFormInputCheckbox(),
- 'type' => new sfWidgetFormChoice(array('choices' => array('USER' => 'USER', 'PEER' => 'PEER', 'FRIEND' => 'FRIEND'))),
- 'username' => new sfWidgetFormInputText(),
- 'host' => new sfWidgetFormInputText(),
- 'caller_id' => new sfWidgetFormInputText(),
- 'secret' => new sfWidgetFormInputText(),
- 'context' => new sfWidgetFormInputText(),
- 'codecs' => $this->widgetSchema['codecs_list']->setOption('renderer_class', 'sfWidgetFormSelectDoubleList'),
- 'dtmf_mode' => new sfWidgetFormChoice(array('choices' => array('rfc2833' => 'rfc2833', 'info' => 'info', 'inband' => 'inband', 'auto' => 'auto'))),
- 'can_reinvite' => new sfWidgetFormChoice(array('choices' => array('yes' => 'yes', 'no' => 'no', 'nonat' => 'nonat'))),
- 'nat' => new sfWidgetFormInputCheckbox(),
- 'qualify' => new sfWidgetFormInputCheckbox(),
- 'from_domain' => new sfWidgetFormInputText(),
- 'from_user' => new sfWidgetFormInputText(),
- 'port' => new sfWidgetFormInputText(),
- 'call_limit' => new sfWidgetFormInputText(),
- 'allow_transfer' => new sfWidgetFormInputCheckbox(),
- 'account_code' => new sfWidgetFormInputText(),
- 'in_secure' => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'invite' => 'invite', 'port' => 'port', 'port, invite' => 'port, invite'))),
- 'progress_in_band' => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'yes' => 'yes', 'never' => 'never'))),
- 'promisc_redirect' => new sfWidgetFormInputCheckbox(),
- 'user_client_code' => new sfWidgetFormInputCheckbox(),
- 'set_var' => new sfWidgetFormInputText(),
- 'mail_box' => new sfWidgetFormInputText(),
- 'video_support' => new sfWidgetFormInputCheckbox(),
- 'language' => new sfWidgetFormChoice(array('choices' => array('en' => 'en', 'pt_br' => 'pt_br'))),
- 'md5_secret' => new sfWidgetFormInputText(),
- ));
- $this->setValidators(array(
- 'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
- 'nome_do_dispositivo' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => true)),
- 'habilitado' => new sfValidatorBoolean(array('required' => false)),
- 'type' => new sfValidatorChoice(array('choices' => array(0 => 'USER', 1 => 'PEER', 2 => 'FRIEND'), 'required' => true)),
- 'username' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => false)),
- 'host' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
- 'caller_id' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
- 'secret' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
- 'context' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => true)),
- 'codecs' => new sfValidatorDoctrineChoice(array('model' => 'Codecs', 'multiple' => true, 'required' => false)),
- 'dtmf_mode' => new sfValidatorChoice(array('choices' => array(0 => 'rfc2833', 1 => 'info', 2 => 'inband', 3 => 'auto'), 'required' => false)),
- 'can_reinvite' => new sfValidatorChoice(array('choices' => array(0 => 'yes', 1 => 'no', 2 => 'nonat'), 'required' => false)),
- 'nat' => new sfValidatorBoolean(array('required' => false)),
- 'qualify' => new sfValidatorBoolean(array('required' => false)),
- 'from_domain' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
- 'from_user' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
- 'port' => new sfValidatorInteger(array('required' => false)),
- 'call_limit' => new sfValidatorInteger(array('required' => false)),
- 'allow_transfer' => new sfValidatorBoolean(array('required' => false)),
- 'account_code' => new sfValidatorRegex(array('max_length' => 8, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => false)),
- 'in_secure' => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'invite', 2 => 'port', 3 => 'port, invite'), 'required' => false)),
- 'progress_in_band' => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'yes', 2 => 'never'), 'required' => false)),
- 'promisc_redirect' => new sfValidatorBoolean(array('required' => false)),
- 'user_client_code' => new sfValidatorBoolean(array('required' => false)),
- 'set_var' => new sfValidatorString(array('max_length' => 64, 'required' => false)),
- 'mail_box' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
- 'video_support' => new sfValidatorBoolean(array('required' => false)),
- 'language' => new sfValidatorChoice(array('choices' => array(0 => 'en', 1 => 'pt_br'), 'required' => false)),
- 'md5_secret' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
- ));
- $this->widgetSchema->setNameFormat('detalhamento_sip[%s]');
- $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
- $this->setupInheritance();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement