File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ public function __call($name, $arguments)
6464 throw new BadMethodCallException ("Call to undefined method " . get_class ($ this ).':: ' .$ name );
6565 }
6666
67+ public function sync () : Entity
68+ {
69+ return $ this ->getRepository ()->sync ($ this ->id );
70+ }
71+
6772 public function __debugInfo ()
6873 {
6974 $ info = get_object_vars ($ this );
Original file line number Diff line number Diff line change 44use Tarantool \Client \Client ;
55use Tarantool \Client \Middleware \FirewallMiddleware ;
66use Tarantool \Client \Middleware \LoggingMiddleware ;
7+ use Tarantool \Client \Schema \Operations ;
78use Tarantool \Client \Request \InsertRequest ;
89use Tarantool \Mapper \Mapper ;
910use Tarantool \Mapper \Plugin \Sequence ;
1314
1415class MapperTest extends TestCase
1516{
17+ public function testSync ()
18+ {
19+ $ mapper = $ this ->createMapper ();
20+ $ mapper ->getPlugin (new Sequence ($ mapper ));
21+ $ this ->clean ($ mapper );
22+
23+ $ mapper ->getSchema ()
24+ ->createSpace ('post ' )
25+ ->addProperty ('id ' , 'unsigned ' )
26+ ->addProperty ('title ' , 'string ' )
27+ ->addProperty ('slug ' , 'string ' )
28+ ->addIndex ('id ' )
29+ ->addIndex ('slug ' );
30+
31+ $ post = $ mapper ->create ('post ' , ['title ' => 'hello ' ]);
32+
33+ $ this ->assertSame ("" , $ post ->slug );
34+ $ mapper ->getClient ()->getSpace ('post ' )->update ([$ post ->id ], Operations::set (2 , 'hello ' ));
35+ $ this ->assertSame ("" , $ post ->slug );
36+ $ post ->sync ();
37+ $ this ->assertSame ("hello " , $ post ->slug );
38+ }
39+
1640 public function testVinylEngine ()
1741 {
1842 $ mapper = $ this ->createMapper ();
You can’t perform that action at this time.
0 commit comments