app/forms/Registration.php: cleanup, get rid of bind()
This commit is contained in:
parent
8237a71f52
commit
e072ae686d
1 changed files with 4 additions and 18 deletions
|
|
@ -5,21 +5,17 @@ namespace App\Form;
|
|||
/**
|
||||
* Models
|
||||
*/
|
||||
use App\Model\Data\User as UserModel;
|
||||
use App\Model\Data\User;
|
||||
|
||||
/**
|
||||
* Phalcon Form
|
||||
*/
|
||||
|
||||
use App\Model\Data\User;
|
||||
use Httpcb\Form as FormBase,
|
||||
Phalcon\Forms\Element as FormElement;
|
||||
|
||||
/**
|
||||
* Element types
|
||||
*/
|
||||
|
||||
use Httpcb\OAuth\UserData\UserDataInterface;
|
||||
use Phalcon\Forms\Element\Text,
|
||||
Phalcon\Forms\Element\Password,
|
||||
Phalcon\Forms\Element\Submit;
|
||||
|
|
@ -27,7 +23,8 @@ use Phalcon\Forms\Element\Text,
|
|||
/**
|
||||
* Validators
|
||||
*/
|
||||
use Phalcon\Validation\Validator\Callback as CallbackValidator,
|
||||
use Phalcon\Validation,
|
||||
Phalcon\Validation\Validator\Callback as CallbackValidator,
|
||||
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
||||
Phalcon\Validation\Validator\Email as EmailValidator,
|
||||
Phalcon\Validation\Validator\StringLength as StringLengthValidator,
|
||||
|
|
@ -39,7 +36,7 @@ class Registration extends FormBase
|
|||
{
|
||||
public function initialize()
|
||||
{
|
||||
$this->setValidation(new \Phalcon\Validation());
|
||||
$this->setValidation(new Validation());
|
||||
|
||||
// Username
|
||||
$username = new Text('username', array(
|
||||
|
|
@ -107,15 +104,4 @@ class Registration extends FormBase
|
|||
$submit = new Submit('submit', array('class' => 'button button-success', 'value' => 'Register'));
|
||||
$this->add($submit);
|
||||
}
|
||||
|
||||
public function bind(array $data, $entity, $whitelist = null)
|
||||
{
|
||||
parent::bind($data, $entity, $whitelist);
|
||||
|
||||
if ($entity instanceof User && $this->getEntity() instanceof UserDataInterface) {
|
||||
$provider = $this->getEntity()->getProvider();
|
||||
$id = $this->getEntity()->getId();
|
||||
$entity->setOAuthId($provider, $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue