File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Classes/Flowpack/ElasticSearch/Indexer/Object/Transform Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Flowpack \ElasticSearch \Indexer \Object \Transform ;
3+
4+ /* *
5+ * This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch".*
6+ * *
7+ * It is free software; you can redistribute it and/or modify it under *
8+ * the terms of the GNU Lesser General Public License, either version 3 *
9+ * of the License, or (at your option) any later version. *
10+ * *
11+ * The TYPO3 project - inspiring people to share! *
12+ * */
13+
14+ use TYPO3 \Flow \Annotations as Flow ;
15+ use TYPO3 \Flow \Persistence \PersistenceManagerInterface ;
16+
17+ /**
18+ * @Flow\Scope("singleton")
19+ */
20+ class ObjectIdentifierTransformer implements TransformerInterface {
21+
22+ /**
23+ * @Flow\Inject
24+ * @var PersistenceManagerInterface
25+ */
26+ protected $ persistenceManager ;
27+
28+ /**
29+ * Returns the Elasticsearch type this transform() method returns
30+ *
31+ * @return string
32+ */
33+ public function getTargetMappingType () {
34+ return 'string ' ;
35+ }
36+
37+ /**
38+ * @param mixed $source
39+ * @param \Flowpack\ElasticSearch\Annotations\Transform $annotation
40+ * @return string
41+ */
42+ public function transformByAnnotation ($ source , \Flowpack \ElasticSearch \Annotations \Transform $ annotation ) {
43+ if ($ source != null ) {
44+ return $ this ->persistenceManager ->getIdentifierByObject ($ source );
45+ }
46+ return '' ;
47+ }
48+ }
49+
You can’t perform that action at this time.
0 commit comments