This validation config:

<?xml version="1.0" encoding="UTF-8"?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-
mapping"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd";>

        <class name="MCP\AdminBundle\Entity\Cidade">
                <property name="nome">
                        <constraint name="NotBlank">
                                <option name="message">Por favor digite um 
nome</option>
                        </constraint>
                        <constraint name="MinLength">
                                <option name="limit">6</option>
                                <option name="message">Nome muito 
pequeno</option>
                        </constraint>
                        <constraint name="MaxLength">
                                <option name="limit">90</option>
                                <option name="message">Nome muito longo</option>
                        </constraint>
                        <constraint name="MCP\AdminBundle\Validator\Unique">
                                <option name="property">nome</option>
                                <option 
name="entity">MCP\AdminBundle\Entity\Cidade</option>
                                <option name="message">Cidade já 
cadastrada</option>
                        </constraint>
                </property>
        </class>

        <class name="MCP\AdminBundle\Entity\Usuario">
                <property name="senha">
                        <constraint name="MinLength">
                                <option name="limit">6</option>
                                <option name="message">A senha precisa ser no 
mínimo 6 dígitos</
option>
                        </constraint>
                        <constraint name="True">
                                <option name="message">Erro senha</option>
                        </constraint>
                </property>
        </class>

        <class name="MCP\AdminBundle\Entity\Parceiro">

        </class>

</constraint-mapping>

