Skip to content

Commit 3624ed1

Browse files
author
Marco Bunge
committed
Update identity map and unit of work. Fix datatype issues
1 parent 6ac07d7 commit 3624ed1

18 files changed

+210
-151
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Create a Connection and register mappers
5959
```php
6060
<?php
6161

62-
use Hawkbit\Storage\ConnectionManager;
62+
use Hawkbit\Database\ConnectionManager;
6363
use Application\Persistence\Mappers\PostMapper;
6464

6565
$connection = ConnectionManager::create([

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
},
2929
"autoload": {
3030
"psr-4": {
31-
"Hawkbit\\Storage\\": "src/"
31+
"Hawkbit\\Database\\": "src/"
3232
}
3333
},
3434
"autoload-dev": {
3535
"psr-4": {
36-
"Hawkbit\\Storage\\Tests\\": "tests/"
36+
"Hawkbit\\Database\\Tests\\": "tests/"
3737
}
3838
},
3939
"scripts": {

example/Persistence/Mappers/PostMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Application\Persistence\Entities\Post;
1313
use Doctrine\DBAL\Schema\Column;
1414
use Doctrine\DBAL\Types\Type;
15-
use Hawkbit\Storage\AbstractMapper;
15+
use Hawkbit\Database\AbstractMapper;
1616

1717
class PostMapper extends AbstractMapper
1818
{

example/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Application\Persistence\Entities\Post;
44
use Application\Persistence\Mappers\PostMapper;
5-
use Hawkbit\Storage\ConnectionManager;
5+
use Hawkbit\Database\ConnectionManager;
66

77
require_once __DIR__ . '/../vendor/autoload.php';
88

src/AbstractMapper.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 15:25
77
*/
88

9-
namespace Hawkbit\Storage;
9+
namespace Hawkbit\Database;
1010

1111

1212
use Doctrine\Common\Inflector\Inflector;
@@ -167,8 +167,10 @@ final public function getColumns()
167167
*/
168168
final public function createEntity($id = null){
169169
$identityMap = $this->getIdentityMap();
170-
if($identityMap->hasId($id)){
171-
return $identityMap->getObject($id);
170+
if(null !== $id){
171+
if($identityMap->hasId($id)){
172+
return $identityMap->getObject($id);
173+
}
172174
}
173175
$class = $this->getEntityClass();
174176
return new $class;

src/Connection.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 14:04
77
*/
88

9-
namespace Hawkbit\Storage;
9+
namespace Hawkbit\Database;
1010

1111
use Doctrine\DBAL\Driver;
1212

@@ -31,11 +31,6 @@ final class Connection extends \Doctrine\DBAL\Connection
3131
*/
3232
private $mapperLocator;
3333

34-
/**
35-
* @var EntityStates
36-
*/
37-
private $objectGraph;
38-
3934
/**
4035
* @var IdentityMap[]
4136
*/
@@ -107,14 +102,4 @@ public function createUnitOfWork(){
107102
return new UnitOfWork($this);
108103
}
109104

110-
/**
111-
* @return EntityStates
112-
*/
113-
public function getObjectGraph(){
114-
if(null === $this->objectGraph){
115-
$this->objectGraph = new EntityStates($this);
116-
}
117-
return $this->objectGraph;
118-
}
119-
120105
}

src/ConnectionManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 14:00
77
*/
88

9-
namespace Hawkbit\Storage;
9+
namespace Hawkbit\Database;
1010

1111
use Doctrine\DBAL\DBALException;
1212
use Doctrine\DBAL\DriverManager;
@@ -40,7 +40,7 @@ final class ConnectionManager
4040
* Get connection manager instance to share
4141
* connections between different instances.
4242
*
43-
* @return \Hawkbit\Storage\ConnectionManager
43+
* @return \Hawkbit\Database\ConnectionManager
4444
*/
4545
public static function getInstance()
4646
{

src/EntityStates.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/Gateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 10:29
77
*/
88

9-
namespace Hawkbit\Storage;
9+
namespace Hawkbit\Database;
1010

1111
/**
1212
* Grant low-level access to data base
13-
* @package Hawkbit\Storage
13+
* @package Hawkbit\Database
1414
*/
1515
final class Gateway
1616
{

src/Hydrator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
* Time: 13:44
77
*/
88

9-
namespace Hawkbit\Storage;
9+
namespace Hawkbit\Database;
1010

1111

12-
use Hawkbit\Storage\Support\MapperStore;
13-
use Hawkbit\Storage\Support\ReflectionStore;
12+
use Hawkbit\Database\Support\MapperStore;
13+
use Hawkbit\Database\Support\ReflectionStore;
1414

1515
/**
1616
* Class Hydrator
1717
*
1818
* Hydrate or extract from object properties
1919
*
20-
* @package Hawkbit\Storage
20+
* @package Hawkbit\Database
2121
*/
2222
class Hydrator
2323
{

0 commit comments

Comments
 (0)