|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* \AppserverIo\Appserver\Core\Api\Node\PersistenceUnitNode |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Tim Wagner <[email protected]> |
|
15
|
|
|
* @author Bernhard Wick <[email protected]> |
|
16
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
|
17
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
18
|
|
|
* @link https://github.com/appserver-io/appserver |
|
19
|
|
|
* @link http://www.appserver.io |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace AppserverIo\Appserver\Core\Api\Node; |
|
23
|
|
|
|
|
24
|
|
|
use AppserverIo\Description\Annotations as DI; |
|
25
|
|
|
use Doctrine\ORM\Repository\DefaultRepositoryFactory; |
|
26
|
|
|
use AppserverIo\Lang\Reflection\ReflectionClass; |
|
27
|
|
|
use AppserverIo\Description\Api\Node\QueryCacheConfigurationNode; |
|
28
|
|
|
use AppserverIo\Description\Api\Node\ResultCacheConfigurationNode; |
|
29
|
|
|
use AppserverIo\Description\Api\Node\MetadataCacheConfigurationNode; |
|
30
|
|
|
use AppserverIo\Appserver\PersistenceContainer\Doctrine\V2\CacheFactories\ArrayCacheFactory; |
|
31
|
|
|
use Doctrine\ORM\EntityRepository; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* DTO to transfer a applications persistence unit configuration. |
|
35
|
|
|
* |
|
36
|
|
|
* @author Tim Wagner <[email protected]> |
|
37
|
|
|
* @author Bernhard Wick <[email protected]> |
|
38
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
|
39
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
40
|
|
|
* @link https://github.com/appserver-io/appserver |
|
41
|
|
|
* @link http://www.appserver.io |
|
42
|
|
|
*/ |
|
43
|
|
|
class PersistenceUnitNode extends \AppserverIo\Description\Api\Node\PersistenceUnitNode |
|
44
|
|
|
{ |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* The class loaders factory class name. |
|
48
|
|
|
* |
|
49
|
|
|
* @var string |
|
50
|
|
|
* @DI\Mapping(nodeType="string") |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $repositoryFactory; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* The default repository class name to use. |
|
56
|
|
|
* |
|
57
|
|
|
* @var string |
|
58
|
|
|
* @DI\Mapping(nodeType="string") |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $defaultRepositoryClassName; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Initialize the node with the default cache configuration. |
|
64
|
|
|
*/ |
|
65
|
|
|
public function __construct() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->defaultRepositoryClassName = EntityRepository::class; |
|
68
|
|
|
$this->repositoryFactory = (new ReflectionClass(DefaultRepositoryFactory::class))->getShortname(); |
|
69
|
|
|
$this->queryCacheConfiguration = new QueryCacheConfigurationNode(ArrayCacheFactory::class); |
|
70
|
|
|
$this->resultCacheConfiguration = new ResultCacheConfigurationNode(ArrayCacheFactory::class); |
|
71
|
|
|
$this->metadataCacheConfiguration = new MetadataCacheConfigurationNode(ArrayCacheFactory::class); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Returns the entity manager's repository factory class name. |
|
76
|
|
|
* |
|
77
|
|
|
* @return string The entity manager's repository factory class name |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getRepositoryFactory() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->repositoryFactory; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Returns the entity manager's default repository class name. |
|
86
|
|
|
* |
|
87
|
|
|
* @return string The entity manager's default repository class name |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getDefaultRepositoryClassName() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->defaultRepositoryClassName; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|