container = $container; } /** * Retrieve an iterator over all items * * @return ArrayIterator An iterator for the array of cron tasks */ public function getIterator() { $definitions = $this->container->findTaggedServiceIds('cron.task'); $tasks = array(); foreach ($definitions as $name => $definition) { $tasks[] = $this->container->get($name); } return new ArrayIterator($tasks); } }