Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
1f6676f1
Commit
1f6676f1
authored
Jan 06, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache driver corrections
parent
7363fc3e
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
199 deletions
+62
-199
Apc.php
lib/Doctrine/ORM/Cache/Apc.php
+6
-6
Array.php
lib/Doctrine/ORM/Cache/Array.php
+1
-1
Db.php
lib/Doctrine/ORM/Cache/Db.php
+6
-5
Driver.php
lib/Doctrine/ORM/Cache/Driver.php
+0
-78
Exception.php
lib/Doctrine/ORM/Cache/Exception.php
+0
-34
Interface.php
lib/Doctrine/ORM/Cache/Interface.php
+6
-5
Memcache.php
lib/Doctrine/ORM/Cache/Memcache.php
+22
-30
Xcache.php
lib/Doctrine/ORM/Cache/Xcache.php
+3
-7
AssociationMapping.php
lib/Doctrine/ORM/Mapping/AssociationMapping.php
+0
-18
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+18
-3
OneToOneMapping.php
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
+0
-12
No files found.
lib/Doctrine/ORM/Cache/Apc.php
View file @
1f6676f1
...
...
@@ -19,30 +19,30 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine
::ORM::Cache;
#namespace Doctrine
\ORM\Cache;
/**
* APC cache driver.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.
phpdoctrine
.org
* @link www.
doctrine-project
.org
* @since 1.0
* @version $Revision: 4910 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class
Doctrine_
Cache_Apc
extends
Doctrine_Cache_Driver
class
Doctrine_
ORM_Cache_ApcCache
implements
Doctrine_ORM_Cache_Cache
{
/**
* constructor
*
* @param array $options associative array of cache driver options
*/
public
function
__construct
(
$options
=
array
()
)
public
function
__construct
()
{
if
(
!
extension_loaded
(
'apc'
))
{
throw
new
Doctrine_Cache_Exception
(
'The apc extension must be loaded for using this backend !'
);
}
parent
::
__construct
(
$options
);
}
/**
...
...
lib/Doctrine/ORM/Cache/Array.php
View file @
1f6676f1
...
...
@@ -28,7 +28,7 @@
* @version $Revision: 4910 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_
Cache_Array
implements
Doctrine_Cache_Interfac
e
class
Doctrine_
ORM_Cache_ArrayCache
implements
Doctrine_ORM_Cache_Cach
e
{
/**
* @var array $data an array of cached data
...
...
lib/Doctrine/ORM/Cache/Db.php
View file @
1f6676f1
...
...
@@ -30,8 +30,10 @@
* @version $Revision: 3931 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_
Cache_Db
extends
Doctrine_Cache_Driver
implements
Countable
class
Doctrine_
ORM_Cache_DbCache
implements
Doctrine_ORM_Cache_Cache
,
Countable
{
private
$_options
=
array
();
/**
* constructor
*
...
...
@@ -40,18 +42,17 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable
public
function
__construct
(
$options
)
{
if
(
!
isset
(
$options
[
'connection'
])
||
!
(
$options
[
'connection'
]
instanceof
Doctrine_Connection
))
{
!
(
$options
[
'connection'
]
instanceof
Doctrine_
DBAL_
Connection
))
{
throw
new
Doctrine_
Cache_
Exception
(
'Connection option not set.'
);
throw
new
Doctrine_Exception
(
'Connection option not set.'
);
}
if
(
!
isset
(
$options
[
'tableName'
])
||
!
is_string
(
$options
[
'tableName'
]))
{
throw
new
Doctrine_
Cache_
Exception
(
'Table name option not set.'
);
throw
new
Doctrine_Exception
(
'Table name option not set.'
);
}
$this
->
_options
=
$options
;
}
...
...
lib/Doctrine/ORM/Cache/Driver.php
deleted
100644 → 0
View file @
7363fc3e
<?php
/*
* $Id: Driver.php 4910 2008-09-12 08:51:56Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Base class for cache drivers.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 4910 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
abstract
class
Doctrine_Cache_Driver
implements
Doctrine_Cache_Interface
{
/**
* @var array $_options an array of options
*/
protected
$_options
=
array
();
/**
* constructor
*
* @param array $_options an array of options
*/
public
function
__construct
(
$options
)
{
$this
->
_options
=
$options
;
}
/**
* setOption
*
* @param mixed $option the option name
* @param mixed $value option value
* @return boolean TRUE on success, FALSE on failure
*/
public
function
setOption
(
$option
,
$value
)
{
if
(
isset
(
$this
->
_options
[
$option
]))
{
$this
->
_options
[
$option
]
=
$value
;
return
true
;
}
return
false
;
}
/**
* getOption
*
* @param mixed $option the option name
* @return mixed option value
*/
public
function
getOption
(
$option
)
{
if
(
!
isset
(
$this
->
_options
[
$option
]))
{
return
null
;
}
return
$this
->
_options
[
$option
];
}
}
lib/Doctrine/ORM/Cache/Exception.php
deleted
100644 → 0
View file @
7363fc3e
<?php
/*
* $Id: Exception.php 3882 2008-02-22 18:11:35Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine
::
autoload
(
'Doctrine_Exception'
);
/**
* Doctrine_Cache_Exception
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3882 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_Cache_Exception
extends
Doctrine_Exception
{
}
lib/Doctrine/ORM/Cache/Interface.php
View file @
1f6676f1
...
...
@@ -19,18 +19,19 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine\ORM\Cache;
/**
*
Doctrine_Cache_Interface
*
Interface for cache drivers.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.
phpdoctrine
.org
* @link www.
doctrine-project
.org
* @since 1.0
* @version $Revision: 3931 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
interface
Doctrine_
Cache_Interface
interface
Doctrine_
ORM_Cache_Cache
{
/**
* Test if a cache entry is available for the given id and (if yes) return it (false else).
...
...
lib/Doctrine/ORM/Cache/Memcache.php
View file @
1f6676f1
...
...
@@ -28,45 +28,43 @@
* @version $Revision: 4910 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_
Cache_Memcache
extends
Doctrine_Cache_Driver
class
Doctrine_
ORM_Cache_MemcacheCache
implements
Doctrine_ORM_Cache_Cache
{
/**
* @var Memcache $_memcache memcache object
*/
pr
otected
$_memcache
=
null
;
pr
ivate
$_memcache
;
/**
* constructor
*
* @param array $options associative array of cache driver options
*/
public
function
__construct
(
$options
=
array
()
)
public
function
__construct
()
{
if
(
!
extension_loaded
(
'memcache'
))
{
throw
new
Doctrine_Cache_Exception
(
'In order to use Memcache driver, the memcache extension must be loaded.'
);
}
parent
::
__construct
(
$options
);
if
(
isset
(
$options
[
'servers'
]))
{
$value
=
$options
[
'servers'
];
if
(
isset
(
$value
[
'host'
]))
{
// in this case, $value seems to be a simple associative array (one server only)
$value
=
array
(
0
=>
$value
);
// let's transform it into a classical array of associative arrays
}
$this
->
setOption
(
'servers'
,
$value
);
}
$this
->
_memcache
=
new
Memcache
;
foreach
(
$this
->
_options
[
'servers'
]
as
$server
)
{
if
(
!
array_key_exists
(
'persistent'
,
$server
))
{
$server
[
'persistent'
]
=
true
;
}
if
(
!
array_key_exists
(
'port'
,
$server
))
{
$server
[
'port'
]
=
11211
;
}
$this
->
_memcache
->
addServer
(
$server
[
'host'
],
$server
[
'port'
],
$server
[
'persistent'
]);
/**
* Sets the memcache instance to use.
*
* @param Memcache $memcache
*/
public
function
setMemcache
(
Memcache
$memcache
)
{
$this
->
_memcache
=
$memcache
;
}
/**
* Gets the memcache instance used by the cache.
*
* @return Memcache
*/
public
function
getMemcache
()
{
return
$this
->
_memcache
;
}
/**
...
...
@@ -104,13 +102,7 @@ class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver
*/
public
function
save
(
$id
,
$data
,
$lifeTime
=
false
)
{
if
(
$this
->
_options
[
'compression'
])
{
$flag
=
MEMCACHE_COMPRESSED
;
}
else
{
$flag
=
0
;
}
$result
=
$this
->
_memcache
->
set
(
$id
,
$data
,
$flag
,
$lifeTime
);
return
$this
->
_memcache
->
set
(
$id
,
$data
,
0
,
$lifeTime
);
}
/**
...
...
lib/Doctrine/ORM/Cache/Xcache.php
View file @
1f6676f1
...
...
@@ -28,20 +28,16 @@
* @version $Revision: $
* @author Dmitry Bakaleinik (dima@snaiper.net)
*/
class
Doctrine_
Cache_Xcache
extends
Doctrine_Cache_Driver
class
Doctrine_
ORM_Cache_XcacheCache
implements
Doctrine_ORM_Cache_Cache
{
/**
* constructor
*
* @param array $options associative array of cache driver options
*/
public
function
__construct
(
$options
=
array
()
)
public
function
__construct
()
{
if
(
!
extension_loaded
(
'xcache'
))
{
throw
new
Doctrine_
Cache_
Exception
(
'In order to use Xcache driver, the xcache extension must be loaded.'
);
throw
new
Doctrine_Exception
(
'In order to use Xcache driver, the xcache extension must be loaded.'
);
}
parent
::
__construct
(
$options
);
}
/**
...
...
lib/Doctrine/ORM/Mapping/AssociationMapping.php
View file @
1f6676f1
...
...
@@ -121,27 +121,9 @@ abstract class Doctrine_ORM_Mapping_AssociationMapping
*/
public
function
__construct
(
array
$mapping
)
{
//$this->_initMappingArray();
//$mapping = $this->_validateAndCompleteMapping($mapping);
//$this->_mapping = array_merge($this->_mapping, $mapping);*/
$this
->
_validateAndCompleteMapping
(
$mapping
);
}
protected
function
_initMappingArray
()
{
$this
->
_mapping
=
array
(
'fieldName'
=>
null
,
'sourceEntity'
=>
null
,
'targetEntity'
=>
null
,
'mappedBy'
=>
null
,
'joinColumns'
=>
null
,
'joinTable'
=>
null
,
'optional'
=>
true
,
'cascades'
=>
array
()
);
}
/**
* Validates & completes the mapping. Mapping defaults are applied here.
*
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
1f6676f1
...
...
@@ -43,7 +43,6 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
private
$_cacheDriver
;
/**
* Constructor.
* Creates a new factory instance that uses the given metadata driver implementation.
*
* @param $driver The metadata driver to use.
...
...
@@ -54,11 +53,21 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
$this
->
_targetPlatform
=
$targetPlatform
;
}
/**
* Sets the cache driver used by the factory to cache ClassMetadata instances.
*
* @param object $cacheDriver
*/
public
function
setCacheDriver
(
$cacheDriver
)
{
$this
->
_cacheDriver
=
$cacheDriver
;
}
/**
* Gets the cache driver used by the factory to cache ClassMetadata instances.
*
* @return object
*/
public
function
getCacheDriver
()
{
return
$this
->
_cacheDriver
;
...
...
@@ -75,10 +84,10 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
if
(
!
isset
(
$this
->
_loadedMetadata
[
$className
]))
{
if
(
$this
->
_cacheDriver
)
{
if
(
$this
->
_cacheDriver
->
contains
(
"
$className
\$
CLASSMETADATA"
))
{
$this
->
_loadedMetadata
[
$className
]
=
$this
->
_cacheDriver
->
get
(
"
$className
\$
CLASSMETADATA"
);
$this
->
_loadedMetadata
[
$className
]
=
$this
->
_cacheDriver
->
fetch
(
"
$className
\$
CLASSMETADATA"
);
}
else
{
$this
->
_loadMetadata
(
$className
);
$this
->
_cacheDriver
->
put
(
"
$className
\$
CLASSMETADATA"
,
$this
->
_loadedMetadata
[
$className
]
);
$this
->
_cacheDriver
->
save
(
$this
->
_loadedMetadata
[
$className
],
"
$className
\$
CLASSMETADATA"
,
null
);
}
}
else
{
$this
->
_loadMetadata
(
$className
);
...
...
@@ -144,6 +153,12 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
}
}
/**
* Creates a new ClassMetadata instance for the given class name.
*
* @param string $className
* @return Doctrine\ORM\Mapping\ClassMetadata
*/
protected
function
_newClassMetadataInstance
(
$className
)
{
return
new
Doctrine_ORM_Mapping_ClassMetadata
(
$className
);
...
...
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
View file @
1f6676f1
...
...
@@ -52,7 +52,6 @@ class Doctrine_ORM_Mapping_OneToOneMapping extends Doctrine_ORM_Mapping_Associat
protected
$_deleteOrphans
=
false
;
/**
* Constructor.
* Creates a new OneToOneMapping.
*
* @param array $mapping The mapping info.
...
...
@@ -62,17 +61,6 @@ class Doctrine_ORM_Mapping_OneToOneMapping extends Doctrine_ORM_Mapping_Associat
parent
::
__construct
(
$mapping
);
}
/**
* {@inheritdoc}
*
* @override
*/
protected
function
_initMappingArray
()
{
parent
::
_initMappingArray
();
$this
->
_mapping
[
'deleteOrphans'
]
=
false
;
}
/**
* {@inheritdoc}
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment