Skip to content

Commit a795f6a

Browse files
author
Nikita Chernyi
committed
Moved getData()/setData() to core
1 parent 5c43d7c commit a795f6a

File tree

3 files changed

+1
-42
lines changed

3 files changed

+1
-42
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"prefer-stable": true,
77
"require": {
88
"ext-pdo": "*",
9-
"wtf/core": "^1",
9+
"wtf/core": "^1.1.6",
1010
"catfan/medoo": "@stable",
1111
"robmorgan/phinx": "@stable",
1212
"respect/validation": "^1"

src/Entity.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,6 @@ public function getScheme(): array
6161
return $this->scheme;
6262
}
6363

64-
/**
65-
* Return all entity data as array.
66-
*
67-
* @return array
68-
*/
69-
public function getData(): array
70-
{
71-
return $this->data;
72-
}
73-
74-
/**
75-
* Set all data to entity.
76-
*
77-
* @param array $data
78-
*
79-
* @return Entity
80-
*/
81-
public function setData(array $data)
82-
{
83-
$this->data = \array_merge($this->data, $data);
84-
85-
return $this;
86-
}
87-
8864
/**
8965
* Save entity data in db.
9066
*

tests/EntityTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,6 @@ protected function setUp(): void
2323
$this->container->medoo->pdo->exec($query);
2424
}
2525

26-
public function testGetSet(): void
27-
{
28-
//getData (from scratch)
29-
$entity = $this->container['entity']('dummy_entity');
30-
$this->assertEquals([], $entity->getData());
31-
//setData (from scratch)
32-
$entity->setData(['one' => true, 'two' => true]);
33-
$this->assertTrue($entity->getOne());
34-
$this->assertTrue($entity->getTwo());
35-
//setData (mege)
36-
$entity->setData(['one' => false]);
37-
$this->assertFalse($entity->getOne());
38-
$this->assertTrue($entity->getTwo());
39-
//getData (with data)
40-
$this->assertEquals(['one' => false, 'two' => true], $entity->getData());
41-
}
42-
4326
public function testSave(): void
4427
{
4528
$data = ['email' => '[email protected]', 'name' => 'Test user', 'notexisting' => 'field'];

0 commit comments

Comments
 (0)