File tree Expand file tree Collapse file tree 3 files changed +50
-3
lines changed Expand file tree Collapse file tree 3 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ https://github.com/FriendsOfSymfony/FOSElasticaBundle/commit/XXX where XXX is
99the commit hash. To get the diff between two versions, go to
1010https://github.com/FriendsOfSymfony/FOSElasticaBundle/compare/v3.0.4...v3.1.0
1111
12+ * 3.1.8 (Unreleased)
13+ * Removes store: true from mappings unless specifically defined
14+
1215* 3.1.7 (2015-12-08)
1316 * Allow Elastica 2.3
1417
Original file line number Diff line number Diff line change @@ -126,9 +126,6 @@ private function fixProperties(&$properties)
126126 if (in_array ($ property ['type ' ], $ this ->skipTypes )) {
127127 continue ;
128128 }
129- if (!isset ($ property ['store ' ])) {
130- $ property ['store ' ] = true ;
131- }
132129 }
133130 }
134131}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace FOS \ElasticaBundle \Tests \Index ;
4+
5+ use FOS \ElasticaBundle \Configuration \TypeConfig ;
6+ use FOS \ElasticaBundle \Index \MappingBuilder ;
7+
8+ class MappingBuilderTest extends \PHPUnit_Framework_TestCase
9+ {
10+ /**
11+ * @var MappingBuilder
12+ */
13+ private $ builder ;
14+
15+ protected function setUp ()
16+ {
17+ $ this ->builder = new MappingBuilder ();
18+ }
19+
20+ public function testMappingBuilderStoreProperty ()
21+ {
22+ $ typeConfig = new TypeConfig ('typename ' , [
23+ 'properties ' => [
24+ 'storeless ' => [
25+ 'type ' => 'string '
26+ ],
27+ 'stored ' => [
28+ 'type ' => 'string ' ,
29+ 'store ' => true
30+ ],
31+ 'unstored ' => [
32+ 'type ' => 'string ' ,
33+ 'store ' => false
34+ ],
35+ ]
36+ ]);
37+
38+ $ mapping = $ this ->builder ->buildTypeMapping ($ typeConfig );
39+
40+ $ this ->assertArrayNotHasKey ('store ' , $ mapping ['properties ' ]['storeless ' ]);
41+ $ this ->assertArrayHasKey ('store ' , $ mapping ['properties ' ]['stored ' ]);
42+ $ this ->assertTrue ($ mapping ['properties ' ]['stored ' ]['store ' ]);
43+ $ this ->assertArrayHasKey ('store ' , $ mapping ['properties ' ]['unstored ' ]);
44+ $ this ->assertFalse ($ mapping ['properties ' ]['unstored ' ]['store ' ]);
45+ }
46+
47+ }
You can’t perform that action at this time.
0 commit comments