yawik / SimpleImport

Simple Job Import Module. Imports job openings into YAWIK
MIT License
0 stars 1 forks source link

Exception, if no location is defined. #40

Closed cbleek closed 5 years ago

cbleek commented 5 years ago

Hi @toni,

after the geocoder upgrade. the import behaves slightly diffrent. If a feed does not contain a location is thrown. I'ce added such the feed "reifen" to the demo db.

cbleek@php7-cb:~/SimpleImport$ composer db.init                  
> mongorestore --drop                                                                                                                                                               
...
cbleek@php7-cb:~/SimpleImport$ vendor/bin/yawik simpleimport info

moemax.................................. (5d0a2213403d4b050b219412)
reifen.................................. (5d19e95a403d4b0b8a06dea2)

executing the "reifen" import leads to an exeption. It should be possible to import a feed without a location.

cbleek@php7-cb:~/SimpleImport$ vendor/bin/yawik simpleimport import --name=reifen
The crawler with the name (ID) "reifen (5d19e95a403d4b0b8a06dea2)" has started its job:
                     [>                                                                                                                                      ]   0%             ======================================================================
   The application has thrown an exception!
======================================================================
 TypeError
 Argument 1 passed to Geocoder\Query\GeocodeQuery::create() must be of the type string, null given, called in /home/cbleek/SimpleImport/src/Job/GeocodeLocation.php on line 77
----------------------------------------------------------------------
/home/cbleek/SimpleImport/vendor/willdurand/geocoder/Query/GeocodeQuery.php:68
#0 /home/cbleek/SimpleImport/src/Job/GeocodeLocation.php(77): Geocoder\Query\GeocodeQuery::create(NULL)
#1 /home/cbleek/SimpleImport/src/Hydrator/JobHydrator.php(85): SimpleImport\Job\GeocodeLocation->getLocations(NULL)
#2 /home/cbleek/SimpleImport/src/CrawlerProcessor/JobProcessor.php(236): SimpleImport\Hydrator\JobHydrator->hydrate(Array, Object(Jobs\Entity\Job))
#3 /home/cbleek/SimpleImport/src/CrawlerProcessor/JobProcessor.php(117): SimpleImport\CrawlerProcessor\JobProcessor->syncChanges(Object(SimpleImport\Entity\Crawler), Object(SimpleImport\CrawlerProcessor\Result), Object(Zend\Log\Logger))
#4 /home/cbleek/SimpleImport/src/Controller/ConsoleController.php(132): SimpleImport\CrawlerProcessor\JobProcessor->execute(Object(SimpleImport\Entity\Crawler), Object(SimpleImport\CrawlerProcessor\Result), Object(Zend\Log\Logger))
#5 /home/cbleek/SimpleImport/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): SimpleImport\Controller\ConsoleController->importAction()
#6 /home/cbleek/SimpleImport/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#7 /home/cbleek/SimpleImport/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 /home/cbleek/SimpleImport/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#9 /home/cbleek/SimpleImport/vendor/zendframework/zend-mvc-console/src/Controller/AbstractConsoleController.php(56): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#10 /home/cbleek/SimpleImport/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Console\Controller\AbstractConsoleController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#11 /home/cbleek/SimpleImport/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /home/cbleek/SimpleImport/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /home/cbleek/SimpleImport/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#14 /home/cbleek/SimpleImport/vendor/yawik/core/bin/yawik(27): Zend\Mvc\Application->run()
#15 {main}
======================================================================
   Previous Exception(s):
TiSiE commented 5 years ago

This will be released as 0.3.2 once fixed. Merge request should be made against master.

cbleek commented 5 years ago

@TiSiE can you check it please