On May 9, 9:32 am, Donald Tyler <chekot...@gmail.com> wrote:
> I don't see any info on your class annotations for what properties are
> required to be unique.
>
>
>
>
>
>
>
> On Mon, May 9, 2011 at 7:27 AM, elcabong <elcabong....@gmail.com> wrote:
> > Entities:
>
> > class Cidade
> > {
> >    /**
> >     * @var string $nome
> >     */
> >    private $nome;
>
> >    /**
> >     * @var boolean $ativo
> >     */
> >    private $ativo;
>
> >    /**
> >     * @var bigint $id
> >     */
> >    private $id;
>
> >    /**
> >     * Set nome
> >     *
> >     * @param string $nome
> >     */
> >    public function setNome($nome)
> >    {
> >        $this->nome = $nome;
> >    }
>
> >    /**
> >     * Get nome
> >     *
> >     * @return string $nome
> >     */
> >    public function getNome()
> >    {
> >        return $this->nome;
> >    }
>
> >    /**
> >     * Set ativo
> >     *
> >     * @param boolean $ativo
> >     */
> >    public function setAtivo($ativo)
> >    {
> >        $this->ativo = $ativo;
> >    }
>
> >    /**
> >     * Get ativo
> >     *
> >     * @return boolean $ativo
> >     */
> >    public function getAtivo()
> >    {
> >        return $this->ativo;
> >    }
>
> >    /**
> >     * Get id
> >     *
> >     * @return bigint $id
> >     */
> >    public function getId()
> >    {
> >        return $this->id;
> >    }
>
> > }
>
> > class Parceiro extends Usuario
> > {
>
> >    /**
> >     * @var string $tipoPessoa
> >     */
> >    private $tipoPessoa;
>
> >    /**
> >     * @var string $nomeEmpresa
> >     */
> >    private $nomeEmpresa;
>
> >    /**
> >     * @var string $numeroDocumento
> >     */
> >    private $numeroDocumento;
>
> >    /**
> >     * @var string $inscrestadual
> >     */
> >    private $inscrestadual;
>
> >    /**
> >     * @var boolean $isentoInscr
> >     */
> >    private $isentoInscr;
>
> >    /**
> >     * @var string $nome
> >     */
> >    private $nome;
>
> >    /**
> >     * @var string $sobrenome
> >     */
> >    private $sobrenome;
>
> >    /**
> >     * @var string $urlsite
> >     */
> >    private $urlsite;
>
> >    /**
> >     * @var string $endereco
> >     */
> >    private $endereco;
>
> >    /**
> >     * @var string $complemento
> >     */
> >    private $complemento;
>
> >    /**
> >     * @var integer $numero
> >     */
> >    private $numero;
>
> >    /**
> >     * @var string $cep
> >     */
> >    private $cep;
>
> >    /**
> >     * @var string $telefone
> >     */
> >    private $telefone;
>
> >    /**
> >     * @var MCP\AdminBundle\Entity\Cidade
> >     */
> >    private $cidade;
>
> >    /**
> >     * Set tipoPessoa
> >     *
> >     * @param string $tipoPessoa
> >     */
> >    public function setTipoPessoa($tipoPessoa)
> >    {
> >        $this->tipoPessoa = $tipoPessoa;
> >    }
>
> >    /**
> >     * Get tipoPessoa
> >     *
> >     * @return string $tipoPessoa
> >     */
> >    public function getTipoPessoa()
> >    {
> >        return $this->tipoPessoa;
> >    }
>
> >    /**
> >     * Set nomeEmpresa
> >     *
> >     * @param string $nomeEmpresa
> >     */
> >    public function setNomeEmpresa($nomeEmpresa)
> >    {
> >        $this->nomeEmpresa = $nomeEmpresa;
> >    }
>
> >    /**
> >     * Get nomeEmpresa
> >     *
> >     * @return string $nomeEmpresa
> >     */
> >    public function getNomeEmpresa()
> >    {
> >        return $this->nomeEmpresa;
> >    }
>
> >    /**
> >     * Set numeroDocumento
> >     *
> >     * @param string $numeroDocumento
> >     */
> >    public function setNumeroDocumento($numeroDocumento)
> >    {
> >        $this->numeroDocumento = $numeroDocumento;
> >    }
>
> >    /**
> >     * Get numeroDocumento
> >     *
> >     * @return string $numeroDocumento
> >     */
> >    public function getNumeroDocumento()
> >    {
> >        return $this->numeroDocumento;
> >    }
>
> >    /**
> >     * Set inscrestadual
> >     *
> >     * @param string $inscrestadual
> >     */
> >    public function setInscrestadual($inscrestadual)
> >    {
> >        $this->inscrestadual = $inscrestadual;
> >    }
>
> >    /**
> >     * Get inscrestadual
> >     *
> >     * @return string $inscrestadual
> >     */
> >    public function getInscrestadual()
> >    {
> >        return $this->inscrestadual;
> >    }
>
> >    /**
> >     * Set isentoInscr
> >     *
> >     * @param boolean $isentoInscr
> >     */
> >    public function setIsentoInscr($isentoInscr)
> >    {
> >        $this->isentoInscr = $isentoInscr;
> >    }
>
> >    /**
> >     * Get isentoInscr
> >     *
> >     * @return boolean $isentoInscr
> >     */
> >    public function getIsentoInscr()
> >    {
> >        return $this->isentoInscr;
> >    }
>
> >    /**
> >     * Set nome
> >     *
> >     * @param string $nome
> >     */
> >    public function setNome($nome)
> >    {
> >        $this->nome = $nome;
> >    }
>
> >    /**
> >     * Get nome
> >     *
> >     * @return string $nome
> >     */
> >    public function getNome()
> >    {
> >        return $this->nome;
> >    }
>
> >    /**
> >     * Set sobrenome
> >     *
> >     * @param string $sobrenome
> >     */
> >    public function setSobrenome($sobrenome)
> >    {
> >        $this->sobrenome = $sobrenome;
> >    }
>
> >    /**
> >     * Get sobrenome
> >     *
> >     * @return string $sobrenome
> >     */
> >    public function getSobrenome()
> >    {
> >        return $this->sobrenome;
> >    }
>
> >    /**
> >     * Set urlsite
> >     *
> >     * @param string $urlsite
> >     */
> >    public function setUrlsite($urlsite)
> >    {
> >        $this->urlsite = $urlsite;
> >    }
>
> >    /**
> >     * Get urlsite
> >     *
> >     * @return string $urlsite
> >     */
> >    public function getUrlsite()
> >    {
> >        return $this->urlsite;
> >    }
>
> >    /**
> >     * Set endereco
> >     *
> >     * @param string $endereco
> >     */
> >    public function setEndereco($endereco)
> >    {
> >        $this->endereco = $endereco;
> >    }
>
> >    /**
> >     * Get endereco
> >     *
> >     * @return string $endereco
> >     */
> >    public function getEndereco()
> >    {
> >        return $this->endereco;
> >    }
>
> >    /**
> >     * Set complemento
> >     *
> >     * @param string $complemento
> >     */
> >    public function setComplemento($complemento)
> >    {
> >        $this->complemento = $complemento;
> >    }
>
> >    /**
> >     * Get complemento
> >     *
> >     * @return string $complemento
> >     */
> >    public function getComplemento()
> >    {
> >        return $this->complemento;
> >    }
>
> >    /**
> >     * Set numero
> >     *
> >     * @param integer $numero
> >     */
> >    public function setNumero($numero)
> >    {
> >        $this->numero = $numero;
> >    }
>
> >    /**
> >     * Get numero
> >     *
> >     * @return integer $numero
> >     */
> >    public function getNumero()
> >    {
> >        return $this->numero;
> >    }
>
> >    /**
> >     * Set cep
> >     *
> >     * @param string $cep
> >     */
> >    public function setCep($cep)
> >    {
> >        $this->cep = $cep;
> >    }
>
> >    /**
> >     * Get cep
> >     *
> >     * @return string $cep
> >     */
> >    public function getCep()
> >    {
> >        return $this->cep;
> >    }
>
> >    /**
> >     * Set telefone
> >     *
> >     * @param string $telefone
> >     */
> >    public function setTelefone($telefone)
> >    {
> >        $this->telefone = $telefone;
> >    }
>
> >    /**
> >     * Get telefone
> >     *
> >     * @return string $telefone
> >     */
> >    public function getTelefone()
> >    {
> >        return $this->telefone;
> >    }
>
> >    /**
> >     * Set cidade
> >     *
> >     * @param MCP\AdminBundle\Entity\Cidade $cidade
> >     */
> >    public function setCidade(Cidade $cidade)
> >    {
> >        $this->cidade = $cidade;
> >    }
>
> >    /**
> >     * Get cidade
> >     *
> >     * @return MCP\AdminBundle\Entity\Cidade $cidade
> >     */
> >    public function getCidade()
> >    {
> >        return $this->cidade;
> >    }
>
> >    /**
> >        * Return the user roles
> >        * Implements AccountInterface
> >        *
> >        * @return array The roles
> >        **/
> >    public function getRoles()
> >    {
> >                $roles[] = self::ROLE_PARCEIRO;
>
> >        return array_unique($roles);
> >    }
> > }
>
> > When I was persist Parceiro entity,  The form throw unique constraits
> > exception, but I was not creating a new Cidade object.
>
> > I use this unique constraints
>
> >http://www.michelsalib.com/2011/04/create-your-own-constraint-validat...
> > .
>
> > I need disable validation inherit parent!!.
>
> > Tanks
>
> > On May 8, 10:05 am, Donald Tyler <chekot...@gmail.com> wrote:
> > > It sounds like you're approaching the problem in the wrong way. If you're
> > > trying to disable some part of the validation, that says to be that
> > there's
> > > either a problem with how you're building the Entity behind the form, or
> > > some problem with your object model.
>
> > > Maybe if you could give more info on your object model, and the use case
> > of
> > > the form, along with the reason why you think it's necessary to disable
> > this
> > > part of the validation; someone can help.
>
> > > On Sun, May 8, 2011 at 7:05 AM, elcabong <elcabong....@gmail.com> wrote:
> > > > How disable validation inherit parent?
>
> > > > When I use Entity Type Form, example:
>
> > > > class ParceiroType extends AbstractType {
>
> > > >    public function buildForm(FormBuilder $builder, array $options)
> > > >    {
>
> > > >            $builder->add('cidade', 'entity', array(
> > > >               'class' => 'MCP\AdminBundle\Entity\Cidade',
> > > >               'required' =>true,
> > > >               'property' => 'nome',
> > > >            ));
>
> > > >            .....
> > > >    }
>
> > > > This property inherit parent validation, unique constraits??
>
> > > > How disable validation inherit parent?
>
> > > > There is something???
>
> > > > Tanks
>
> > > > --
> > > > If you want to report a vulnerability issue on symfony, please send it
> > to
> > > > security at symfony-project.com
>
> > > > You received this message because you are subscribed to the Google
> > > > Groups "symfony users" group.
> > > > To post to this group, send email to symfony-users@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > symfony-users+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/symfony-users?hl=en
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from
>
> ...
>
> read more »

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to