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