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
a20d0544
Commit
a20d0544
authored
Jul 26, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CustomPrimaryKeyTestCase added
parent
990548d3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
144 additions
and
8 deletions
+144
-8
Doctrine.php
Doctrine.php
+23
-2
Collection.php
Doctrine/Collection.php
+20
-1
Iterator.php
Doctrine/Iterator.php
+19
-0
Record.php
Doctrine/Record.php
+27
-0
Advanced components - Locking Manager - Examples.php
...odes/Advanced components - Locking Manager - Examples.php
+8
-4
Basic Components - Query - Method overloading.php
...l/codes/Basic Components - Query - Method overloading.php
+9
-1
Basic Components - Query - FROM - selecting tables.php
...cs/Basic Components - Query - FROM - selecting tables.php
+3
-0
CustomPrimaryKeyTestCase.php
tests/CustomPrimaryKeyTestCase.php
+26
-0
classes.php
tests/classes.php
+6
-0
run.php
tests/run.php
+3
-0
No files found.
Doctrine.php
View file @
a20d0544
<?php
/*
* $Id$
*
* 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.com>.
*/
require_once
(
"Doctrine/Exception.php"
);
/**
* Doctrine
* the base class of Doctrine framework
*
* @package Doctrine
ORM
* @
url www.phpdoctrine.com
* @package Doctrine
* @
author Konsta Vesterinen
* @license LGPL
*/
final
class
Doctrine
{
...
...
Doctrine/Collection.php
View file @
a20d0544
<?php
require_once
(
"Access.php"
);
/*
* $Id$
*
* 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.com>.
*/
Doctrine
::
autoload
(
"Access"
);
/**
* Doctrine_Collection
* Collection of Doctrine_Record objects.
...
...
Doctrine/Iterator.php
View file @
a20d0544
<?php
/*
* $Id$
*
* 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.com>.
*/
/**
* Doctrine_Iterator
* iterates through Doctrine_Collection
...
...
Doctrine/Record.php
View file @
a20d0544
<?php
/*
* $Id$
*
* 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.com>.
*/
require_once
(
"Access.php"
);
/**
* Doctrine_Record
* All record classes should inherit this super class
*
* @author Konsta Vesterinen
* @license LGPL
* @package Doctrine
*/
abstract
class
Doctrine_Record
extends
Doctrine_Access
implements
Countable
,
IteratorAggregate
,
Serializable
{
/**
* STATE CONSTANTS
...
...
manual/codes/Advanced components - Locking Manager - Examples.php
View file @
a20d0544
...
...
@@ -6,13 +6,17 @@ $lockingMngr = new Doctrine_Locking_Manager_Pessimistic();
try
{
// Ensure that old locks which timed out are released before we try to acquire our lock
$lockingMngr
->
releaseAgedLocks
(
300
);
// 300 seconds = 5 minutes timeout
// Ensure that old locks which timed out are released
// before we try to acquire our lock
// 300 seconds = 5 minutes timeout
$lockingMngr
->
releaseAgedLocks
(
300
);
// Try to get the lock on a record
$gotLock
=
$lockingMngr
->
getLock
(
$myRecordToLock
,
// The record to lock. This can be any Doctrine_Record
'Bart Simpson'
// The unique identifier of the user who is trying to get the lock
// The record to lock. This can be any Doctrine_Record
$myRecordToLock
,
// The unique identifier of the user who is trying to get the lock
'Bart Simpson'
);
if
(
$gotLock
)
...
...
manual/codes/Basic Components - Query - Method overloading.php
View file @
a20d0544
...
...
@@ -5,8 +5,16 @@ $query = new Doctrine_Query($session);
$query
->
from
(
"User-b"
)
->
where
(
"User.name LIKE 'Jack%'"
)
->
orderby
(
"User.created"
)
;
->
orderby
(
"User.created"
)
->
limit
(
5
);
$users
=
$query
->
execute
();
$query
->
from
(
"User.Group.Phonenumber"
)
->
where
(
"User.Group.name LIKE 'Actors%'"
)
->
orderby
(
"User.name"
)
->
limit
(
10
)
->
offset
(
5
);
$users
=
$query
->
execute
();
?>
manual/docs/Basic Components - Query - FROM - selecting tables.php
0 → 100644
View file @
a20d0544
DQL
FROM
-
part
is
used
for
selecting
tables
as
well
as
for
selecting
fields
.
Related
components
are
selected
either
with
colon
-
operator
or
dot
-
operator
(
See
<
a
href
=
"documentation.php?index=2.8.php"
>
Relation
operators
</
a
>
)
.
<
br
\
>
You
can
place
the
selected
fields
in
()
-
brackets
(
eg
.
'FROM User(name, id)'
)
.
If
you
are
about
to
select
all
fields
you
can
simple
use
'FROM User'
.
tests/CustomPrimaryKeyTestCase.php
0 → 100644
View file @
a20d0544
<?php
require_once
(
"UnitTestCase.php"
);
class
Doctrine_CustomPrimaryKeyTestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
"CustomPK"
);
}
public
function
testOperations
()
{
$c
=
new
CustomPK
();
$this
->
assertTrue
(
$c
instanceof
Doctrine_Record
);
$c
->
name
=
"custom pk test"
;
$this
->
assertEqual
(
$c
->
getID
(),
array
());
$c
->
save
();
$this
->
assertEqual
(
$c
->
getID
(),
array
(
"uid"
=>
1
));
$this
->
session
->
clear
();
$c
=
$this
->
session
->
getTable
(
'CustomPK'
)
->
find
(
1
);
$this
->
assertEqual
(
$c
->
getID
(),
array
(
"uid"
=>
1
));
}
}
?>
tests/classes.php
View file @
a20d0544
...
...
@@ -319,6 +319,12 @@ class EnumTest extends Doctrine_Record {
$this
->
setEnumValues
(
"status"
,
array
(
"open"
,
"verified"
,
"closed"
));
}
}
class
CustomPK
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"uid"
,
"integer"
,
11
,
"autoincrement|primary"
);
$this
->
hasColumn
(
"name"
,
"string"
,
255
);
}
}
class
Log_Entry
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"stamp"
,
"timestamp"
);
...
...
tests/run.php
View file @
a20d0544
...
...
@@ -20,6 +20,7 @@ require_once("QueryTestCase.php");
require_once
(
"CacheQuerySqliteTestCase.php"
);
require_once
(
"ViewTestCase.php"
);
require_once
(
"RawSqlTestCase.php"
);
require_once
(
"CustomPrimaryKeyTestCase.php"
);
error_reporting
(
E_ALL
);
...
...
@@ -57,6 +58,8 @@ $test->addTestCase(new Doctrine_QueryTestCase());
$test
->
addTestCase
(
new
Doctrine_RawSql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_CustomPrimaryKeyTestCase
());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
...
...
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