File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11
2+ 0.2.2 发布日期:2016-01-06
3+ ----
4+
5+ * 修复保存关联文件的对象时的语法错误 close #46
6+
270.2.1 发布日期:2015-12-31
38----
49
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class LeanClient {
2222 /**
2323 * Client version
2424 */
25- const VERSION = '0.2.1 ' ;
25+ const VERSION = '0.2.2 ' ;
2626
2727 /**
2828 * API Endpoints for Regions
Original file line number Diff line number Diff line change @@ -583,7 +583,7 @@ public static function saveAll($objects) {
583583 $ children = array (); // Array of unsaved objects excluding files
584584 forEach ($ unsavedChildren as $ obj ) {
585585 if ($ obj instanceof LeanFile) {
586- $ obj. save ();
586+ $ obj-> save ();
587587 } else if ($ obj instanceof LeanObject) {
588588 if (!in_array ($ obj , $ children )) {
589589 $ children [] = $ obj ;
Original file line number Diff line number Diff line change 11<?php
22
3+ use LeanCloud \LeanObject ;
34use LeanCloud \LeanClient ;
45use LeanCloud \LeanFile ;
56
@@ -90,5 +91,24 @@ public function testMetaData() {
9091
9192 $ file ->destroy ();
9293 }
94+
95+ /*
96+ * leancloud/php-sdk#46
97+ */
98+ public function testSaveObjectWithFile () {
99+ $ obj = new LeanObject ("TestObject " );
100+ $ obj ->set ("name " , "alice " );
101+
102+ $ file = LeanFile::createWithData ("test.txt " , "你好,中国! " );
103+ $ obj ->addIn ("files " , $ file );
104+ $ obj ->save ();
105+
106+ $ this ->assertNotEmpty ($ obj ->getObjectId ());
107+ $ this ->assertNotEmpty ($ file ->getObjectId ());
108+ $ this ->assertNotEmpty ($ file ->getUrl ());
109+
110+ $ file ->destroy ();
111+ $ obj ->destroy ();
112+ }
93113}
94114
You can’t perform that action at this time.
0 commit comments