public function testTrim() { $target = ['a' => 1, 'b' => null, 'c' => ['d' => 1, 'e' => [], 'f' => ['g' => null], 'h' => ['i' => ''], 'j' => ['k' => [], 'l' => 1]]]; $this->assertSame(['a' => 1, 'c' => ['d' => 1, 'j' => ['l' => 1]]], Complex::trim($target)); $target = ['a' => [null, 1, '', 'a']]; $this->assertSame(['a' => [1, 'a']], Complex::trim($target)); }
public function unpack(\Owl\DataMapper\Data $data, array $options = null) { $record = parent::unpack($data, $options); if ($data->isFresh()) { $record = Type\Complex::trim($record); } return $record; }