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
|
* Models
|
||||||
*/
|
*/
|
||||||
use App\Model\Data\User as UserModel;
|
use App\Model\Data\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phalcon Form
|
* Phalcon Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use App\Model\Data\User;
|
|
||||||
use Httpcb\Form as FormBase,
|
use Httpcb\Form as FormBase,
|
||||||
Phalcon\Forms\Element as FormElement;
|
Phalcon\Forms\Element as FormElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element types
|
* Element types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Httpcb\OAuth\UserData\UserDataInterface;
|
|
||||||
use Phalcon\Forms\Element\Text,
|
use Phalcon\Forms\Element\Text,
|
||||||
Phalcon\Forms\Element\Password,
|
Phalcon\Forms\Element\Password,
|
||||||
Phalcon\Forms\Element\Submit;
|
Phalcon\Forms\Element\Submit;
|
||||||
|
|
@ -27,7 +23,8 @@ use Phalcon\Forms\Element\Text,
|
||||||
/**
|
/**
|
||||||
* Validators
|
* 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\Alnum as AlnumValidator,
|
||||||
Phalcon\Validation\Validator\Email as EmailValidator,
|
Phalcon\Validation\Validator\Email as EmailValidator,
|
||||||
Phalcon\Validation\Validator\StringLength as StringLengthValidator,
|
Phalcon\Validation\Validator\StringLength as StringLengthValidator,
|
||||||
|
|
@ -39,7 +36,7 @@ class Registration extends FormBase
|
||||||
{
|
{
|
||||||
public function initialize()
|
public function initialize()
|
||||||
{
|
{
|
||||||
$this->setValidation(new \Phalcon\Validation());
|
$this->setValidation(new Validation());
|
||||||
|
|
||||||
// Username
|
// Username
|
||||||
$username = new Text('username', array(
|
$username = new Text('username', array(
|
||||||
|
|
@ -107,15 +104,4 @@ class Registration extends FormBase
|
||||||
$submit = new Submit('submit', array('class' => 'button button-success', 'value' => 'Register'));
|
$submit = new Submit('submit', array('class' => 'button button-success', 'value' => 'Register'));
|
||||||
$this->add($submit);
|
$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