Skip to content

Instantly share code, notes, and snippets.

View nikunjkotecha's full-sized avatar

Nikunj Kotecha nikunjkotecha

View GitHub Profile
@nikunjkotecha
nikunjkotecha / MigrateAsymmetricToSymmetric.php
Created November 22, 2018 13:34
Code to migrate content from Asymmetric to Symmetric translations for paragraphs.
<?php
namespace Drupal\module\Helper;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\paragraphs\Entity\Paragraph;
/**
<?php
/** ====================================================================== */
// Create table if not available.
db_query("CREATE TABLE IF NOT EXISTS {lock_test} (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
random_id int,
request_time varchar(50),
first_request_time varchar(50)
function blt() {
if [[ ! -z ${AH_SITE_ENVIRONMENT} ]]; then
PROJECT_ROOT="/var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}"
elif [ "`git rev-parse --show-cdup 2> /dev/null`" != "" ]; then
PROJECT_ROOT=$(git rev-parse --show-cdup)
else
PROJECT_ROOT="."
fi
if [ -f "$PROJECT_ROOT/vendor/bin/blt" ]; then