hi, i want creat connection with attribute col name in database on input mayby i show what i mean.
<?php
namespace ...;
use Phalcon\Forms\Element\Text;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Uniqueness;
class UserForm extends FormBase
{
public function initialize($entity = null, $options = null)
{
$login = new Text('user', [
'class' => 'form-control',
'attr' => 'user_login' // <- conection to database col
]);
$login->addValidators([
new Uniqueness([
'model' => new UserAccount(),
'message' => 'user is exsit',
'attribute' => 'user_login' // <- move this to input
]),
new PresenceOf([
'message' => 'required'
])
]);
$login->setLabel('Login');
$this->add($login);
}
}
render input of name user but connect into user_login entity
That's my question, can I do that?