I'm working on a Symfony2 project to put Google Analytics in a database. User will fills a form with the date and checks the datas he want to collect. When he clicks on "Submit", it call a gaController which call a command.
protected function configure()
{
$this->setName ( 'GA2' )
->addArgument ( 'startDate', InputArgument::REQUIRED, 'Start date (format: YYYY-MM-DD)' )
->addArgument ( 'endDate', InputArgument::REQUIRED, 'End date (format: YYYY-MM-DD)' )
->addArgument ( 'metrics', InputArgument::REQUIRED, 'Metrics (format: metric,metric2,...,metricN')
->addArgument ( 'dimensions', InputArgument::OPTIONAL, 'Dimensions (format: dimension1,dimension2,...,dimensionN');
}
The problem is, metrics and dimensions are read by my Controller as Array, and the Command-Line as String ! Exemple :
Controller read :
array (size=4)
0 => string 'ga:users' (length=8)
1 => string 'ga:newUsers' (length=11)
2 => string 'ga:sessionsPerUser' (length=18)
3 => string 'ga:percentNewVisits' (length=19)
array (size=3)
0 => string 'ga:sessionCount' (length=15)
1 => string 'ga:daysSinceLastSession' (length)
2 => string 'ga:userDefinedValue' (length=19)
Command-Line read :
String(59) "ga:users,ga:newUsers,ga:sessionsPerUser"
String(59) "ga:sessionCount,ga:daysSinceLastSession,ga:userDefinedValue"
But I'm using implode/explode to get an array/string. I need the Command-Line to put it in Windows Scheduler.
Thanks for your help.