Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
c063caad
Commit
c063caad
authored
3 years ago
by
Jan-Hendrik Willms
Committed by
Jan-Hendrik Willms
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
throw exceptions when i18nstring is used with a composite primary key, fixes #535
parent
e1b4a3b8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/classes/I18NString.php
+6
-1
6 additions, 1 deletion
lib/classes/I18NString.php
lib/models/SimpleORMap.class.php
+4
-0
4 additions, 0 deletions
lib/models/SimpleORMap.class.php
with
10 additions
and
1 deletion
lib/classes/I18NString.php
+
6
−
1
View file @
c063caad
...
...
@@ -52,7 +52,8 @@ class I18NString
{
$this
->
base
=
$base
;
$this
->
lang
=
$lang
;
$this
->
metadata
=
$metadata
;
$this
->
setMetadata
(
$metadata
);
}
/**
...
...
@@ -151,6 +152,10 @@ class I18NString
*/
public
function
setMetadata
(
$metadata
)
{
if
(
isset
(
$metadata
[
'object_id'
])
&&
(
is_array
(
$metadata
[
'object_id'
])
||
is_object
(
$metadata
[
'object_id'
])))
{
throw
new
Exception
(
'Can not use array or object as object id'
);
}
$this
->
metadata
=
$metadata
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/models/SimpleORMap.class.php
+
4
−
0
View file @
c063caad
...
...
@@ -296,6 +296,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
if
(
I18N
::
isEnabled
())
{
if
(
isset
(
$config
[
'i18n_fields'
])
&&
count
(
$config
[
'i18n_fields'
])
>
0
)
{
if
(
count
(
$config
[
'pk'
])
>
1
)
{
throw
new
Exception
(
'Can not define i18n fields on a composite primary key'
);
}
$config
[
'registered_callbacks'
][
'before_store'
][]
=
'cbI18N'
;
$config
[
'registered_callbacks'
][
'after_delete'
][]
=
'cbI18N'
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment