File tree Expand file tree Collapse file tree
lib/public/AppFramework/Db
tests/lib/AppFramework/Db Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,9 +52,8 @@ public static function fromRow(array $row): static {
5252 $ instance = new static ();
5353
5454 foreach ($ row as $ key => $ value ) {
55- $ prop = ucfirst ($ instance ->columnToProperty ($ key ));
56- $ setter = 'set ' . $ prop ;
57- $ instance ->$ setter ($ value );
55+ $ prop = $ instance ->columnToProperty ($ key );
56+ $ instance ->setter ($ prop , [$ value ]);
5857 }
5958
6059 $ instance ->resetUpdatedFields ();
Original file line number Diff line number Diff line change 2727 * @method void setTrueOrFalse(bool $trueOrFalse)
2828 * @method bool getAnotherBool()
2929 * @method bool isAnotherBool()
30- * @method void setAnotherBool(bool $anotherBool)
3130 * @method string getLongText()
3231 * @method void setLongText(string $longText)
3332 */
@@ -47,6 +46,10 @@ public function __construct($name = null) {
4746 $ this ->addType ('longText ' , 'blob ' );
4847 $ this ->name = $ name ;
4948 }
49+
50+ public function setAnotherBool (bool $ anotherBool ): void {
51+ parent ::setAnotherBool ($ anotherBool );
52+ }
5053}
5154
5255
@@ -71,12 +74,14 @@ public function testResetUpdatedFields() {
7174 public function testFromRow () {
7275 $ row = [
7376 'pre_name ' => 'john ' ,
74- 'email ' => 'john@something.com '
77+ 'email ' => 'john@something.com ' ,
78+ 'another_bool ' => 1 ,
7579 ];
7680 $ this ->entity = TestEntity::fromRow ($ row );
7781
7882 $ this ->assertEquals ($ row ['pre_name ' ], $ this ->entity ->getPreName ());
7983 $ this ->assertEquals ($ row ['email ' ], $ this ->entity ->getEmail ());
84+ $ this ->assertEquals ($ row ['another_bool ' ], $ this ->entity ->getAnotherBool ());
8085 }
8186
8287
You can’t perform that action at this time.
0 commit comments