File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the ONGR package.
5+ *
6+ * (c) NFQ Technologies UAB <info@nfq.com>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace ONGR \ElasticsearchBundle \Annotation ;
13+
14+ /**
15+ * Associates document property with _version meta-field.
16+ *
17+ * @Annotation
18+ * @Target("PROPERTY")
19+ */
20+ final class Version implements MetaField
21+ {
22+ /**
23+ * {@inheritdoc}
24+ */
25+ public function getName ()
26+ {
27+ return '_version ' ;
28+ }
29+
30+ /**
31+ * {@inheritdoc}
32+ */
33+ public function getSettings ()
34+ {
35+ return [];
36+ }
37+ }
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ class DocumentParser
3737 const PARENT_ANNOTATION = 'ONGR\ElasticsearchBundle\Annotation\ParentDocument ' ;
3838 const TTL_ANNOTATION = 'ONGR\ElasticsearchBundle\Annotation\Ttl ' ;
3939 const ROUTING_ANNOTATION = 'ONGR\ElasticsearchBundle\Annotation\Routing ' ;
40+ const VERSION_ANNOTATION = 'ONGR\ElasticsearchBundle\Annotation\Version ' ;
4041
4142 /**
4243 * @var Reader Used to read document annotations.
@@ -177,6 +178,7 @@ private function getMetaFieldAnnotationData($property)
177178 $ annotation = $ annotation ?: $ this ->reader ->getPropertyAnnotation ($ property , self ::PARENT_ANNOTATION );
178179 $ annotation = $ annotation ?: $ this ->reader ->getPropertyAnnotation ($ property , self ::TTL_ANNOTATION );
179180 $ annotation = $ annotation ?: $ this ->reader ->getPropertyAnnotation ($ property , self ::ROUTING_ANNOTATION );
181+ $ annotation = $ annotation ?: $ this ->reader ->getPropertyAnnotation ($ property , self ::VERSION_ANNOTATION );
180182
181183 if ($ annotation === null ) {
182184 return null ;
@@ -358,6 +360,7 @@ private function registerAnnotations()
358360 'ParentDocument ' ,
359361 'Ttl ' ,
360362 'Routing ' ,
363+ 'Version ' ,
361364 ];
362365
363366 foreach ($ annotations as $ annotation ) {
You can’t perform that action at this time.
0 commit comments