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
3e31860e
Commit
3e31860e
authored
Oct 25, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Troubleshooting why this does not work and I cleaned up the code.
parent
231b42eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
10 deletions
+40
-10
I18n.php
lib/Doctrine/I18n.php
+16
-6
Plugin.php
lib/Doctrine/Plugin.php
+3
-3
I18n.php
lib/Doctrine/Template/I18n.php
+21
-1
No files found.
lib/Doctrine/I18n.php
View file @
3e31860e
...
@@ -40,18 +40,28 @@ class Doctrine_I18n extends Doctrine_Plugin
...
@@ -40,18 +40,28 @@ class Doctrine_I18n extends Doctrine_Plugin
'pluginTable'
=>
false
,
'pluginTable'
=>
false
,
);
);
protected
$_auditTable
;
/**
* __construct
*
* @param string $options
* @return void
*/
public
function
__construct
(
$options
)
public
function
__construct
(
$options
)
{
{
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
}
}
/**
* buildDefinition
*
* @param object $Doctrine_Table
* @return void
*/
public
function
buildDefinition
(
Doctrine_Table
$table
)
public
function
buildDefinition
(
Doctrine_Table
$table
)
{
{
if
(
empty
(
$this
->
_options
[
'fields'
]))
{
if
(
empty
(
$this
->
_options
[
'fields'
]))
{
throw
new
Doctrine_I18n_Exception
(
'Fields not set.'
);
throw
new
Doctrine_I18n_Exception
(
'Fields not set.'
);
}
}
$this
->
_options
[
'className'
]
=
str_replace
(
'%CLASS%'
,
$this
->
_options
[
'className'
]
=
str_replace
(
'%CLASS%'
,
$this
->
_options
[
'table'
]
->
getComponentName
(),
$this
->
_options
[
'table'
]
->
getComponentName
(),
...
@@ -115,4 +125,4 @@ class Doctrine_I18n extends Doctrine_Plugin
...
@@ -115,4 +125,4 @@ class Doctrine_I18n extends Doctrine_Plugin
return
true
;
return
true
;
}
}
}
}
\ No newline at end of file
lib/Doctrine/Plugin.php
View file @
3e31860e
...
@@ -169,15 +169,15 @@ class Doctrine_Plugin
...
@@ -169,15 +169,15 @@ class Doctrine_Plugin
if
(
$this
->
_options
[
'generateFiles'
])
{
if
(
$this
->
_options
[
'generateFiles'
])
{
if
(
isset
(
$this
->
_options
[
'generatePath'
])
&&
$this
->
_options
[
'generatePath'
])
{
if
(
isset
(
$this
->
_options
[
'generatePath'
])
&&
$this
->
_options
[
'generatePath'
])
{
$builder
->
setTargetPath
(
$this
->
_options
[
'generatePath'
]);
$builder
->
setTargetPath
(
$this
->
_options
[
'generatePath'
]);
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
);
$builder
->
buildRecord
(
$options
,
$columns
,
$relations
);
}
else
{
}
else
{
throw
new
Doctrine_Plugin_Exception
(
'If you wish to generate files then you must specify the path to generate the files in.'
);
throw
new
Doctrine_Plugin_Exception
(
'If you wish to generate files then you must specify the path to generate the files in.'
);
}
}
}
else
{
}
else
{
$def
=
$builder
->
buildDefinition
(
$options
,
$columns
,
$relations
);
$def
=
$builder
->
buildDefinition
(
$options
,
$columns
,
$relations
);
eval
(
$def
);
eval
(
$def
);
}
}
}
}
}
}
\ No newline at end of file
lib/Doctrine/Template/I18n.php
View file @
3e31860e
...
@@ -34,7 +34,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
...
@@ -34,7 +34,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
{
{
protected
$_translation
;
protected
$_translation
;
/**
* __construct
*
* @param string $array
* @return void
*/
public
function
__construct
(
array
$options
)
public
function
__construct
(
array
$options
)
{
{
$this
->
_plugin
=
new
Doctrine_I18n
(
$options
);
$this
->
_plugin
=
new
Doctrine_I18n
(
$options
);
...
@@ -42,6 +47,7 @@ class Doctrine_Template_I18n extends Doctrine_Template
...
@@ -42,6 +47,7 @@ class Doctrine_Template_I18n extends Doctrine_Template
/**
/**
* translation
* translation
*
* sets or retrieves the current translation language
* sets or retrieves the current translation language
*
*
* @return Doctrine_Record this object
* @return Doctrine_Record this object
...
@@ -49,7 +55,15 @@ class Doctrine_Template_I18n extends Doctrine_Template
...
@@ -49,7 +55,15 @@ class Doctrine_Template_I18n extends Doctrine_Template
public
function
translation
(
$language
=
null
)
public
function
translation
(
$language
=
null
)
{
{
$this
->
_translation
=
$language
;
$this
->
_translation
=
$language
;
return
$this
->
_translation
;
}
}
/**
* setUp
*
* @return void
*/
public
function
setUp
()
public
function
setUp
()
{
{
$this
->
_plugin
->
setOption
(
'table'
,
$this
->
_table
);
$this
->
_plugin
->
setOption
(
'table'
,
$this
->
_table
);
...
@@ -67,6 +81,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
...
@@ -67,6 +81,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
$this
->
hasMany
(
$className
.
' as Translation'
,
array
(
'local'
=>
$id
,
'foreign'
=>
$id
));
$this
->
hasMany
(
$className
.
' as Translation'
,
array
(
'local'
=>
$id
,
'foreign'
=>
$id
));
}
}
/**
* getI18n
*
* @return void
*/
public
function
getI18n
()
public
function
getI18n
()
{
{
return
$this
->
_plugin
;
return
$this
->
_plugin
;
...
...
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