Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony : error while accessing an array

i want to output an array containing numbers.

I'm creating the array like this (it recieved the statistics for the last 7 days) :

   <?php  public function getStatisticsTeams()
 {
  $tab = array();
  for($i=7;$i=0;$i--)
     {
   $q = Doctrine_Query::create()
   ->from('stJob j')
   ->where('j.created_at = ?', date('Y-m-d h:i:s' , time() - 86400 * $i ))
    ->execute()
   ->count();
   $tab[] = $q;
     }
   return $tab;
 }

action.class.php

$this->st_job = Doctrine::getTable('StJob')->getStatisticsTeams();

Use of the array in my template.php :

$chart->inlineGraph(array('hits' => $st_job), array('Monday', 'Tuesday', 'Wednesday' ....), 'div_id');

When i try to access to my array it fails because the function i use must have an array which is supposed to contain for example (43,5,87,3,29,8,10) , and when i var_dump($st_job) (my array)

object(sfOutputEscaperArrayDecorator)#363 (3) { ["count":"sfOutputEscaperArrayDecorator":private]=>  int(0) ["value":protected]=>  array(0) { } ["escapingMethod":protected]=>  string(16) "esc_specialchars" } 

Do you have any idea of what i'm doing wrong ?

Thank you

like image 854
sf_tristanb Avatar asked Oct 08 '10 00:10

sf_tristanb


1 Answers

Yes, symfony is set to automatically apply escaping strategies to the data you pass from your controllers to your views. You can either remove the setting, which is not recommended, or use:

$original_array = $sf_data->getRaw('st_job');
like image 114
mhitza Avatar answered Oct 13 '22 00:10

mhitza