Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
C
climbnz.org.nz
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
J Hunt
climbnz.org.nz
Commits
d41ee7de
Commit
d41ee7de
authored
Jul 05, 2017
by
Jonathan Hunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#8
Map to migrate Pitches when migrating a Route.
parent
c00083fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
sites/all/modules/custom/migrate_climbnz/migrate_climbnz.node.route.inc
...les/custom/migrate_climbnz/migrate_climbnz.node.route.inc
+15
-0
No files found.
sites/all/modules/custom/migrate_climbnz/migrate_climbnz.node.route.inc
View file @
d41ee7de
...
...
@@ -41,6 +41,14 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
$this
->
addFieldMapping
(
'field_ascent'
,
'field_ascent'
);
$this
->
addFieldMapping
(
'field_attribution'
,
'field_attribution'
);
$this
->
addFieldMapping
(
'field_pitches'
,
'field_pitch'
)
->
sourceMigration
(
'Pitch'
);
}
public
function
getPitchByTitle
(
$title
)
{
$result
=
db_query
(
"SELECT nid FROM
{
node
}
WHERE title=:title"
,
array
(
':title'
=>
$title
))
->
fetchField
();
return
$result
;
}
public
function
prepareRow
(
$row
)
{
...
...
@@ -50,5 +58,12 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
return
FALSE
;
}
// Map to child pitches via compound key of route nid and pitch field delta.
// A callback for field_pitches is too late, due to migrate sourceMigration magic.
if
(
count
(
$row
->
field_pitch
))
{
foreach
(
$row
->
field_pitch
as
$key
=>
$bogus
)
{
$row
->
field_pitch
[
$key
]
=
array
(
'nid'
=>
$row
->
nid
,
'delta'
=>
$key
);
}
}
}
}
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