From d9230fc4c48e046b5711f3b8d6ea13f0038e56a5 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 5 Oct 2018 17:54:13 +0530 Subject: [PATCH] ENTITY FIXED --- api/application/config/constants.php | 4 ++-- .../controllers/Entity_Management_Controller.php | 6 +++++- api/application/libraries/AWS_S3.php | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 07b7aa36..4b497b08 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,8 +85,8 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code // define login route name for token verification -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors -//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllEntites/:any)'); // no errors +//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'saveNewEntity'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 23dee028..28018454 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -80,10 +80,14 @@ class Entity_Management_Controller extends REST_Controller { if($entity_id != '' || $entity_id != null) { - if($records['fk_entity_type_id'] == 2)// If New Entity is Lender(2) type, then create a S3 bucket for corresponding lender. + + // If New Entity is Lender(2) type, then create a S3 bucket for corresponding lender. + if($records['fk_entity_type_id'] == 2) { + //echo "LENDER TYPE"; $bucket_name = 'lender'.$entity_id; $bucket_status = $this->aws_s3->createNewBucket($bucket_name); + //print_r($bucket_status); } } diff --git a/api/application/libraries/AWS_S3.php b/api/application/libraries/AWS_S3.php index 2d99c22c..a1782895 100644 --- a/api/application/libraries/AWS_S3.php +++ b/api/application/libraries/AWS_S3.php @@ -44,13 +44,13 @@ class AWS_S3 { try { - $result = $this->S3->createBucket(['Bucket' => $BUCKET_NAME,'ACL' => 'authenticated-read']); + $result = $this->S3->createBucket(['ACL' => 'authenticated-read','Bucket' => $BUCKET_NAME]); - //print_r($result); + return $result; } catch (AwsException $e) { // output error message if fails - echo $e->getMessage(); - echo "\n"; + // echo $e->getMessage(); + // echo "\n"; } }