src/Command/Query.php
/**
     * $input and $output will generally be used from the getters, and were set in initialize.
     * they are still in the signature as required by the Command parent class
     */
$input and $output will generally be used from the getters, and were set in initialize.
they are still in the signature as required by the Command parent class
$input and $output will generally be used from the getters and were set in initialize . they are still in the signature as required by the Command parent class
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->phretsLogin();
        foreach ($this->getResourcesAndClasses()[self::KEY_CLASSES] as $class) {
            $resource =  $this->getResourcesAndClasses()[self::KEY_RESOURCE];
            $output->writeln('Resource: ' . $resource);
            $output->writeln('Class: ' . $class);
            $dataOutput = $this->getOutputStrategy();
            if ($dataOutput !== null) {
                $dataOutput->setMlsKey($input->getArgument(self::ARGUMENT_KEY))
                    ->setResourceName($resource)
                    ->setClassName($class);
            }
            $this->initProgressBar();
            $this->startProgressBar();
            $offset = null;
            do {
                $extras = $this->getQueryExtras($offset);
                $results = $this->getPhretsSession()->Search(
                    $resource,
                    $class,
                    $input->getArgument(self::ARGUMENT_QUERY),
                    $extras
                );
                $this->setProgressBarMaxSteps($results->getTotalResultsCount());
                if ($input->getOption(self::OPTION_COUNT)) {
                    break;
                } elseif ($dataOutput !== null) {
                    $dataOutput->outputResults($results);
                } else {
                    $output->write(var_export($results->toArray(), true));
                }
                $count = count($results);
                $offset += $count;
                $this->advanceProgressBar($count);
            } while ($count >= $input->getOption(self::OPTION_LIMIT));
            $this->finishProgressBar();
            if ($input->getOption(self::OPTION_COUNT)) {
                $output->writeln("\nCount: " . $results->getTotalResultsCount());
            }
            if ($dataOutput !== null) {
                $dataOutput->complete();
            }
            $output->writeln('');
        }
        $this->getPhretsSession()->Disconnect();
        return Command::SUCCESS;
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> phretsLogin ( ) ; foreach ( $ this -> getResourcesAndClasses ( ) [ self :: KEY_CLASSES ] as $ class ) { $ resource = $ this -> getResourcesAndClasses ( ) [ self :: KEY_RESOURCE ] ; $ output -> writeln ( 'Resource: ' . $ resource ) ; $ output -> writeln ( 'Class: ' . $ class ) ; $ dataOutput = $ this -> getOutputStrategy ( ) ; if ( $ dataOutput !== null ) { $ dataOutput -> setMlsKey ( $ input -> getArgument ( self :: ARGUMENT_KEY ) ) -> setResourceName ( $ resource ) -> setClassName ( $ class ) ; } $ this -> initProgressBar ( ) ; $ this -> startProgressBar ( ) ; $ offset = null ; do { $ extras = $ this -> getQueryExtras ( $ offset ) ; $ results = $ this -> getPhretsSession ( ) -> Search ( $ resource , $ class , $ input -> getArgument ( self :: ARGUMENT_QUERY ) , $ extras ) ; $ this -> setProgressBarMaxSteps ( $ results -> getTotalResultsCount ( ) ) ; if ( $ input -> getOption ( self :: OPTION_COUNT ) ) { break ; } elseif ( $ dataOutput !== null ) { $ dataOutput -> outputResults ( $ results ) ; } else { $ output -> write ( var_export ( $ results -> toArray ( ) , true ) ) ; } $ count = count ( $ results ) ; $ offset += $ count ; $ this -> advanceProgressBar ( $ count ) ; } while ( $ count >= $ input -> getOption ( self :: OPTION_LIMIT ) ) ; $ this -> finishProgressBar ( ) ; if ( $ input -> getOption ( self :: OPTION_COUNT ) ) { $ output -> writeln ( " \n Count:  " . $ results -> getTotalResultsCount ( ) ) ; } if ( $ dataOutput !== null ) { $ dataOutput -> complete ( ) ; } $ output -> writeln ( '' ) ; } $ this -> getPhretsSession ( ) -> Disconnect ( ) ; return Command :: SUCCESS ; }
$input and $output will generally be used from the getters, and were set in initialize.
$input and $output will generally be used from the getters and were set in initialize .