This document provides an overview of the Migrate module in Drupal for importing content from external data sources. It discusses key concepts like sources, destinations, maps, and field mappings. Sources can include SQL, CSV, XML and JSON. Destinations are typically entities like nodes and users. Maps connect source IDs to destination IDs. Field mappings link source and destination fields. The document also covers migrations, field handlers, and the prepareRow(), prepare(), and complete() methods.
The migrate module provides a flexible framework for migrating content into Drupal from other sources (e.g., when converting a web site from another CMS to Drupal). Out-of-the-box, support for creating core Drupal objects such as nodes, users, files, terms, and comments are included - it can easily be extended for migrating other kinds of content. The power comes from an object oriented API that's tricky to get started with - We'll walk through the various classes in the module and how they work together to manage migrations.
I am currently looking for co-presenters or to present in a panel format as I feel we can all have something to learn from each other.
UPDATE July 21, 2012: Thank you to everyone that was able to come out to the session. I know it was a complex topic. As another resource, you can take a look at the code from the example I displayed today at https://bitbucket.org/btmash/redcat_new_migration. Obviously, the migration won't work (the db needs to exist) but the code should hopefully be helpful. Cheers!
itle: Glorp Tutorial
Speaker: Niall Ross
Mon, August 18, 2:00pm – 3:30pm
Video Part1: https://www.youtube.com/watch?v=cPN1A4WQyiA
Video Part2: https://www.youtube.com/watch?v=25S6cSYgh34
Abstract:
The target audience for this hands-on tutorial is those with little or no Glorp experience (but more experienced people willing to pair-program with beginners are most welcome). The tutorial will help them to start using in Glorp in their own applications.
Participants will create a simple Glorp descriptor system for a domain model. They will generate a database from it, incorporating some existing legacy. They will write and read between the database and their domain model using Glorp commands. The issues of transactions, caching and refreshing will be addressed.
DBIx-DataModel is an object-relational mapping framework for Perl5. Schema declarations are inspired from UML modelling. The API provides efficient interaction with the DBI layer, detailed control on statement execution steps, flexible and powerful treatment of database joins. More on http://search.cpan.org/dist/DBIx-DataModel.
Talk presented at YAPC::EU::2011 Riga (updated from a previous version presented at FPW2010).
Presentation I gave at the Berkeley Drupal Users Group on February 27, 2012 covering entities in Drupal 7 including entity types, bundles, fields, nodes, the Entity API and the Schema API. I use TextbookMadness.com as an example of how to leverage entities.
Click on my name to find a newer (better!) version of these slides.
The migrate module provides a flexible framework for migrating content into Drupal from other sources (e.g., when converting a web site from another CMS to Drupal). Out-of-the-box, support for creating core Drupal objects such as nodes, users, files, terms, and comments are included - it can easily be extended for migrating other kinds of content. The power comes from an object oriented API that's tricky to get started with - We'll walk through the various classes in the module and how they work together to manage migrations.
I am currently looking for co-presenters or to present in a panel format as I feel we can all have something to learn from each other.
UPDATE July 21, 2012: Thank you to everyone that was able to come out to the session. I know it was a complex topic. As another resource, you can take a look at the code from the example I displayed today at https://bitbucket.org/btmash/redcat_new_migration. Obviously, the migration won't work (the db needs to exist) but the code should hopefully be helpful. Cheers!
itle: Glorp Tutorial
Speaker: Niall Ross
Mon, August 18, 2:00pm – 3:30pm
Video Part1: https://www.youtube.com/watch?v=cPN1A4WQyiA
Video Part2: https://www.youtube.com/watch?v=25S6cSYgh34
Abstract:
The target audience for this hands-on tutorial is those with little or no Glorp experience (but more experienced people willing to pair-program with beginners are most welcome). The tutorial will help them to start using in Glorp in their own applications.
Participants will create a simple Glorp descriptor system for a domain model. They will generate a database from it, incorporating some existing legacy. They will write and read between the database and their domain model using Glorp commands. The issues of transactions, caching and refreshing will be addressed.
DBIx-DataModel is an object-relational mapping framework for Perl5. Schema declarations are inspired from UML modelling. The API provides efficient interaction with the DBI layer, detailed control on statement execution steps, flexible and powerful treatment of database joins. More on http://search.cpan.org/dist/DBIx-DataModel.
Talk presented at YAPC::EU::2011 Riga (updated from a previous version presented at FPW2010).
Presentation I gave at the Berkeley Drupal Users Group on February 27, 2012 covering entities in Drupal 7 including entity types, bundles, fields, nodes, the Entity API and the Schema API. I use TextbookMadness.com as an example of how to leverage entities.
Click on my name to find a newer (better!) version of these slides.
Patterns for slick database applicationsSkills Matter
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
Con la versione 7 di Drupal è stato introdotto il concetto di Entity, poi evoluto con la versione 8, utilizzato come base di buona parte degli elementi core (nodi, tassonomie, utenti, ...), ma - soprattutto - è stata data la possibilità di costruire entity custom. L'utilizzo di queste apre le possibilità di personalizzazione dello strumento ad un livello superiore velocizzando notevolmente lo sviluppo.
Verranno mostrate le potenzialità nell'uso delle Entity custom e le integrazioni possibili.
Drupal Entities - Emerging Patterns of UsageRonald Ashri
Entities are a powerful architectural approach and tool introduced in Drupal 7 - in this presentation I explain what they are and how they can be used with references to examples of how entities are used already.
Why async and functional programming in PHP7 suck and how to get overr it?Lucas Witold Adamus
This presentation describes basic issues related to functional programming with PHP and solution for most of problems served by the library called PhpSlang.
Discover some of bad practices in Scala and how to avoid them.
This talk is mainly about functionnal programming style but only with very simple concepts.
Django's ORM is extremely powerful, allowing you to manage your data without ever going near a line of SQL and hiding a multitude of complexities. But its power can sometimes be a curse rather than a blessing, multiplying queries without your knowledge and bringing your database to its knees.
In this session I explain what's going on behind the scenes and present some techniques to make your ORM use more efficient, showing how to monitor what's going on and how to better deal with relationships, indexes and more.
This talk was presented at Europython 2010 in Birmingham.
Type safe embedded domain-specific languagesArthur Xavier
Language is everything; it governs our lives: from our thought processes, our communication abilities and our understanding of the world, all the way up to law, politics, logic and programming. All of these domains of human experience are governed by different languages that talk to each other, and so should be your code. Haskell provides all the means necessary—and many more—to easily and safely use embedded small languages that are tailored to specific needs and business domains.
In this series of lectures and workshops, we will explore the whats, whys and hows of embedded domain-specific languages in Haskell, and how language oriented programing can bring type-safety, composability and simplicity to the development of complex applications.
Patterns for slick database applicationsSkills Matter
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
Con la versione 7 di Drupal è stato introdotto il concetto di Entity, poi evoluto con la versione 8, utilizzato come base di buona parte degli elementi core (nodi, tassonomie, utenti, ...), ma - soprattutto - è stata data la possibilità di costruire entity custom. L'utilizzo di queste apre le possibilità di personalizzazione dello strumento ad un livello superiore velocizzando notevolmente lo sviluppo.
Verranno mostrate le potenzialità nell'uso delle Entity custom e le integrazioni possibili.
Drupal Entities - Emerging Patterns of UsageRonald Ashri
Entities are a powerful architectural approach and tool introduced in Drupal 7 - in this presentation I explain what they are and how they can be used with references to examples of how entities are used already.
Why async and functional programming in PHP7 suck and how to get overr it?Lucas Witold Adamus
This presentation describes basic issues related to functional programming with PHP and solution for most of problems served by the library called PhpSlang.
Discover some of bad practices in Scala and how to avoid them.
This talk is mainly about functionnal programming style but only with very simple concepts.
Django's ORM is extremely powerful, allowing you to manage your data without ever going near a line of SQL and hiding a multitude of complexities. But its power can sometimes be a curse rather than a blessing, multiplying queries without your knowledge and bringing your database to its knees.
In this session I explain what's going on behind the scenes and present some techniques to make your ORM use more efficient, showing how to monitor what's going on and how to better deal with relationships, indexes and more.
This talk was presented at Europython 2010 in Birmingham.
Type safe embedded domain-specific languagesArthur Xavier
Language is everything; it governs our lives: from our thought processes, our communication abilities and our understanding of the world, all the way up to law, politics, logic and programming. All of these domains of human experience are governed by different languages that talk to each other, and so should be your code. Haskell provides all the means necessary—and many more—to easily and safely use embedded small languages that are tailored to specific needs and business domains.
In this series of lectures and workshops, we will explore the whats, whys and hows of embedded domain-specific languages in Haskell, and how language oriented programing can bring type-safety, composability and simplicity to the development of complex applications.
Features are very useful for building Drupal profiles (re-usable applications). They provide a way to capture and save in code the customizations that are done to a Drupal site/application. Here I will describe how I use them in B-Translator.
You\'ve decided to make the switch to Drupal. Fantastic! Only one problem: you have to figure out how to move your content from the old database to Drupal. Although there are many import/export modules available it\'s sometimes good to know what\'s happening behind the scenes. This session will walk you through my adventures of porting community Web sites into Drupal.
The talk will include:
* exporting usable data from your old site;
* using CCK to create the right home for your new content;
* using existing import modules (specifically: import html, node import and user import); and
* importing content \"by hand\" using MySQL command line magic.
We will also touch on some of the headaches I ran into in keeping data synchronized on very active community sites during the development phase.
This session is perfect for people who are preparing to migrate their Web site to Drupal and also people who are new to database management but want to know more about how things work behind the scenes. Of course if you\'re already a pro at data migration, please bring your stories and suggestions!
Data migration to Drupal using the migrate moduleLuc Bézier
Migration is the idea of moving data from A to B (and often, in the middle you transform this data).
This presentation focus on the use of Drupal Migrate module. I recommend to use Migrate module for a complex migration. When you have either a complex source or destination.
Migrate module is very flexible, powerful and well documented.
Summary :
- Introduction to data migration
- Understanding the migrate module
- Organise your Data migration with Migrate
- Migrate in Drupal 8
Presentation for Drupalcamp Kyoto, Japan, in April 2014.
Drupal 8 has made significant improvements towards the ability to stage configuration. But what about content staging? Has it gotten easier in Drupal 8?
This session is targeted towards site builders where we will continue to explore the content staging solution that is being built for Drupal 8 and that was initially presented in Austin. It's a solution that brings vast improvements to sites owners that need to stage or replicate content across sites.
Further, site builders will learn how this solution also applies to broader and sometimes more exciting use cases - content sharing and filtered replication across networks of sites and applications.
The recorded video is available here: https://amsterdam2014.drupal.org/session/content-staging-drupal-8-continued
Are you building a multilingual Drupal website and wondering how you're going to get everything translated? One of the major challenges of setting up a multilingual site is getting translations into Drupal, and keeping them up-to-date. Whether you're working with a team of translators or translating the site yourself, there are lots of tools and techniques that you can use to improve your translation workflow.
Easier building complex applications in Joomla! by adding a mapping layer between the domain model and the database. Some of this might be useful to improve Joomla!'s core.
While building custom Joomla!-extensions I often encountered difficulties implementing one-to-many and many-to-many relations.
Joomla! uses lists and items, where a list relates to a database table and an item to a record in that table. Because the underlying relational database is normalised, fields are atomic: contain only one value. In reality (in the domain) a person can have multiple addresses, an order can have multiple orderlines, a posting can have several comments, a product can have several images etc. Often, fields in our entities are not atomic, but can have collections of values. If we stay close to the one-to-one mapping of lists/items and database tables, as Joomla! natively does, it soon becomes messy when modelling more complex relationships. But if we use a mapping between the objects in our domain model and the database, we can easily use non-atomic fields. The same holds for inheritance mapping: a parent class and child classes can be mapped to a relational database in several ways. The Unified Content Model (UCM) is an example of class table inheritance mapping, where the superclass (core_content) has its own table, as do the subclasses. This opposed to the currently used concrete table inheritance, where every content-type maps to one table.
Fortunately this Object Relational Mapping has allready been extensively elaborated. No need to reinvent this wheel. In this presentation I'll show how I used Doctrine ORM for it. And I'll show how this could be used to improve Joomla!'s core.
Graph Databases in the Microsoft EcosystemMarco Parenzan
With SQL Server and Cosmos Db we now have graph databases broadly available, after being studied for decades in Db theory, or being a niche approach in Open Source with Neo4J. And then there are services like Microsoft Graph and Azure Digital Twins that give us vertical implementations of graph. So let's make a walkaround of graphs in the MIcrosoft ecosystem.
In this presentation, Vineet will be explaining case study of one of my customers using Spark to migrate terabytes of data from GPFS into Hive tables. The ETL pipeline was built purely using Spark. The pipeline extracted target (Hive) table properties such as - identification of Hive Date/Timestamp columns, whether target table is partitioned or non-partitioned, target storage formats (Parquet or Avro) and source to target columns mappings. These target tables contain few to hundreds of columns and non standard date fomats into Hive standard timestamp format.
Abstract –
Spark 2 is here, while Spark has been the leading cluster computation framework for severl years, its second version takes Spark to new heights. In this seminar, we will go over Spark internals and learn the new concepts of Spark 2 to create better scalable big data applications.
Target Audience
Architects, Java/Scala developers, Big Data engineers, team leaders
Prerequisites
Java/Scala knowledge and SQL knowledge
Contents:
- Spark internals
- Architecture
- RDD
- Shuffle explained
- Dataset API
- Spark SQL
- Spark Streaming
Code is not text! How graph technologies can help us to understand our code b...Andreas Dewes
Today, we almost exclusively think of code in software projects as a collection of text files. The tools that we use (version control systems, IDEs, code analyzers) also use text as the primary storage format for code. In fact, the belief that “code is text” is so deeply ingrained in our heads that we never question its validity or even become aware of the fact that there are other ways to look at code.
In my talk I will explain why treating code as text is a very bad idea which actively holds back our understanding and creates a range of problems in large software projects. I will then show how we can overcome (some of) these problems by treating and storing code as data, and more specifically as a graph. I will show specific examples of how we can use this approach to improve our understanding of large code bases, increase code quality and automate certain aspects of software development.
Finally, I will outline my personal vision of the future of programming, which is a future where we no longer primarily interact with code bases using simple text editors. I will also give some ideas on how we might get to that future.
Shift left testing for continuous collaborationZivtech, LLC
From DrupalCamp Baltimore 2018 - https://www.bmoredrupal.com/2018-baltimore-drupalcamp/sessions/shift-left-testing-continuous-collaboration
Testing has become an integral part of the Drupal development process, but it's frequently centered around technical aspects and is only implemented toward the end of the project.
Shift left testing is the process of moving the testing phase left of its usual position in the delivery pipeline so that it occurs as close as possible to the build process. By proactively testing integrations early and often, you can isolate most defects sooner for faster remediation, resulting in more efficient projects that are higher quality.
Continuous Collaboration is a software delivery approach in which organizations work seamlessly together across technical and non-technical departments. The approach aims to reduce the friction inherent in software development projects. It aligns an organization's decision making processes by allowing non-technical stakeholders and team members to contribute and give meaningful feedback on a day-to-day basis. As with CI and CD, CC also ensures that any changes or features that have reached the end of the process can be deployed.
In this session we will look at the history of the concepts of Kaizan, Kanban, and "shifting left", we will look at some of the tools which allow for Continuous Collaboration, such as Probo.ci, Pantheon Multidev, and Tugbot.qa.
DrupalCon San Francisco- The State of Drupal as a Web Application & Product ...Zivtech, LLC
This was a DrupalCon SF Session looking at Drupal shops building products via Drupal. Several of these folks have completely left their Drupal services behind and are now running product businesses (ex: MapBox & Pantheon, from Development Seed & Chapter Three).
Drupaldelphia 2014 - Mission Bicycle Case Study - Slides by Matt CheneyZivtech, LLC
Want to know how three Drupal influencers got together to build an awesome website? Start the journey with them here, in this opening slideshow. Stay tuned for the full case study!
Open Source isn't Just Good, it's Good Business - DrupalCamp Colorado 2014Zivtech, LLC
n the Drupal community we tend to talk about committing code to our public spaces (drupal.org, GitHub, etc.) in terms of "contributing" and "contributions", and while much of it can be seen in that altruistic light, there are actually very strong business reasons for publishing your code and/or attempting to get your code changes committed to the open source project that you are working on.
Some of the business reasons for public publishing we'll explore will include:
The power of peer review. With enough eyes, all bugs are shallow, and with only a few eyes the stupidity knows no depths!
Fork you! The costs associated with "hacking" both Drupal core and contrib modules and base themes.
Take my code, please! Cost savings from committing patches.
Professionals publish or perish. Using open source contributions as marketing and lead generation.
Developers are people, seriously. And like most people, they like recognition. Contributing to an open source project, and having their code used by a broad community, can be inspiring and motivating in a way that client work never can. In short, open source contributions help with recruiting and retention.
Integrating contributions into your client engagements.
This session will look at U.S. government and military documents that espouse the adoption of Drupal within the federal government and explore how Zivtech has used open source contributions as a cornerstone in growing their businesses. You will hopefully walk away convinced that open source isn’t just good, it’s good business.
https://2014.drupalcampcolorado.org/session/open-source-isnt-just-good-its-good-business
The business case for contributing codeZivtech, LLC
In the Drupal community we tend to talk about committing code to our public spaces (drupal.org, but also github) in terms of "contributing" and "contributions", and while much of it can be seen in that light, there are actually very strong business reasons for publishing your code and/or attempting to get your code changes committed to the open source project that you are working on.
We will be looking at several documents from the U.S. Military detailing their recommendations for contracting Open Source Software services, and will use those as a jumping off point to discuss the many benefits of contributing code. Some of the business reasons for public publishing we'll explore will include:
* The power of peer review. With enough eyes, all bugs are shallow, and with only a few eyes the stupidity knows no depths!
* Fork you! The costs associated with "hacking" both Drupal core and contrib modules and base themes.
* Take my code, please! Cost savings from committing patches.
* Professionals publish or perish. Using code commits as marketing towards clients or potential hires.
* It's so easy, even a child(ish person) could do it! How you can easily integrate patching into your development workflow.
This session will also include a walk through of how Zivtech handles code review, patches, and deployment processes and you will hopefully walk away convinced that all of your in-house and out-sourced developers should be publicly committing their work.
From a Contractor to a Shop: How to grow your Drupal business without losing ...Zivtech, LLC
These are slides from my DrupalCamp Austin session.
http://2011.drupalcampaustin.org/sessions/consultant-shop-how-grow-your-drupal-business-without-losing-your-hair-mind-or-bank
2. Migrate 2.0
• Powerful object oriented framework for
moving content into Drupal.
• Minimal UI, primarily code based.
• Steep learning curve (aka migraine
module) but hopefully this talk will help.
3. Migrate 2.0
• Drupal 6 requires autoload and dbtng
modules. So the code is very similar in 6
and 7.
• Migrate Extras provides support for many
contrib modules.
• The best documentation is in the wine.inc
and beer.inc example code.
4. Why not just use
Feeds?
• If it does what you need, use it. It’s much
easier to setup.
• Migrate is faster, and more flexible but
you need to write code to map fields.
• Feeds doesn’t work well if you’ve got
different content types that need to
reference each other.
5. The Concepts
• Source
• Destination
• Map
• Field Mapping
• Field Handlers
• Migration
6. Source
• Interface to your existing data (SQL, CSV,
XML, JSON)
• Provides a list of fields and descriptions
• Iterates (reset, next) over rows
7. Destination
• Interface for writing data to Drupal—
typically to a Entity.
• Creates one record for each record in the
source. If you’re creating users and
profiles, you’ll need two migrations.
8. Map
Source Destination
SQL, XML, JSON, CSV, etc Node, User, Term, etc
ID Name Age entity_id field_name field_age
1 Larry 34 32 Larry 34
2 Curly 54 33 Curly 54
4 Moe 47 34 Moe 47
Map
Source ID Dest ID
1 32
2 33
4 34
9. Map
• Connects the source’s ID to the
destination’s ID.
• Provides lookup facilities.
• Allows created items to be deleted as
part of a rollback.
10. Field Mappings
Source Destination
SQL, XML, JSON, CSV, etc Node, User, Term, etc
ID Name Age Junk entity_id field_name field_age
1 Larry 34 blah 32 Larry 34
2 Curly 54 33 Curly 54
4 Moe 47 Spam 34 Moe 47
Field Mappings
Source Destination
Name field_name
Age field_age
Junk NULL
11. Field Mappings
• Links a source field to a destination field.
• Lets you look up IDs from the other
migration’s maps with sourceMigration().
• If the destination has a complex structure
(e.g. Address or file field) then additional
data is passed in via arguments().
12. Migration
• Code that glues the parts together.
• In your constructor you setup: source,
destination, map and field mappings.
• Allows customization at several points:
prepareRow(), prepare(), complete().
13. Field Handlers
• Handles the details of converting the field
into the structure that Drupal
understands.
• Turns $entity->field_bar = “foo” into
$entity->field_bar[‘und’][0][‘value’] = “foo”
• Might pull additional data out of
arguments.
14. Destination Handler
• Provides additional functionality to a
destination, e.g. comment adding a field
to nodes for comment status.
• Destination delegates calls to fields(),
prepare(), complete() to the destination
handlers.
• You probably won’t need to write one.
16. Drush Commands
• migrate-status (ms) - List all migrations and
display their current status.
• migrate-import (mi) - Start a migration and
create/update destination objects.
• migrate-reset-status (mrs) - Reset a migration.
• migrate-rollback (mr) - Delete a migration’s
destination objects.
17. Basic Module
• Create a new module
• Implement hook_migrate_api()
• Create a class that extends Migration and
setup the source, destination, map and
field mappings in the constructor
• Register the class in the .info file
19. Or a CSV Source
// The definition of the columns. Keys are integers,
// values are an array of field name then description.
$columns = array(
0 => array('cvs_uid', 'Id'),
1 => array('email', 'Email'),
2 => array('name', 'Name'),
3 => array('date', 'Date'),
);
// Instantiate the class using the path to the CSV
// file and the columns.
$path = 'path/relative/to/drupal/root/your_file.csv';
$this->source = new MigrateSourceCSV($path, $columns);
20. Other Sources
• There are also classes for importing
content from XML and JSON.
• Lots of variation among sources so expect
to do some tweaking.
21. Source Base Classes
• If you can fetch IDs separately from values:
• Use MigrateSourceList as a source
• Implement MigrateList for fetching counts and
IDs, and MigrateItem for fetching values
• If everything is in a single file with IDs mixed in:
• Use MigrateSourceMultiItems as a source
• Implement MigrateItems for extracting IDs and
values
23. Destinations
// inside __construct()
// Create terms...
$this->destination = new
MigrateDestinationTerm('example_beer_styles');
// ...or nodes...
$this->destination = new
MigrateDestinationNode('article');
// ...or
$this->destination = new
MigrateDestinationUser();
24. Creating Destinations
• Hopefully you won’t need to.
• If you’re working with entities created by
the Entity API make sure you look at:
http://drupal.org/node/1168196
25. Field Mappings
// inside __construct()
// Can be as simple as this...
$this->addFieldMapping('name', 'style');
// ...or more complicated.
$this->addFieldMapping(NULL, 'region')
->description('This is broken')
->issueGroup(t('Client Issues'))
->issuePriority(
MigrateFieldMapping::ISSUE_PRIORITY_MEDIUM)
->issueNumber(770064);
26. Field Mapping
Arguments
• Generally used as a hack to pass multiple
source fields into a single destination
field.
• Use this magic syntax to have arguments
replaced by values from the source row:
$this->addFieldMapping('D', 'S1')->arguments(
array('A1' => array('source_field' => 'S2')),
array('A2' => array('source_field' => 'S3'))
);
27. Field Mapping
Arguments
// Files have so many arguments there’s a helper
// to build the array:
$arguments = MigrateFileFieldHandler::arguments(
drupal_get_path('module', 'migrate_example'),
'file_copy', FILE_EXISTS_RENAME, NULL,
array('source_field' => 'image_alt'),
array('source_field' => 'image_description'));
$this->addFieldMapping('field_image', 'image')
->arguments($arguments);
28. Field Mapping
Source Migrations
• When you have an ID value from the old
system and need to look up the new ID
from the Migration Map:
$this->addFieldMapping('uid', 'author_id')
->sourceMigration('BeerUser')
• Add a dependency to make sure the
other migration runs first:
$this->dependencies = array('BeerUser');
•
29. Circular
Dependencies
• Break them by using stubs.
• Implement createStub($migration), create
a dummy record and return the new id.
• Specify a sourceMigration on the field
mapping.
30. prepareRow($row)
• Passes in the source row as an object so
you can make modifications.
• Add or change field values by modifying
the properties:
$row->name = $row->first . “ ” . $row->last;
$row->created = strtotime($row->access);
• Return FALSE to indicate that rows
should be skipped over during an import.
31. prepare($entity, $row)
• Passes in the entity object with properties
populated by field mappings, and the
source row.
• Last chance to make changes before the
entity is saved.
• If you have an unsupported field type you
can manually populate it here:
32. complete($ent, $row)
• Passes in the saved entity (with any ID
values from auto increment fields) and
the source row.
• This is the place if you need to update
other records to reference the new entity.
• If you’re doing a node_save($ent) in here,
you’re doing it wrong.
33. Writing a Field
Handler
• Hopefully you won’t need to.
• Register compatible field type in
constructor.
• Handle conversion in prepare().
• Optionally, use complete() for follow
tasks.