Skip to content

Commit 9d29b7d

Browse files
committed
mapper work with empty format
1 parent b3f5c3a commit 9d29b7d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Space.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public function getFormat()
101101
} else {
102102
$this->format = $this->mapper->findOne('_space', ['id' => $this->id])->format;
103103
}
104+
if(!$this->format) {
105+
$this->format = [];
106+
}
104107
$this->parseFormat();
105108
}
106109

tests/SchemaTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55

66
class SchemaTest extends TestCase
77
{
8+
public function testEmptySpace()
9+
{
10+
$mapper = $this->createMapper();
11+
$this->clean($mapper);
12+
13+
$tester = $mapper->getSchema()->createSpace('tester');
14+
$this->assertCount(0, $tester->getFormat());
15+
$this->assertCount(0, $tester->getIndexes());
16+
}
17+
818
public function testIndexes()
919
{
1020
$mapper = $this->createMapper();

0 commit comments

Comments
 (0)