Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eck-3207755
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
eck-3207755
Commits
6a9d2ce8
Commit
6a9d2ce8
authored
12 years ago
by
Tom Kirkpatrick
Committed by
Gerardo Gonzalez
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
#1559650
feature cant be deployed after adding a new entity type
parent
e2cc24fe
No related branches found
Branches containing commit
Tags
7.x-2.0-rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
eck.features.inc
+44
-9
44 additions, 9 deletions
eck.features.inc
with
44 additions
and
9 deletions
eck.features.inc
+
44
−
9
View file @
6a9d2ce8
...
...
@@ -90,14 +90,46 @@ function eck_entity_type_features_rebuild($module) {
if
(
$default_entities
=
features_get_default
(
'eck_entity_type'
,
$module
))
{
foreach
(
$default_entities
as
$entity_type_name
=>
$entity_type_info
)
{
//dpm($entity_type_info, $entity_type_name);
$entity_type
=
new
EntityType
();
// db_delete('eck_entity_type')
// ->condition('name', $entity_type_name)
// ->execute();
// Load the existing entity type, if one exists.
$entity_type
=
EntityType
::
loadByName
(
$entity_type_name
);
if
(
empty
(
$entity_type
->
id
))
{
$entity_type
=
new
EntityType
();
}
// Look at all of the existing entities properties, and if one exists
// that does not exist in the code definition, delete it.
foreach
(
$entity_type
->
properties
as
$property_key
=>
$property
)
{
if
(
!
isset
(
$entity_type_info
[
'properties'
][
$property_key
]))
{
$entity_type
->
removeProperty
(
$property_key
);
}
}
// Look at all properties as defined in code, and add or change them
// Depending on wether they already exist or not.
foreach
(
$entity_type_info
as
$key
=>
$value
){
$entity_type
->
{
$key
}
=
$value
;
if
(
$key
==
'properties'
)
{
// loop through the new properties.
foreach
(
$entity_type_info
[
'properties'
]
as
$property_key
=>
$property
)
{
// If the property already exists, update the behavior.
if
(
isset
(
$entity_type
->
properties
[
$property_key
]))
{
$entity_type
->
changeBehavior
(
$property_key
,
$property
[
'behavior'
]);
}
else
{
// Property didn't already exist, so lets create it.
$entity_type
->
addProperty
(
$property_key
,
$property
[
'label'
],
$property
[
'type'
],
$property
[
'behavior'
]);
}
}
}
else
{
$entity_type
->
{
$key
}
=
$value
;
}
}
$entity_type
->
save
();
}
...
...
@@ -224,9 +256,12 @@ function eck_bundle_features_revert($module) {
function
eck_bundle_features_rebuild
(
$module
)
{
if
(
$default_types
=
features_get_default
(
'eck_bundle'
,
$module
))
{
foreach
(
$default_types
as
$bundle_machine_name
=>
$bundle_info
)
{
$bundle
=
new
Bundle
();
foreach
(
$bundle_info
as
$key
=>
$value
){
$bundle
=
Bundle
::
loadByMachineName
(
$bundle_machine_name
);
if
(
empty
(
$bundle
->
id
))
{
$bundle
=
new
Bundle
();
}
foreach
(
$bundle_info
as
$key
=>
$value
){
$bundle
->
{
$key
}
=
$value
;
}
$bundle
->
save
();
...
...
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