Sunday, 15 May 2011

php - symfony 2 form validation (without errors) -


I am slightly confused with this problem: I have got 2 units, Horror (horary mean schedule) and horaryline where $ horaire -> lines have an array of HoraireLine and $ horaireLine-> horaire Horaire is the owner.

For the institutions of my Horaire persist I use a collection of HoraireLine form as Horaire, but it is that if the last one (if returns) falls in any way and I Bar error was not found I checked the errors in the form, and the child's form: none I check the errors of the institutions:

$ validator = $ this- & gt; Receive ('validator'); $ ErrorList = $ validator-> Validate ($ this-> getSeller () -> getHoraire () - & gt; getLines ()); and an empty table comes back but form-> isValid () is still wrong I have not set the privilege.

Here my code (in my controller):

  [...] / * * Horror form (About Horowlene) * / / * Init Horaire Lines of Threat * (To Not Receive Null Horror Line) * @Unlegit Indent * / if ($ this-> getSeller () - & gt; getHoraire () - & gt; getLines ()) {foreach (EnumDay :: GetEnum () as $ K = =, $ day) {$ this- & gt; GetSeller () - & gt; GetHoraire () - & gt; AddLine (new HoraireLine ($ this-> getSeller () -> getHoraire (), $ day, empty, empty, null, void)); }} $ HoraireForm = $ this- & gt; CreateForm (new HoraireType (), $ this-> getSeller () - & gt; getHoraire ()); $ Validator = $ this- & gt; Receive ('validator'); $ Error list = $ validator-> Validate ($ this-> getSeller () - & gt; Milehorir () - & gt; GetLines ()); Var_dump ($ errorList); If ($ horaireForm-> isValid ()) {$ em-> Continuous ($-> getSeller () -> getHoraire ()); / * Foreach ($ -> getSeller () - & gt; getHoraire () - & gt; getLines () as $ key = & gt; $ value) {$ em- & gt; Constant ($ value); } * /} [...]  

$ this-> getSeller () Current user has a shortcut for an object, get it from the security context.

And here yaml of institutions:

  ctx \ baobundle \ entity \ horaireLine: type: unit table: empty id: id: type: integer id: true generator: strategy : Auto field: am_opening: type: time faucet: true am_closing: type: time faucet: true pm_opening: type: time faucet: true pm_closing: type: time faucet: true day: type: object manyToOne: horaire: targetEntity: Horaire inversedBy: Lines Waterfall [On Auto: "Continue", "Merge"] joinColumn: Name: horaire_id referenced ColumnName: ID lifecycleCallbacks: {} ctx \ BaoBundle \ unit \ Horaire: Type: Unit Table: Null Comes ED: ID: Type: integer ID: true generator: strategy eToOne: vendor: targetEntity: vendor inversedBy: horaire joinColumn: name: seller_id referencedColumnName: ID waterfall: ["continues", "merge"] oneToMany: lines: targetEntity: HoraireLine mappedBy: horaire waterfall: ["continues", "merge"] lifecycle blackbank: {}  

I use waterfall: ["continuous", "merge"] because I have to use a continuous waterfall, but I do not know that the merge is useful. I am continuously siddha for survival I use it.

Thank you in advance for answering, and if this is a dummy error you are sorry x)

I got an error and yes it was a dummy error.

I post to the following people in the same situation:

I just forgot $ horaireForm-> handles ($ request) after this

  $ HoraireForm = $ this- & gt; CreateForm (new HoraireType (), $ this-> getSeller () - & gt; getHoraire ()); Do not forget to make a $ $ request to: 

  Public functions & lt; Your Action Name & gt; Action (request $ request) { 

Symphony will give herself $ requests to handle her form.


No comments:

Post a Comment