title: CakePHP 3: Error while passing an array in URL
body: <p>I am trying to pass <code>datetime</code> variables into my <code>exportcsv</code> method to generate <code>.csv</code> file with data from indicated time period. </p>
  
  <p>Both variables are associative arrays that look like this:</p>
  
  <pre><code>[
   'beginning' =&gt; [
      'year' =&gt; '2016',
      'month' =&gt; '06',
      'day' =&gt; '23',
      'hour' =&gt; '11',
      'minute' =&gt; '15'
    ],
    'end' =&gt; [
      'year' =&gt; '2016',
      'month' =&gt; '06',
      'day' =&gt; '29',
      'hour' =&gt; '11',
      'minute' =&gt; '15'
     ]
  ]
  </code></pre>
  
  <p>When I try to pass variables I get an error with this message (yep, I've got the same two warnings):</p>
  
  <pre><code>Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574]
  
  Warning (2): rawurlencode() expects parameter 1 to be string, array given [CORE\src\Routing\Route\Route.php, line 574]
  </code></pre>
  
  <p><code>rawurlencode()</code> is a basic PHP function and this is the <code>line 574</code>: </p>
  
  <p><code>$pass = implode('/', array_map('rawurlencode', $pass));</code></p>
  
  <p>It looks like some problem with URL rewriting, but frankly I don't know how to fix it. Any ideas?</p>
  
  <p><strong><code>exportcsv</code> method in <code>EventsController</code></strong>
  </p>
  
  <pre><code>public function exportcsv($beginning = null, $end = null)
  {
   if ($this-&gt;request-&gt;is('post')) {
    $beginning = $this-&gt;request-&gt;data['Export']['beginning']; 
    $end = $this-&gt;request-&gt;data['Export']['end'];              
  
    return $this-&gt;redirect([$beginning, $end]);
   }
  
   if (!$beginning &amp;&amp; !$end) {
    return $this-&gt;render();
   }
  
   $this-&gt;response-&gt;download('export.csv');
  $data = $this-&gt;Events-&gt;find('all')
                            -&gt;select([
                              'title',
                              'created',
                              'description',
                              'ended',
                              'working_hours',
                              'price',
                              'username' =&gt; 'Users.name',
                              'statusname' =&gt; 'Statuses.name',
                              'employeename' =&gt; 'Employees.name'
                            ])
                            -&gt;leftJoinWith('Statuses')
                            -&gt;leftJoinWith('Users')
                            -&gt;leftJoinWith('Employees')
                            -&gt;where(["created BETWEEN " . $beginning . " AND " . $end])
                            -&gt;autoFields(true)
                            -&gt;toArray();
  $_serialize = 'data';
  $_delimiter = chr(9); //tab
  $_extract = ['title', 'created', 'description', 'ended', 'working_hours', 'price', 'username', 'statusname', 'employeename'];
  $this-&gt;set(compact('data', '_serialize','_delimiter', '_extract'));
  $this-&gt;viewBuilder()-&gt;className('CsvView.Csv');
  return;
  }
  </code></pre>
  
  <p></p>
  
  <p><strong><code>exportcsv.ctp</code> view:</strong>
  </p>
  
  <pre><code>&lt;div class="events form large-6 medium-4 columns content"&gt;
    &lt;?= $this-&gt;Form-&gt;create('Export'); ?&gt;
    &lt;?= $this-&gt;Form-&gt;input('beginning', array('type'=&gt;'datetime', 'interval' =&gt; 15, 'label' =&gt; 'Beginning:')); ?&gt;
    &lt;?= $this-&gt;Form-&gt;input('end', array('type'=&gt;'datetime',  'interval' =&gt; 15, 'label' =&gt; 'End:')); ?&gt;
    &lt;?= $this-&gt;Form-&gt;button(__('Add')) ?&gt;
    &lt;?= $this-&gt;Form-&gt;end() ?&gt;
  &lt;/div&gt;
  </code></pre>