Note that there are some explanatory texts on larger screens.

plurals
  1. POZF2 : paramaters coming from route are cleared after submitting a form
    primarykey
    data
    text
    <p>I'm using <code>AbstractTableGateway</code> and <code>HydratingResultset</code> to do db operations. (with BjyProfiler) when i post my form data with add action it works, but edit action doesn't work. when i make a bind it works, but i m redirected to the add page because submitting the form resets paramaters coming from route. </p> <p>here is my code for <code>editAction()</code> (same with Album editAction())</p> <pre><code> $id = (int)$this-&gt;params()-&gt;fromRoute('id'); if (!$id) { return $this-&gt;redirect()-&gt;toRoute('voyage', array('action'=&gt;'add')); } $voyage = $this-&gt;getVoyageTable()-&gt;getVoyage($id); $form = new VoyageForm($this-&gt;getTypeVoyageTable()); $form-&gt;bind($voyage); $form-&gt;get('submit')-&gt;setAttribute('value', 'Edit'); $request = $this-&gt;getRequest(); if ($request-&gt;isPost()) { $form-&gt;setData($request-&gt;getPost()); if ($form-&gt;isValid()) { $this-&gt;getVoyageTable()-&gt;saveVoyage($voyage); // Redirect to list of voyages return $this-&gt;redirect()-&gt;toRoute('voyage'); } } return array( 'id' =&gt; $id, 'form' =&gt; $form, ); } </code></pre> <p>and my table :</p> <pre><code>class VoyageTable extends AbstractTableGateway { protected $table ='voyages'; public function __construct(Adapter $adapter) { $this-&gt;adapter = $adapter; $this-&gt;resultSetPrototype = new HydratingResultSet(); $this-&gt;resultSetPrototype-&gt;setObjectPrototype(new Voyage()); $this-&gt;initialize(); } [...] </code></pre> <p>Can sombody help me? How can i fix this problem ? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload