Skip to content
Snippets Groups Projects
Commit 27ff302b authored by baldwinlouie's avatar baldwinlouie
Browse files

Issue #2948174 by baldwinlouie: [Porting to D8] - All AWS Entities throw...

Issue #2948174 by baldwinlouie: [Porting to D8] - All AWS Entities throw MissingMandatoryParametersException for cloud_context
parent 61b8c4be
No related branches found
No related tags found
No related merge requests found
Showing
with 119 additions and 281 deletions
......@@ -44,6 +44,7 @@ function cloud_schema() {
'cloud_name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
'cloud_id' => array(
'type' => 'int' ,
......
<?php
<?php
/**
* @file
......@@ -12,17 +12,19 @@ module_load_include('inc', 'cloud' , 'cloud.constants' );
module_load_include('inc', 'cloud_alert', 'cloud_alert.constants');
/**
* Implements hook_install(). ().
* Implements hook_install().
().
*/
function cloud_alert_install() {
// Create tables .
// Create tables .
}
/**
* Implements hook_uninstall(). ().
* Implements hook_uninstall().
().
*/
function cloud_alert_uninstall() {
// Remove tables .
// Remove tables .
}
/**
......@@ -43,6 +45,7 @@ function cloud_alert_schema() {
'alert_id' => array(
'type' => 'serial' ,
'length' => 11,
'not null' => TRUE,
),
'name' => array(
'type' => 'varchar',
......@@ -118,7 +121,7 @@ function cloud_alert_schema() {
'primary key' => array('alert_id'),
);
///To add more schema just add one more $schema['newtable'] array .
///To add more schema just add one more $schema['newtable'] array .
return $schema;
}
\ No newline at end of file
......@@ -151,6 +151,7 @@ entity.cloud_context.delete_form:
#####################
# MENU_CALLBACK
# comment out for now
entity.aws_cloud_instance.canonical:
path: '/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}'
defaults:
......@@ -158,9 +159,9 @@ entity.aws_cloud_instance.canonical:
_title: 'AWS Cloud Instance'
requirements:
_permission: 'view aws cloud instance'
aws_cloud_instance: \d+
entity.aws_cloud_instance.collection:
# path: '/clouds/aws_cloud/{cloud_context}/instance'
path: '/clouds/aws_cloud/{cloud_context}/instance'
defaults:
_entity_list: 'aws_cloud_instance'
......@@ -192,6 +193,7 @@ entity.aws_cloud_instance.edit_form.edit:
requirements:
_permission: 'edit aws cloud instance'
entity.aws_cloud_instance.delete_form:
path: '/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}/terminate'
defaults:
......@@ -201,10 +203,10 @@ entity.aws_cloud_instance.delete_form:
_permission: 'delete aws cloud instance'
##################
# AWS Cloud Images
##################
entity.aws_cloud_image.canonical:
path: '/clouds/aws_cloud/{cloud_context}/image/{aws_cloud_image}'
defaults:
......@@ -429,6 +431,12 @@ entity.aws_cloud_key_pair.canonical:
requirements:
_entity_access: 'aws_cloud_key_pair.view'
_permission: 'view aws cloud key pair'
options:
parameters:
cloud_context:
type: "entity:cloud_context"
aws_cloud_key_pair:
type: "entity:aws_cloud_key_pair"
entity.aws_cloud_key_pair.collection:
path: '/clouds/aws_cloud/{cloud_context}/key_pair'
......@@ -447,7 +455,7 @@ entity.aws_cloud_key_pair.add_form:
_permission: 'add aws cloud key pair'
entity.aws_cloud_key_pair.edit_form:
path: '/clouds/aws_cloud/{cloud_context}/key_pair/{aws_cloud_key_pair}/edit'
path: '/clouds/aws_cloud/{cloud_context}/key_pair/{aws_cloud_key_pair}'
defaults:
_entity_form: 'aws_cloud_key_pair.edit'
_title: 'Edit AWS Cloud Key Pair'
......@@ -577,3 +585,6 @@ entity.aws_cloud_snapshot.delete_form:
_title: 'Delete AWS Cloud Snapshot'
requirements:
_permission: 'delete aws cloud snapshot'
#
#route_callbacks:
# - '\Drupal\aws_cloud\Routing\AwsCloudRoutes::routes'
......@@ -110,8 +110,4 @@ interface ElasticIpInterface extends ContentEntityInterface, EntityOwnerInterfac
*/
public function setRefreshed($time);
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context);
}
......@@ -34,7 +34,6 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface;
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\ElasticIpListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\ElasticIpViewsData" ,
*
* "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\ElasticIpEditForm" ,
* "add" = "Drupal\aws_cloud\Form\Ec2\ElasticIpCreateForm",
......@@ -52,32 +51,15 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_elastic_ip.canonical" ,
* "edit-form" = "/entity.aws_cloud_elastic_ip.edit_form" ,
* "delete-form" = "/entity.aws_cloud_elastic_ip.delete_form",
* "collection" = "/entity.aws_cloud_elastic_ip.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/elastic_ip/{aws_cloud_elastic_ip}" ,
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/elastic_ip/{aws_cloud_elastic_ip}/edit" ,
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/elastic_ip/{aws_cloud_elastic_ip}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/elastic_ip"
* },
* field_ui_base_route = "aws_cloud_elastic_ip.settings"
* )
*/
class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
class ElasticIp extends EC2ContentEntityBase implements ElasticIpInterface {
/**
* {@inheritdoc}
......@@ -191,14 +173,6 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
return $this->get('user_id')->entity;
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
$this->set('cloud_context', $cloud_context);
return $this;
}
/**
* {@inheritdoc}
*/
......
......@@ -35,7 +35,6 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface;
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\ImageListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\ImageViewsData" ,
*
* "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\ImageEditForm" ,
* "add" = "Drupal\aws_cloud\Form\Ec2\ImageCreateForm",
......@@ -61,17 +60,7 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface;
* field_ui_base_route = "aws_cloud_image.settings"
* )
*/
class Image extends ContentEntityBase implements ImageInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
class Image extends EC2ContentEntityBase implements ImageInterface {
/**
* {@inheritdoc}
......@@ -248,13 +237,6 @@ class Image extends ContentEntityBase implements ImageInterface {
return $this->set('refreshed', $time);
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -19,8 +19,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\InstanceInterface;
......@@ -55,25 +53,15 @@ use Drupal\aws_cloud\Aws\Ec2\InstanceInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_instance.canonical" ,
* "edit-form" = "/entity.aws_cloud_instance.edit_form" ,
* "delete-form" = "/entity.aws_cloud_instance.delete_form",
* "collection" = "/entity.aws_cloud_instance.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}",
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}/edit",
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}/terminate",
* "collection" = "/clouds/aws_cloud/{cloud_context}/instance",
* },
* field_ui_base_route = "aws_cloud_instance.settings"
* )
*/
class Instance extends ContentEntityBase implements InstanceInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
class Instance extends EC2ContentEntityBase implements InstanceInterface {
/**
* {@inheritdoc}
......@@ -93,13 +81,6 @@ class Instance extends ContentEntityBase implements InstanceInterface {
$this->set('user_data' , $form['user_data']['#value']);
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......@@ -513,13 +494,6 @@ class Instance extends ContentEntityBase implements InstanceInterface {
return $this->set('refreshed', $time);
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -15,8 +15,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\KeyPairInterface;
......@@ -33,7 +31,6 @@ use Drupal\aws_cloud\Aws\Ec2\KeyPairInterface;
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\KeyPairListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\KeyPairViewsData" ,
*
* "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\KeyPairEditForm" ,
* "add" = "Drupal\aws_cloud\Form\Ec2\KeyPairCreateForm",
......@@ -51,32 +48,15 @@ use Drupal\aws_cloud\Aws\Ec2\KeyPairInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_key_pair.canonical" ,
* "edit-form" = "/entity.aws_cloud_key_pair.edit_form" ,
* "delete-form" = "/entity.aws_cloud_key_pair.delete_form",
* "collection" = "/entity.aws_cloud_key_pair.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/key_pair/{aws_cloud_key_pair}" ,
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/key_pair/{aws_cloud_key_pair}" ,
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/key_pair/{aws_cloud_key_pair}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/key_pair"
* },
* field_ui_base_route = "aws_cloud_key_pair.settings"
* )
*/
class KeyPair extends ContentEntityBase implements KeyPairInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
class KeyPair extends EC2ContentEntityBase implements KeyPairInterface {
/**
* {@inheritdoc}
......@@ -105,6 +85,7 @@ class KeyPair extends ContentEntityBase implements KeyPairInterface {
public function key_material() {
return $this->get('key_material')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -17,8 +17,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\NetworkInterfaceInterface;
......@@ -35,7 +33,6 @@ use Drupal\aws_cloud\Aws\Ec2\NetworkInterfaceInterface;
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\NetworkInterfaceListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\NetworkInterfaceViewsData" ,
*
* "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\NetworkInterfaceEditForm" ,
* "add" = "Drupal\aws_cloud\Form\Ec2\NetworkInterfaceCreateForm",
......@@ -53,25 +50,15 @@ use Drupal\aws_cloud\Aws\Ec2\NetworkInterfaceInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_network_interface.canonical",
* "edit-form" = "/entity.aws_cloud_network_interface.edit_form",
* "delete-form" = "/entity.aws_cloud_network_interface.delete_form",
* "collection" = "/entity.aws_cloud_network_interface.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/network_interface/{aws_cloud_network_interface}",
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/network_interface/{aws_cloud_network_interface}/edit",
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/network_interface/{aws_cloud_network_interface}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/network_interface"
* },
* field_ui_base_route = "aws_cloud_network_interface.settings"
* )
*/
class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
class NetworkInterface extends EC2ContentEntityBase implements NetworkInterfaceInterface {
/**
* {@inheritdoc}
......@@ -255,13 +242,6 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
return $this->get('allocation_id')->value;
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......@@ -312,13 +292,6 @@ class NetworkInterface extends ContentEntityBase implements NetworkInterfaceInte
return $this->get('refreshed')->value;
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -16,8 +16,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\SecurityGroupInterface;
......@@ -34,7 +32,6 @@ use Drupal\aws_cloud\Aws\Ec2\SecurityGroupInterface;
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\SecurityGroupListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\SecurityGroupViewsData" ,
*
* "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\SecurityGroupEditForm" ,
* "add" = "Drupal\aws_cloud\Form\Ec2\SecurityGroupCreateForm",
......@@ -52,32 +49,15 @@ use Drupal\aws_cloud\Aws\Ec2\SecurityGroupInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_security_group.canonical" ,
* "edit-form" = "/entity.aws_cloud_security_group.edit_form" ,
* "delete-form" = "/entity.aws_cloud_security_group.delete_form",
* "collection" = "/entity.aws_cloud_security_group.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/security_group/{aws_cloud_security_group}" ,
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/security_group/{aws_cloud_security_group}/edit" ,
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/security_group/{aws_cloud_security_group}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/security_group"
* },
* field_ui_base_route = "aws_cloud_security_group.settings"
* )
*/
class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
class SecurityGroup extends EC2ContentEntityBase implements SecurityGroupInterface {
/**
* {@inheritdoc}
......@@ -156,13 +136,6 @@ class SecurityGroup extends ContentEntityBase implements SecurityGroupInterface
return $this->set('refreshed', $time);
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -17,8 +17,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\SnapshotInterface;
......@@ -53,32 +51,15 @@ use Drupal\aws_cloud\Aws\Ec2\SnapshotInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_snapshot.canonical" ,
* "edit-form" = "/entity.aws_cloud_snapshot.edit_form" ,
* "delete-form" = "/entity.aws_cloud_snapshot.delete_form",
* "collection" = "/entity.aws_cloud_snapshot.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/snapshot/{aws_cloud_snapshot}" ,
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/snapshot/{aws_cloud_snapshot}/edit" ,
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/snapshot/{aws_cloud_snapshot}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/snapshot"
* },
* field_ui_base_route = "aws_cloud.snapshot.settings"
* )
*/
class Snapshot extends ContentEntityBase implements SnapshotInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
class Snapshot extends EC2ContentEntityBase implements SnapshotInterface {
/**
* {@inheritdoc}
......@@ -227,13 +208,6 @@ class Snapshot extends ContentEntityBase implements SnapshotInterface {
return $this->set('refreshed', $time);
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
......@@ -18,8 +18,6 @@
namespace Drupal\aws_cloud\Entity\Ec2;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\aws_cloud\Aws\Ec2\VolumeInterface;
......@@ -54,32 +52,15 @@ use Drupal\aws_cloud\Aws\Ec2\VolumeInterface;
* "uuid" = "uuid"
* },
* links = {
* "canonical" = "/entity.aws_cloud_volume.canonical" ,
* "edit-form" = "/entity.aws_cloud_volume.edit_form" ,
* "delete-form" = "/entity.aws_cloud_volume.delete_form",
* "collection" = "/entity.aws_cloud_volume.collection"
* "canonical" = "/clouds/aws_cloud/{cloud_context}/volume/{aws_cloud_volume}" ,
* "edit-form" = "/clouds/aws_cloud/{cloud_context}/volume/{aws_cloud_volume}/edit" ,
* "delete-form" = "/clouds/aws_cloud/{cloud_context}/volume/{aws_cloud_volume}/delete",
* "collection" = "/clouds/aws_cloud/{cloud_context}/volume"
* },
* field_ui_base_route = "aws_cloud_volume.settings"
* )
*/
class Volume extends ContentEntityBase implements VolumeInterface {
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function cloud_context() {
return $this->get('cloud_context')->value;
}
class Volume extends EC2ContentEntityBase implements VolumeInterface {
/**
* {@inheritdoc}
......@@ -235,13 +216,6 @@ class Volume extends ContentEntityBase implements VolumeInterface {
return $this->set('refreshed', $time);
}
/**
* {@inheritdoc}
*/
public function setCloudContext($cloud_context) {
return $this->get('cloud_context')->value;
}
/**
* {@inheritdoc}
*/
......
<?php
// Created by yas 2016/06/21.
/**
......@@ -21,50 +22,71 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class AwsCloudRoutes {
/**
* This function and the next are part of the dependency injection pattern.
*/
public function __construct(QueryFactory $entity_query) {
$this->entity_query = $entity_query;
$this->now = (new \DateTime())->getTimestamp();
}
/**
* Dependency Injection.
*/
public static function create(ContainerInterface $container) {
return new static(
// User the $container to get a query factory object.
// This object let us create query objects.
$container->get('entity.query')
);
}
// /**
// * This function and the next are part of the dependency injection pattern.
// */
// public function __construct(QueryFactory $entity_query) {
// $this->entity_query = $entity_query;
// $this->now = (new \DateTime())->getTimestamp();
// }
/**
* {@inheritdoc}
*/
public function routes() extends ControllerBase {
// /**
// * Dependency Injection.
// */
// public static function create(ContainerInterface $container) {
// return new static(
// // User the $container to get a query factory object.
// // This object let us create query objects.
// $container->get('entity.query')
// );
// }
//
// /**
// * {@inheritdoc}
// */
// public function routes() extends ControllerBase {
//
// $cloud_contexts = $this->entity_query->get('cloud_context')
// ->execute();
//var_dump($cloud_contexts);
//exit;
// $routes = array();
// // Declares a single route under the name 'example.content'.
// // Returns an array of Route objects.
// $routes['entity.aws_cloud_instance.collection' . '.aaaa'] = new Route(
// // Path to attach this route to:
// '/clouds/aws_cloud/{cloud_context}/instance',
// // Route defaults:
// array(
// '_entity_list' => 'aws_cloud_instance'',
// '_title' => 'AWS Cloud Instance'
// ),
// // Route requirements:
// array(
// '_permission' => 'list aws cloud instance',
// )
// );
// return $routes;
// }
$cloud_contexts = $this->entity_query->get('cloud_context')
->execute();
var_dump($cloud_contexts);
exit;
/**
* {@inheritdoc}
*/
public function routes() {
$routes = array();
// Declares a single route under the name 'example.content'.
// Returns an array of Route objects.
$routes['entity.aws_cloud_instance.collection' . '.aaaa'] = new Route(
// Path to attach this route to:
'/clouds/aws_cloud/{cloud_context}/instance',
// Route defaults:
// testing
$routes['entity.aws_cloud_instance.canonical'] = new Route(
'/clouds/aws_cloud/aws_us_west_1/instance/{aws_cloud_instance}',
array(
'_entity_list' => 'aws_cloud_instance'',
'_title' => 'AWS Cloud Instance'
'_entity_view' => 'aws_cloud_instance',
'_title' => 'AWS Cloud Instance',
),
// Route requirements:
array(
'_permission' => 'list aws cloud instance',
'_permission' => 'view aws cloud instance',
)
);
return $routes;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment