1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AppserverIo\Resources\DBResourcesFactory |
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
|
|
|
* @copyright 2018 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/appserver-io/resources |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Resources; |
22
|
|
|
|
23
|
|
|
use AppserverIo\Lang\String; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Factory for the database resources. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @copyright 2018 TechDivision GmbH <[email protected]> |
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
31
|
|
|
* @link https://github.com/appserver-io/resources |
32
|
|
|
* @link http://www.appserver.io |
33
|
|
|
*/ |
34
|
|
|
class DBResourcesFactory extends AbstractResourcesFactory |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Create and return a new resources instance with the specified logical name, after calling its init() |
39
|
|
|
* method and delegating the relevant properties. Concrete subclasses MUST implement this method. |
40
|
|
|
* |
41
|
|
|
* @param \AppserverIo\Lang\String $name Holds the logical name of the Resources to create |
42
|
|
|
* @param \AppserverIo\Lang\String $config Holds the optional string to the configuration |
43
|
|
|
* |
44
|
|
|
* @return \AppserverIo\Resources\Interfaces\ResourcesInterface Holds the initialized resources |
45
|
|
|
* @see \AppserverIo\Resources\AbstractResourcesFactory::createResources(); |
46
|
|
|
*/ |
47
|
|
|
protected function createResources(String $name, String $config = null) |
48
|
|
|
{ |
49
|
|
|
|
50
|
|
|
// initialize the new Resources |
51
|
|
|
$resources = new DBResources($name, $config); |
52
|
|
|
$resources->initialize(); |
53
|
|
|
$resources->setReturnNull($this->isReturnNull()); |
54
|
|
|
|
55
|
|
|
// return the resources |
56
|
|
|
return $resources; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|