Skip to content

Instantly share code, notes, and snippets.

View steveoliver's full-sized avatar

Steve Oliver steveoliver

View GitHub Profile
@steveoliver
steveoliver / composer.json
Created January 30, 2016 00:01
Getting Drupal 8 project to build from composer.json instead of project.make.yml file
{
"name": "my/project",
"description": "My platform.sh Drupal 8 / Composer project",
"type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "",
"role": ""
}
@steveoliver
steveoliver / observations.md
Last active July 18, 2016 19:33
Field Collection database/uuid issue(s) (nested field collections), Drupal 8

database observations

  • field_collection_item__field_CHILDCOLLECTION_X tables exist for all child field collections EXCEPT the one without the UUID
  • field_collection_item__668c612c1b table exists for the child field collection under consideration (will call it field_CHILDCOLLECTION_Y). ... It has the same structure as the other tables with valid data for field instances.

configuration

  • field_collection config item 'field_CHILDCOLLECTION_Y' has null uuid value.

drupal behaviour

  • DELETE field_CHILDCOLLECTION_X1: OK.
  • DELETE field_CHILDCOLLECTION_X2: OK.
@steveoliver
steveoliver / Onsite.php
Created September 29, 2016 15:20
Drupal Commerce 2.x Onsite payment gateway token register method
<?php
// Drupal Commerce 2.x Onsite payment method
// ...
/**
* {@inheritdoc}
*/
public function createPaymentMethod(PaymentMethodInterface $payment_method, array $payment_details) {
$required_keys = [
@steveoliver
steveoliver / composer--bad-patch.json
Last active May 25, 2017 02:21
drupal commerce composer patched project cannot composer install
{
"name": "drupalcommerce/project-base",
"description": "Commerce 2.x project template",
"type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "",
"role": ""
}
@steveoliver
steveoliver / tablesizes.sql
Created July 25, 2017 00:16
get db table sizes
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "DB_NAME"
ORDER BY (data_length + index_length) DESC;
@steveoliver
steveoliver / CartManagerTest.php
Last active March 7, 2018 16:29
Testing an event subscriber
<?php
namespace Drupal\Tests\commerce_cart\Kernel;
use Drupal\commerce_order\Entity\OrderItem;
use Drupal\commerce_price\Price;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_product\Entity\ProductVariation;
use Drupal\Tests\commerce\Kernel\CommerceKernelTestBase;