I am using a class like the one below and a form checking code like
the following;
I am displaying a form containing the name field.
Upon submission, if doctrine:generate:entities has just been ran, I
get a corretc not blank error message.
If I press submit again (and upon subsequent refreshes/submits) the
error message does not appear again, although the field remained
blank.
I've noticed that the validator's metadata for that field only
contains constraints on the first run. After that, the constraints
array is empty.
This must have something to do with the way caching works, maybe?
I feel I'm missing something ;)
$request = $this->get('request');
$mc = new MyClass();
$form = MyClassForm::create($this->get('form.context'), 'mc_add');
$validator = $this->get('validator');
$form->bind($request, $mc);
-------
namespace App\DefaultBundle\Entity;
/**
* @orm:Entity
*/
class MyClass {
/**
* @orm:Id
* @orm:Column(type="integer")
* @orm:GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @orm:Column(type="string", length="64")
* @validation:NotBlank()
* @validation:MaxLength(64)
*/
protected $name;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Get name
*
* @return string $name
*/
public function getName()
{
return $this->name;
}
}
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en