We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to 1 form and models with relations

I have three models

User hasOne UserProfile hasOne Address

How can I build the form to get all validations and data population works? In Symfony2 I can use form embedding but for Phalcon I can't find a propper solution except of manual form creation+validation.

Thanks



473

Can you explain details ?



12.2k

For Example

I have three models and want use one form to handle them.

UserModel

  • FirstName
  • LastName

UserProfile

  • UserId
  • AddressId
  • Birthdate
  • UserPic
  • Gender

Address

  • City
  • State
  • Country

And My goal is use one form to handle all this three model with validation.

Form

  • FirstName
  • LastName
  • Birthdate
  • UserPic
  • Gender
  • City
  • State
  • Country

In Symfony2 for this using Form embedding which allow create relation and form validation.