public function flush($document = null, array $options = array())
{
if (null !== $document && !is_object($document) && !is_array($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->commit($document, $options);
}
public function create($username, $password, $roles) { $user = new Document\User(); $user->setUsername($username)->setPassword($password)->setRoles($roles); $this->manager->persist($user); $this->manager->flush(); }