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
bea3a7c5
Commit
bea3a7c5
authored
Feb 15, 2008
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes backported from 0.9 and 0.10
parent
23ab5b90
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
66 deletions
+127
-66
Configurable.php
lib/Doctrine/Configurable.php
+13
-0
Connection.php
lib/Doctrine/Connection.php
+15
-0
Import.php
lib/Doctrine/Data/Import.php
+3
-3
package.php
package.php
+75
-61
config.php
tools/sandbox/config.php
+1
-1
doctrine.php
tools/sandbox/doctrine.php
+20
-1
No files found.
lib/Doctrine/Configurable.php
View file @
bea3a7c5
...
...
@@ -385,6 +385,19 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
*/
public
function
getAttribute
(
$attribute
)
{
if
(
is_string
(
$attribute
))
{
$upper
=
strtoupper
(
$attribute
);
$const
=
'Doctrine::ATTR_'
.
$upper
;
if
(
defined
(
$const
))
{
$attribute
=
constant
(
$const
);
$this
->
_state
=
$attribute
;
}
else
{
throw
new
Doctrine_Exception
(
'Unknown attribute: "'
.
$attribute
.
'"'
);
}
}
$attribute
=
(
int
)
$attribute
;
if
(
$attribute
<
0
)
{
...
...
lib/Doctrine/Connection.php
View file @
bea3a7c5
...
...
@@ -328,11 +328,26 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
return
$this
->
_name
;
}
/**
* setName
*
* Sets the name of the connection
*
* @param string $name
* @return void
*/
public
function
setName
(
$name
)
{
$this
->
_name
=
$name
;
}
/**
* getDriverName
*
* Gets the name of the instance driver
*
* @return void
*/
public
function
getDriverName
()
{
return
$this
->
driverName
;
...
...
lib/Doctrine/Data/Import.php
View file @
bea3a7c5
...
...
@@ -130,6 +130,9 @@ class Doctrine_Data_Import extends Doctrine_Data
foreach
(
$row
as
$key
=>
$value
)
{
if
(
$obj
->
getTable
()
->
hasField
(
$key
))
{
$obj
->
set
(
$key
,
$value
);
}
else
if
(
method_exists
(
$obj
,
'set'
.
Doctrine
::
classify
(
$key
)))
{
$func
=
'set'
.
Doctrine
::
classify
(
$key
);
$obj
->
$func
(
$value
);
}
else
if
(
$obj
->
getTable
()
->
hasRelation
(
$key
))
{
if
(
is_array
(
$value
))
{
if
(
isset
(
$value
[
0
]))
{
...
...
@@ -149,9 +152,6 @@ class Doctrine_Data_Import extends Doctrine_Data
}
else
{
$obj
->
set
(
$key
,
$this
->
_getImportedObject
(
$value
));
}
}
else
if
(
method_exists
(
$obj
,
'set'
.
Doctrine
::
classify
(
$key
)))
{
$func
=
'set'
.
Doctrine
::
classify
(
$key
);
$obj
->
$func
(
$value
);
}
}
}
...
...
package.php
View file @
bea3a7c5
<?php
require_once
(
'PEAR/PackageFileManager2.php'
);
PEAR
::
setErrorHandling
(
PEAR_ERROR_DIE
);
buildPearPackage
(
'/Users/jwage/Sites/doctrine/trunk'
,
'0.9.0'
,
'beta'
);
$packagexml
=
new
PEAR_PackageFileManager2
;
function
buildPearPackage
(
$path
,
$version
,
$state
)
{
$packageFile
=
$path
.
DIRECTORY_SEPARATOR
.
'package.xml'
;
require_once
(
'PEAR/packageFileManager2.php'
);
PEAR
::
setErrorHandling
(
PEAR_ERROR_DIE
);
$version_release
=
'0.9'
;
$version_api
=
$version_release
;
$state
=
'beta'
;
$notes
=
<<<EOT
barfoo
$packagexml
=
new
PEAR_packageFileManager2
;
$notes
=
<<<EOT
-
EOT;
$summary
=
'PHP5 Database ORM'
;
$summary
=
'PHP5 Database ORM'
;
$description
=<<<
EOT
$description
=<<<
EOT
Doctrine
is
an
ORM
(
object
relational
mapper
)
for
PHP
5.2
.
x
+
that
sits
on
top
of
a
powerful
DBAL
(
database
abstraction
layer
)
.
One
of
its
key
features
is
the
ability
to
optionally
write
database
queries
in
an
OO
(
object
oriented
)
...
...
@@ -24,57 +26,69 @@ a powerful alternative to SQL that maintains a maximum of flexibility without
requiring
needless
code
duplication
.
EOT
;
$packagefile
=
'./package.xml'
;
$options
=
array
(
'filelistgenerator'
=>
'svn'
,
'changelogoldtonew'
=>
false
,
'simpleoutput'
=>
true
,
'baseinstalldir'
=>
'/'
,
'packagedirectory'
=>
'./'
,
'packagefile'
=>
$packagefile
,
'clearcontents'
=>
false
,
'ignore'
=>
array
(
'vendor/'
,
'tools/'
,
'package*.php'
,
'package*.xml'
,
),
'dir_roles'
=>
array
(
'lib'
=>
'php'
,
'manual'
=>
'doc'
,
'models'
=>
'doc'
,
'tests'
=>
'test'
,
),
'exceptions'
=>
array
(
'README'
=>
'doc'
,
'CHANGELOG'
=>
'doc'
,
'LICENSE'
=>
'doc'
,
'COPYRIGHT'
=>
'doc'
)
);
$options
=
array
(
'filelistgenerator'
=>
'svn'
,
'changelogoldtonew'
=>
false
,
'simpleoutput'
=>
true
,
'baseinstalldir'
=>
'/'
,
'packagedirectory'
=>
$path
,
'packageFile'
=>
$packageFile
,
'clearcontents'
=>
false
,
// What to ignore
'ignore'
=>
array
(
$path
.
DIRECTORY_SEPARATOR
.
'vendor/'
,
$path
.
DIRECTORY_SEPARATOR
.
'package*.*'
,
$path
.
DIRECTORY_SEPARATOR
.
'tests_old/'
,
$path
.
DIRECTORY_SEPARATOR
.
'tests/'
,
$path
.
DIRECTORY_SEPARATOR
.
'tools/'
),
// What to include in package
'include'
=>
array
(
$path
.
DIRECTORY_SEPARATOR
.
'lib/'
,
$path
.
DIRECTORY_SEPARATOR
.
'manual/'
,
$path
.
DIRECTORY_SEPARATOR
.
'vendor/'
,
$path
.
DIRECTORY_SEPARATOR
.
'README'
,
$path
.
DIRECTORY_SEPARATOR
.
'CHANGELOG'
,
$path
.
DIRECTORY_SEPARATOR
.
'LICENSE'
,
$path
.
DIRECTORY_SEPARATOR
.
'COPYRIGHT'
),
// Dir roles
'dir_roles'
=>
array
(
'lib'
=>
'php'
,
'manual'
=>
'doc'
,
'vendor'
=>
'php'
),
// File roles
'exceptions'
=>
array
(
'README'
=>
'doc'
,
'CHANGELOG'
=>
'doc'
,
'LICENSE'
=>
'doc'
,
'COPYRIGHT'
=>
'doc'
)
);
$package
=
&
PEAR_PackageFileManager2
::
importOptions
(
$packagef
ile
,
$options
);
$package
->
setPackageType
(
'php'
);
$package
=
&
PEAR_packageFileManager2
::
importOptions
(
$packageF
ile
,
$options
);
$package
->
setPackageType
(
'php'
);
$package
->
clearDeps
();
$package
->
setPhpDep
(
'5.2.3'
);
$package
->
setPearInstallerDep
(
'1.4.0b1'
);
$package
->
addPackageDepWithChannel
(
'required'
,
'PEAR'
,
'pear.php.net'
,
'1.3.6'
);
$package
->
clearDeps
();
$package
->
setPhpDep
(
'5.2.3'
);
$package
->
setPearInstallerDep
(
'1.4.0b1'
);
$package
->
addPackageDepWithChannel
(
'required'
,
'PEAR'
,
'pear.php.net'
,
'1.3.6'
);
$package
->
addRelease
();
$package
->
generateContents
();
$package
->
setReleaseVersion
(
$version_release
);
$package
->
setAPIVersion
(
$version_api
);
$package
->
setReleaseStability
(
$state
);
$package
->
setAPIStability
(
$state
);
$package
->
setNotes
(
$notes
);
$package
->
setSummary
(
$summary
);
$package
->
setDescription
(
$description
);
$package
->
addGlobalReplacement
(
'package-info'
,
'@package_version@'
,
'version'
);
$package
->
addRelease
();
$package
->
generateContents
();
$package
->
setReleaseVersion
(
$version
);
$package
->
setAPIVersion
(
$version
);
$package
->
setReleaseStability
(
$state
);
$package
->
setAPIStability
(
$state
);
$package
->
setNotes
(
$notes
);
$package
->
setSummary
(
$summary
);
$package
->
setDescription
(
$description
);
$package
->
addGlobalReplacement
(
'package-info'
,
'@package_version@'
,
'version'
);
if
(
isset
(
$_GET
[
'make'
])
||
(
isset
(
$_SERVER
[
'argv'
])
&&
@
$_SERVER
[
'argv'
][
1
]
==
'make'
))
{
$package
->
writePackageFile
();
}
else
{
$package
->
debugPackageFile
();
}
if
(
isset
(
$_GET
[
'make'
])
||
(
isset
(
$_SERVER
[
'argv'
])
&&
@
$_SERVER
[
'argv'
][
1
]
==
'make'
))
{
$package
->
writepackageFile
();
}
else
{
$package
->
debugpackageFile
();
}
}
\ No newline at end of file
tools/sandbox/config.php
View file @
bea3a7c5
...
...
@@ -50,4 +50,4 @@ spl_autoload_register(array('Doctrine', 'autoload'));
Doctrine_Manager
::
connection
(
DSN
,
'sandbox'
);
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
Doctrine
::
ATTR_MODEL_LOADING
,
Doctrine
::
MODEL_LOADING_CONSERVATIVE
);
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
'model_loading'
,
'conservative'
);
\ No newline at end of file
tools/sandbox/doctrine.php
View file @
bea3a7c5
#!/usr/bin/env php
<?php
require_once
(
'config.php'
);
chdir
(
dirname
(
__FILE__
));
define
(
'SANDBOX_PATH'
,
dirname
(
__FILE__
));
define
(
'DOCTRINE_PATH'
,
dirname
(
dirname
(
SANDBOX_PATH
))
.
DIRECTORY_SEPARATOR
.
'lib'
);
define
(
'DATA_FIXTURES_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'data'
.
DIRECTORY_SEPARATOR
.
'fixtures'
);
define
(
'MODELS_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'models'
);
define
(
'MIGRATIONS_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'migrations'
);
define
(
'SQL_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'data'
.
DIRECTORY_SEPARATOR
.
'sql'
);
define
(
'YAML_SCHEMA_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'schema'
);
define
(
'DB_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'sandbox.db'
);
define
(
'DSN'
,
'sqlite:///'
.
DB_PATH
);
require_once
(
DOCTRINE_PATH
.
DIRECTORY_SEPARATOR
.
'Doctrine.php'
);
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
Doctrine_Manager
::
connection
(
DSN
,
'sandbox'
);
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
Doctrine
::
ATTR_MODEL_LOADING
,
Doctrine
::
MODEL_LOADING_CONSERVATIVE
);
// Configure Doctrine Cli
// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled
...
...
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