The only thing I can think is happening is that the Cidade is becoming detached from the Entity Manager somehow, and when you persist the new Parceiro, it's actually trying to persist the Cidade again.
Can you post the full code for the Controller action that's throwing the Unique Constraint violation? On Mon, May 9, 2011 at 9:19 AM, elcabong <elcabong....@gmail.com> wrote: > Yes > > What can I try to do for this not to happen?? > > Tanks > > On May 9, 9:51 am, Donald Tyler <chekot...@gmail.com> wrote: > > You said that you weren't creating a new Cidade, so that means that > > the Parceiro > > was using an existing Cidade, correct? > > > > > > > > > > > > > > > > On Mon, May 9, 2011 at 7:44 AM, elcabong <elcabong....@gmail.com> wrote: > > > 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 > > > > ... > > > > 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 > -- 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