Skip to content

Instantly share code, notes, and snippets.

diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index 0488d96..77e0c6b 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -317,7 +317,7 @@ public function rollback() {
// Loop through each row in the map, and try to roll it back.
foreach ($id_map as $map_row) {
- $destination_key = $id_map->currentDestination();
+ $destination_key = array_filter($id_map->currentDestination());
$query = $this->database->select('node_field_data', 'n');
$query->addField('n', 'nid', 'id');
$query->addField('n', 'title', 'organisation_name');
$query->addField('n', 'created');
$query->leftJoin('node__field_postal_address', 'pa', 'n.nid = pa.entity_id');
$query->leftJoin('location', 'l', 'l.id = pa.field_postal_address_target_id');
$query->fields('l', [
'name',
'address',
@welly
welly / gist:1f0748d03e2d7d973e6b30a74a200db2
Created April 21, 2016 01:00
Drush sql sync remote to remote
drush @source sql-dump | drush @destination sql-cli
public function validate($item, Constraint $constraint) {
if ($item->isEmpty()) {
return NULL;
}
$entity = $item->getEntity();
$entity_id = $entity->id();
$entity_type = $entity->getEntityType();
$field_name = $item->getFieldDefinition()->getName();
@welly
welly / xdebug.ini
Created January 3, 2016 22:25 — forked from larowlan/xdebug.ini
vagrant@d8:~$ cat /etc/php5/conf.d/20-xdebug.ini
xdebug.max_nesting_level=200 ; Fixes debugging for D8.
xdebug.remote_host=10.0.2.2
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.auto_start=true
zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so
@welly
welly / osx-elcapitan.sh
Created November 11, 2015 07:10
OS X El Capitan setup
#!/bin/sh
# Command Line Tools
xcode-select --install
# Sudo
sudo -v
while true; do sudo -n true; sleep 60; kill -0 $$ || exit; done 2>/dev/null &
# Homebrew
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}
<?php
$adam = array(
'remote-host' => 'adammalone.net',
'root' => '/var/www/html/adammalone/docroot',
'uri' => 'adammalone.net',
'strict' => 0,
'path-aliases' => array(
'%dump-dir' => '/home/adammalone/.drush/dumps',
'%files' => 'sites/default/files',
@welly
welly / node--services--full.tpl.php
Created May 19, 2015 03:51
looping field collection
$collections = array();
$field_collection_fields = field_get_items('node', $node, 'field_services');
$ids = array();
// Extract the field collection item ids
$ids = array();
foreach ($field_collection_fields as $fc_field) {
$ids[] = $fc_field['value'];
}
@welly
welly / demo.module
Last active August 29, 2015 14:18 — forked from pascalduez/demo.module
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/