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
536f0117
Commit
536f0117
authored
Aug 07, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Huge performance boost: Doctrine::compile()
parent
485067ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
Doctrine.php
Doctrine.php
+81
-0
No files found.
Doctrine.php
View file @
536f0117
...
...
@@ -300,6 +300,87 @@ final class Doctrine {
}
}
}
/**
* method for making a single file of
* most used doctrine components
*
* @throws Doctrine_Exception
* @return void
*/
public
static
function
compile
()
{
if
(
!
self
::
$path
)
self
::
$path
=
dirname
(
__FILE__
);
$classes
=
array
(
"Doctrine"
,
"Configurable"
,
"Manager"
,
"Session"
,
"Table"
,
"Iterator"
,
"Exception"
,
"Access"
,
"Record"
,
"Record_Iterator"
,
"Collection"
,
"Validator"
,
"Hydrate"
,
"Query"
,
"Query_Part"
,
"Query_From"
,
"Query_Orderby"
,
"Query_Groupby"
,
"Query_Condition"
,
"Query_Where"
,
"Query_Having"
,
"RawSql"
,
"EventListener_Interface"
,
"EventListener"
,
"Relation"
,
"ForeignKey"
,
"LocalKey"
,
"Association"
,
"DB"
);
$ret
=
array
();
foreach
(
$classes
as
$class
)
{
if
(
$class
!==
"Doctrine"
)
$class
=
'Doctrine_'
.
$class
;
$file
=
self
::
$path
.
DIRECTORY_SEPARATOR
.
str_replace
(
"_"
,
DIRECTORY_SEPARATOR
,
$class
)
.
".php"
;
if
(
!
file_exists
(
$file
))
throw
new
Doctrine_Exception
(
"Couldn't compile
$file
. File
$file
does not exists."
);
self
::
autoload
(
$class
);
$refl
=
new
ReflectionClass
(
$class
);
$lines
=
file
(
$file
);
$start
=
$refl
->
getStartLine
()
-
1
;
$end
=
$refl
->
getEndLine
()
-
2
;
$i
=
0
;
while
(
$i
<
count
(
$lines
))
{
$i
++
;
if
(
$i
<
$start
)
continue
;
$ret
[]
=
$lines
[
$i
];
if
(
$i
>
$end
)
break
;
}
}
$fp
=
fopen
(
self
::
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
,
'w+'
);
fwrite
(
$fp
,
"<?php
"
.
implode
(
''
,
$ret
)
.
"
?>"
);
fclose
(
$fp
);
}
/**
* simple autoload function
* returns true if the class was loaded, otherwise false
...
...
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