/** * {@inheritDoc} */ public function getNome() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getNome', array()); return parent::getNome(); }
public function __construct(EntityManager $em, $publicador = null, OrmGrupo $orm = null) { parent::__construct("formGrupo"); $dao = $em->getRepository('Stj\\Entity\\OrmCongregacao'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $congregacao = new OrmCongregacao(); $congregacao = $value; $option[$congregacao->getId()] = $congregacao->getNome(); } // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtNome = new Element\Text("nome"); $txtNome->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'data-parsley-trigger' => 'change', 'pattern' => '^[aA-zZ0-9]+((\\s[aA-zZ0-9]+)+)?$', 'required' => 'true')); /* * cmbCongregacao */ $cmbCongregacao = new Element\Select('congregacao'); $cmbCongregacao->setValueOptions($option); $cmbCongregacao->setEmptyOption("Escolha a congregação"); $cmbCongregacao->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtCep */ $txtCep = new Element\Text("cep"); $txtCep->setAttributes(array('class' => 'form-control', 'placeholder' => 'XXXXXXXX', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]{2}[0-9]{3}[0-9]{3}$/', 'max-length' => '8')); /* * txtNumero */ $txtNumero = new Element\Text("numero"); $txtNumero->setAttributes(array('class' => 'form-control', 'placeholder' => 'Numero', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'max-length' => '6')); /* * txtLogradouro */ $txtLogradouro = new Element\Text("logradouro"); $txtLogradouro->setAttributes(array('class' => 'form-control', 'placeholder' => 'Ex: Rua, Avenida, Travessa...')); /* * txtComplemento */ $txtComplemento = new Element\Text("complemento"); $txtComplemento->setAttributes(array('class' => 'form-control', 'placeholder' => 'Ex: Rua, Avenida, Travessa...')); /* * txtBairro */ $txtBairro = new Element\Text("bairro"); $txtBairro->setAttributes(array('class' => 'form-control')); /* * txtCidade */ $txtCidade = new Element\Text("cidade"); $txtCidade->setAttributes(array('class' => 'form-control')); /* * txtUf */ $txtUf = new Element\Text("uf"); $txtUf->setAttributes(array('class' => 'form-control', 'max-length' => '2')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $btnSalvar = new Element\Button('salvar'); $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * btnVoltar */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $txtNome->setValue($orm->getNome()); $cmbCongregacao->setValue($orm->getCongregacao()->getId()); $txtCep->setValue($orm->getCep()); $txtNumero->setValue($orm->getNumero()); $txtLogradouro->setValue($orm->getLogradouro()); $txtComplemento->setValue($orm->getComplemento()); $txtBairro->setValue($orm->getBairro()); $txtCidade->setValue($orm->getCidade()); $txtUf->setValue($orm->getUf()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtNome); if (empty($publicador)) { $this->add($cmbCongregacao); } $this->add($txtCep); $this->add($txtNumero); $this->add($txtLogradouro); $this->add($txtComplemento); $this->add($txtBairro); $this->add($txtCidade); $this->add($txtUf); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }