summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9c56c29)
Remove useless static variables
Update execute function prototype
use Rapsys\PackBundle\Util\SluggerUtil;
class Calendar2Command extends Command {
use Rapsys\PackBundle\Util\SluggerUtil;
class Calendar2Command extends Command {
- /**
- * Set default name
- */
- protected static $defaultName = 'rapsysair:calendar2';
-
- /**
- * Set default description
- */
- protected static $defaultDescription = 'Synchronize sessions in users\' calendar';
-
/**
* Set google client scopes
*/
/**
* Set google client scopes
*/
$this->markdown = new DefaultMarkdown;
}
$this->markdown = new DefaultMarkdown;
}
+ /**
+ * Configure attribute command
+ */
+ protected function configure() {
+ //Configure the class
+ $this
+ //Set name
+ ->setName('rapsysair:calendar2')
+ //Set description shown with bin/console list
+ ->setDescription('Synchronize sessions in users\' calendar')
+ //Set description shown with bin/console --help airlibre:attribute
+ ->setHelp('This command synchronize sessions in users\' google calendar');
+ }
+
/**
* Process the attribution
*/
/**
* Process the attribution
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
//Iterate on google tokens
foreach($tokens = $this->doctrine->getRepository(GoogleToken::class)->findAllIndexed() as $tid => $token) {
//Iterate on google calendars
//Iterate on google tokens
foreach($tokens = $this->doctrine->getRepository(GoogleToken::class)->findAllIndexed() as $tid => $token) {
//Iterate on google calendars
//TODO: load all calendar events here ?
//Iterate on sessions to update
//TODO: load all calendar events here ?
//Iterate on sessions to update
- foreach($sessions = $this->doctrine->getRepository(Session::class)->findAllByUserIdSynchronized($token['uid'], $calendar['synchronized'])) {
+ foreach($sessions = $this->doctrine->getRepository(Session::class)->findAllByUserIdSynchronized($token['uid'], $calendar['synchronized']) as $session) {
//TODO: insert/update/delete events here ?
}
//TODO: insert/update/delete events here ?
}