From 40be496bcd9eb35b205131df0698dc3173f57941 Mon Sep 17 00:00:00 2001
From: Owen Bush <ojb@ukhhf.co.uk>
Date: Wed, 27 Feb 2019 20:59:14 -0700
Subject: [PATCH] Minor changes to use more generic classes and fix issue with
 trying to use non-existent int plugin.

---
 recurring_events.yml                          |  5 --
 src/Entity/EventSeries.php                    | 13 ++---
 src/EventStorage.php                          | 54 ------------------
 src/EventStorageInterface.php                 | 55 -------------------
 .../Field/FieldType/MonthlyRecurringDate.php  |  2 +-
 5 files changed, 7 insertions(+), 122 deletions(-)
 delete mode 100644 recurring_events.yml
 delete mode 100644 src/EventStorage.php
 delete mode 100644 src/EventStorageInterface.php

diff --git a/recurring_events.yml b/recurring_events.yml
deleted file mode 100644
index 87ee2fbd..00000000
--- a/recurring_events.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-name: 'Recurring Events'
-type: module
-description: 'Events and Registration Management Module'
-core: 8.x
-package: 'recurring_events'
diff --git a/src/Entity/EventSeries.php b/src/Entity/EventSeries.php
index 1ce3e610..667abd10 100644
--- a/src/Entity/EventSeries.php
+++ b/src/Entity/EventSeries.php
@@ -72,17 +72,16 @@ use Drupal\user\UserInterface;
  *   id = "eventseries",
  *   label = @Translation("Event entity"),
  *   handlers = {
- *     "storage" = "Drupal\recurring_events\EventStorage",
+ *     "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage",
  *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
- *     "list_builder" = "Drupal\recurring_events\Entity\Controller\EventListBuilder",
  *     "views_data" = "Drupal\views\EntityViewsData",
  *     "form" = {
- *       "add" = "Drupal\recurring_events\Form\EventForm",
- *       "edit" = "Drupal\recurring_events\Form\EventForm",
- *       "delete" = "Drupal\recurring_events\Form\EventDeleteForm",
- *       "clone" = "Drupal\recurring_events\Form\EventCloneForm",
+ *       "add" = "Drupal\recurring_events\Form\EventSeriesForm",
+ *       "edit" = "Drupal\recurring_events\Form\EventSeriesForm",
+ *       "delete" = "Drupal\recurring_events\Form\EventSeriesDeleteForm",
+ *       "clone" = "Drupal\recurring_events\Form\EventSeriesCloneForm",
  *     },
- *     "access" = "Drupal\recurring_events\EventAccessControlHandler",
+ *     "access" = "Drupal\recurring_events\EventSeriesAccessControlHandler",
  *   },
  *   base_table = "eventseries",
  *   data_table = "eventseries_field_data",
diff --git a/src/EventStorage.php b/src/EventStorage.php
deleted file mode 100644
index 43a65d60..00000000
--- a/src/EventStorage.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-namespace Drupal\recurring_events;
-
-use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\Language\LanguageInterface;
-
-/**
- * Defines the storage handler class for events.
- *
- * This extends the base storage class, adding required special handling for
- * event entities.
- */
-class EventStorage extends SqlContentEntityStorage implements EventStorageInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function revisionIds(EventInterface $event) {
-    return $this->database->query(
-      'SELECT vid FROM {event_revision} WHERE id=:id ORDER BY vid',
-      [':id' => $event->id()]
-    )->fetchCol();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function userRevisionIds(AccountInterface $account) {
-    return $this->database->query(
-      'SELECT vid FROM {event_revision} WHERE user_id = :user_id ORDER BY vid',
-      [':user_id' => $account->id()]
-    )->fetchCol();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function countDefaultLanguageRevisions(EventInterface $event) {
-    return $this->database->query('SELECT COUNT(*) FROM {event_revision} WHERE id = :id', [':id' => $event->id()])->fetchField();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function clearRevisionsLanguage(LanguageInterface $language) {
-    return $this->database->update('event_revision')
-      ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED])
-      ->condition('langcode', $language->getId())
-      ->execute();
-  }
-
-}
diff --git a/src/EventStorageInterface.php b/src/EventStorageInterface.php
deleted file mode 100644
index b48e7d92..00000000
--- a/src/EventStorageInterface.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-namespace Drupal\recurring_events;
-
-use Drupal\Core\Entity\ContentEntityStorageInterface;
-use Drupal\Core\Language\LanguageInterface;
-use Drupal\Core\Session\AccountInterface;
-
-/**
- * Defines an interface for event entity storage classes.
- */
-interface EventStorageInterface extends ContentEntityStorageInterface {
-
-  /**
-   * Gets a list of event revision IDs for a specific event.
-   *
-   * @param \Drupal\recurring_events\EventInterface $event
-   *   The event entity.
-   *
-   * @return int[]
-   *   Event revision IDs (in ascending order).
-   */
-  public function revisionIds(EventInterface $event);
-
-  /**
-   * Gets a list of revision IDs having a given user as event author.
-   *
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   The user entity.
-   *
-   * @return int[]
-   *   Event revision IDs (in ascending order).
-   */
-  public function userRevisionIds(AccountInterface $account);
-
-  /**
-   * Counts the number of revisions in the default language.
-   *
-   * @param \Drupal\recurring_events\EventInterface $event
-   *   The event entity.
-   *
-   * @return int
-   *   The number of revisions in the default language.
-   */
-  public function countDefaultLanguageRevisions(EventInterface $event);
-
-  /**
-   * Unsets the language for all events with the given language.
-   *
-   * @param \Drupal\Core\Language\LanguageInterface $language
-   *   The language object.
-   */
-  public function clearRevisionsLanguage(LanguageInterface $language);
-
-}
diff --git a/src/Plugin/Field/FieldType/MonthlyRecurringDate.php b/src/Plugin/Field/FieldType/MonthlyRecurringDate.php
index 2900932b..a5935393 100644
--- a/src/Plugin/Field/FieldType/MonthlyRecurringDate.php
+++ b/src/Plugin/Field/FieldType/MonthlyRecurringDate.php
@@ -70,7 +70,7 @@ class MonthlyRecurringDate extends WeeklyRecurringDate {
       ->setLabel(t('Day Occurrence'))
       ->setDescription(t('Which occurence of the day(s) of the week should event take place'));
 
-    $properties['day_of_month'] = DataDefinition::create('int')
+    $properties['day_of_month'] = DataDefinition::create('integer')
       ->setLabel(t('Day of Month'))
       ->setDescription(t('The days of the month on which the event takes place'));
 
-- 
GitLab