| @@ 61-75 (lines=15) @@ | ||
| 58 | * |
|
| 59 | * @param LifecycleEventArgs $eventArgs |
|
| 60 | */ |
|
| 61 | public function postPersist(LifecycleEventArgs $eventArgs) |
|
| 62 | { |
|
| 63 | $document = $eventArgs->getDocument(); |
|
| 64 | ||
| 65 | if (!$document instanceof Job) { |
|
| 66 | return; |
|
| 67 | } |
|
| 68 | ||
| 69 | $solrDoc = $this->generateInputDocument($document, new \SolrInputDocument()); |
|
| 70 | try{ |
|
| 71 | $this->solrManager->addDocument($solrDoc,'/solr/YawikJobs'); |
|
| 72 | }catch (\Exception $e){ |
|
| 73 | // @TODO: What to do when the process failed? |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * Handle doctrine postUpdate event |
|
| @@ 82-95 (lines=14) @@ | ||
| 79 | * |
|
| 80 | * @param LifecycleEventArgs $eventArgs |
|
| 81 | */ |
|
| 82 | public function postUpdate(LifecycleEventArgs $eventArgs) |
|
| 83 | { |
|
| 84 | $document = $eventArgs->getDocument(); |
|
| 85 | if (!$document instanceof Job) { |
|
| 86 | return; |
|
| 87 | } |
|
| 88 | ||
| 89 | $solrDoc = $this->generateInputDocument($document,new \SolrInputDocument()); |
|
| 90 | try{ |
|
| 91 | $this->solrManager->addDocument($solrDoc,'/solr/YawikJobs'); |
|
| 92 | }catch (\Exception $e){ |
|
| 93 | // @TODO: What to do when the process failed? |
|
| 94 | } |
|
| 95 | } |
|
| 96 | ||
| 97 | /** |
|
| 98 | * @param ServiceLocatorInterface $serviceLocator |
|