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
ed383556
Commit
ed383556
authored
Nov 11, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged r3136:3137
parent
b889f427
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
490 deletions
+138
-490
Doctrine.php
lib/Doctrine.php
+43
-2
Builder.php
lib/Doctrine/Import/Builder.php
+41
-105
Schema.php
lib/Doctrine/Import/Schema.php
+25
-8
Sluggable.php
lib/Doctrine/Template/Listener/Sluggable.php
+5
-5
Timestampable.php
lib/Doctrine/Template/Listener/Timestampable.php
+2
-2
Sluggable.php
lib/Doctrine/Template/Sluggable.php
+1
-1
schema-files.txt
manual/docs/en/schema-files.txt
+21
-367
No files found.
lib/Doctrine.php
View file @
ed383556
...
...
@@ -441,9 +441,17 @@ final class Doctrine
*
* Array of all the loaded models and the path to each one for autoloading
*
* @var
string
* @var
array
*/
private
static
$_loadedModels
=
array
();
/**
* _validators
*
* Array of all the loaded validators
* @var array
*/
private
static
$_validators
=
array
();
/**
* __construct
...
...
@@ -1070,7 +1078,13 @@ final class Doctrine
return
mkdir
(
$path
,
$mode
,
true
);
}
function
removeDirectories
(
$folderPath
)
/**
* removeDirectories
*
* @param string $folderPath
* @return void
*/
public
static
function
removeDirectories
(
$folderPath
)
{
if
(
is_dir
(
$folderPath
))
{
...
...
@@ -1093,4 +1107,31 @@ final class Doctrine
return
false
;
}
}
/**
* getValidators
*
* Get available doctrine validators
*
* @return array $validators
*/
public
static
function
getValidators
()
{
if
(
empty
(
self
::
$_validators
))
{
$dir
=
Doctrine
::
getPath
()
.
DIRECTORY_SEPARATOR
.
'Doctrine'
.
DIRECTORY_SEPARATOR
.
'Validator'
;
$files
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$dir
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$files
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
if
(
end
(
$e
)
==
'php'
)
{
$name
=
strtolower
(
$e
[
0
]);
self
::
$_validators
[
$name
]
=
$name
;
}
}
}
return
self
::
$_validators
;
}
}
\ No newline at end of file
lib/Doctrine/Import/Builder.php
View file @
ed383556
This diff is collapsed.
Click to expand it.
lib/Doctrine/Import/Schema.php
View file @
ed383556
...
...
@@ -160,8 +160,9 @@ class Doctrine_Import_Schema
$attributes
=
$this
->
getAttributes
(
$properties
);
$templates
=
$this
->
getTemplates
(
$properties
);
$actAs
=
$this
->
getActAs
(
$properties
);
$tableOptions
=
$this
->
getTableOptions
(
$properties
);
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
);
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
,
$tableOptions
);
}
}
...
...
@@ -282,6 +283,17 @@ class Doctrine_Import_Schema
{
return
isset
(
$properties
[
'actAs'
])
?
$properties
[
'actAs'
]
:
array
();
}
/**
* getTableOptions
*
* @param string $properties
* @return void
*/
public
function
getTableOptions
(
$properties
)
{
return
isset
(
$properties
[
'options'
])
?
$properties
[
'options'
]
:
array
();
}
/**
* parseSchema
...
...
@@ -332,17 +344,21 @@ class Doctrine_Import_Schema
}
$colDesc
[
'ptype'
]
=
isset
(
$field
[
'ptype'
])
?
(
string
)
$field
[
'ptype'
]
:
(
string
)
$colDesc
[
'type'
];
$colDesc
[
'fixed'
]
=
isset
(
$field
[
'fixed'
])
?
(
int
)
$field
[
'fixed'
]
:
null
;
$colDesc
[
'unsigned'
]
=
isset
(
$field
[
'unsigned'
])
?
(
bool
)
$field
[
'unsigned'
]
:
null
;
$colDesc
[
'primary'
]
=
isset
(
$field
[
'primary'
])
?
(
bool
)
(
isset
(
$field
[
'primary'
])
&&
$field
[
'primary'
])
:
null
;
$colDesc
[
'default'
]
=
isset
(
$field
[
'default'
])
?
$field
[
'default'
]
:
null
;
$colDesc
[
'notnull'
]
=
isset
(
$field
[
'notnull'
])
?
(
bool
)
(
isset
(
$field
[
'notnull'
])
&&
$field
[
'notnull'
])
:
null
;
$colDesc
[
'autoincrement'
]
=
isset
(
$field
[
'autoincrement'
])
?
(
bool
)
(
isset
(
$field
[
'autoincrement'
])
&&
$field
[
'autoincrement'
])
:
null
;
$colDesc
[
'autoincrement'
]
=
isset
(
$field
[
'autoinc'
])
?
(
bool
)
(
isset
(
$field
[
'autoinc'
])
&&
$field
[
'autoinc'
])
:
$colDesc
[
'autoincrement'
];
$colDesc
[
'unique'
]
=
isset
(
$field
[
'unique'
])
?
(
bool
)
(
isset
(
$field
[
'unique'
])
&&
$field
[
'unique'
])
:
null
;
$colDesc
[
'values'
]
=
isset
(
$field
[
'values'
])
?
(
array
)
$field
[
'values'
]
:
null
;
$colDesc
[
'values'
]
=
isset
(
$field
[
'values'
])
?
(
array
)
$field
[
'values'
]
:
null
;
$validators
=
Doctrine
::
getValidators
();
foreach
(
$validators
as
$validator
)
{
if
(
isset
(
$field
[
$validator
]))
{
$colDesc
[
$validator
]
=
$field
[
$validator
];
}
}
$columns
[(
string
)
$colDesc
[
'name'
]]
=
$colDesc
;
}
}
...
...
@@ -356,8 +372,9 @@ class Doctrine_Import_Schema
$build
[
$className
][
'attributes'
]
=
isset
(
$table
[
'attributes'
])
?
$table
[
'attributes'
]
:
array
();
$build
[
$className
][
'templates'
]
=
isset
(
$table
[
'templates'
])
?
$table
[
'templates'
]
:
array
();
$build
[
$className
][
'actAs'
]
=
isset
(
$table
[
'actAs'
])
?
$table
[
'actAs'
]
:
array
();
$build
[
$className
][
'options'
]
=
isset
(
$table
[
'options'
])
?
$table
[
'options'
]
:
array
();
$build
[
$className
][
'package'
]
=
isset
(
$table
[
'package'
])
?
$table
[
'package'
]
:
null
;
if
(
isset
(
$table
[
'inheritance'
]))
{
$build
[
$className
][
'inheritance'
]
=
$table
[
'inheritance'
];
}
...
...
lib/Doctrine/Template/Listener/Sluggable.php
View file @
ed383556
...
...
@@ -43,7 +43,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
'type'
=>
'clob'
,
'length'
=>
null
,
'options'
=>
array
(),
'
columns'
=>
array
());
'
fields'
=>
array
());
/**
* __construct
...
...
@@ -69,12 +69,12 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
protected
function
buildSlug
(
$record
)
{
if
(
empty
(
$this
->
_
columns
))
{
if
(
empty
(
$this
->
_
options
[
'fields'
]
))
{
$value
=
(
string
)
$record
;
}
else
{
$value
=
''
;
foreach
(
$this
->
_
columns
as
$column
)
{
$value
=
$record
->
$column
.
' '
;
foreach
(
$this
->
_
options
[
'fields'
]
as
$field
)
{
$value
=
$record
->
$field
.
' '
;
}
}
...
...
@@ -93,4 +93,4 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
return
$value
;
}
}
}
\ No newline at end of file
lib/Doctrine/Template/Listener/Timestampable.php
View file @
ed383556
...
...
@@ -91,9 +91,9 @@ class Doctrine_Template_Listener_Timestampable extends Doctrine_Record_Listener
$options
=
$this
->
_options
[
$type
];
if
(
$options
[
'type'
]
==
'date'
)
{
return
date
(
'Y-m-d'
,
time
());
return
date
(
$options
[
'format'
]
,
time
());
}
else
if
(
$options
[
'type'
]
==
'timestamp'
)
{
return
date
(
'Y-m-d H:i:s'
,
time
());
return
date
(
$options
[
'format'
]
,
time
());
}
else
{
return
time
();
}
...
...
lib/Doctrine/Template/Sluggable.php
View file @
ed383556
...
...
@@ -43,7 +43,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
'type'
=>
'clob'
,
'length'
=>
null
,
'options'
=>
array
(),
'
columns'
=>
array
());
'
fields'
=>
array
());
/**
* __construct
...
...
manual/docs/en/schema-files.txt
View file @
ed383556
This diff is collapsed.
Click to expand it.
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