6

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

1 Answer 1

14

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');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.