public function bind(Request $request, $data = null)
{
if (!$this->getName()) {
throw new FormException('You cannot bind anonymous forms. Please give this form a name');
}
// Store object from which to read the default values and where to
// write the submitted values
if (null !== $data) {
$this->setData($data);
}
// Store the submitted data in case of a post request
if ('POST' == $request->getMethod()) {
$values = $request->request->get($this->getName(), array());
$files = $request->files->get($this->getName(), array());
$this->submit(self::deepArrayUnion($values, $files));
$this->userManager->updateCanonicalFields($this->getData());
$this->validate();
}
}