How to access vendor classes in CakePHP 3

2014-08-18 Thread Jipson Thomas
Hi,
Would you please tell me how we can access some 3rdpart vendor classes (Not 
developed in a CakePHP platform) in our controller functions. For example, 
in my cakePHP 3 website I need to integrate mandrill API and Authorize.net 
API, I installed both through the compose of cakephp and both are 
downloaded to my vendors folder.When I am trying to create their objects in 
our controller action, I am getting fatal error as Class 
'App\Controller\AuthorizeNet_
Subscription' not found. I couldn't find any thing related to this on 
cakephp documentation also. Would you please help me to solve this issue? I 
had another post with this details, but that is not replied.

Thanks and Regards,
Jipson


https://groups.google.com/forum/#!searchin/cake-php/authorize.net/cake-php/p5XbQfJGrWg/ZTBd5b1LCUcJ

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to access vendor classes in CakePHP 3

2014-08-18 Thread Thomas von Hassel
can you post the code where you instantiate the class ?


On 18 Aug 2014, at 11:42, Jipson Thomas jip...@strategic-ic.co.uk wrote:

 Hi,
 Would you please tell me how we can access some 3rdpart vendor classes (Not 
 developed in a CakePHP platform) in our controller functions. For example, in 
 my cakePHP 3 website I need to integrate mandrill API and Authorize.net API, 
 I installed both through the compose of cakephp and both are downloaded to my 
 vendors folder.When I am trying to create their objects in our controller 
 action, I am getting fatal error as Class 'App\Controller\AuthorizeNet_
 Subscription' not found. I couldn't find any thing related to this on cakephp 
 documentation also. Would you please help me to solve this issue? I had 
 another post with this details, but that is not replied.
 
 Thanks and Regards,
 Jipson
 
 
 https://groups.google.com/forum/#!searchin/cake-php/authorize.net/cake-php/p5XbQfJGrWg/ZTBd5b1LCUcJ
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to access vendor classes in CakePHP 3

2014-08-18 Thread Jipson Thomas
Hi Thomas,
Thank you for your update. MY code is as follows.

The Controller function I used is

namespace App\Controller;
use App\Controller\AppController;
use Authorizenet\AuthorizeNetARB;
use Cake\ORM\TableRegistry;
use Cake\Event\Event;
use Cake\Network\Email\Email;

public function authtest(){
define(AUTHORIZENET_API_LOGIN_ID, LOGIN);
define(AUTHORIZENET_TRANSACTION_KEY, KEY);
$subscription  = new AuthorizeNet_Subscription;
$subscription-name= PHP Monthly Magazine;
$subscription-intervalLength  = 1;
$subscription-intervalUnit= months;
$subscription-startDate   = 2014-08-14;
$subscription-totalOccurrences= 12;
$subscription-amount  = 12.99;
$subscription-creditCardCardNumber= 60110012;
$subscription-creditCardExpirationDate= 2018-10;
$subscription-creditCardCardCode  = 123;
$subscription-billToFirstName = Rasmus;
$subscription-billToLastName  = Doe;

// Create the subscription.
$request = new AuthorizeNetARB;
$response= $request-createSubscription($subscription);
$subscription_id = $response-getSubscriptionId();
echo $subscription_id;exit;
}


Regards,
Jipson

On Monday, 18 August 2014 10:42:08 UTC+1, Jipson Thomas wrote:

 Hi,
 Would you please tell me how we can access some 3rdpart vendor classes 
 (Not developed in a CakePHP platform) in our controller functions. For 
 example, in my cakePHP 3 website I need to integrate mandrill API and 
 Authorize.net API, I installed both through the compose of cakephp and both 
 are downloaded to my vendors folder.When I am trying to create their 
 objects in our controller action, I am getting fatal error as Class 
 'App\Controller\AuthorizeNet_
 Subscription' not found. I couldn't find any thing related to this on 
 cakephp documentation also. Would you please help me to solve this issue? I 
 had another post with this details, but that is not replied.

 Thanks and Regards,
 Jipson



 https://groups.google.com/forum/#!searchin/cake-php/authorize.net/cake-php/p5XbQfJGrWg/ZTBd5b1LCUcJ


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to access vendor classes in CakePHP 3

2014-08-18 Thread Thomas von Hassel
./composer.path dump-autoload

and check that the namespace is correct


On 18 Aug 2014, at 13:40, Jipson Thomas jip...@strategic-ic.co.uk wrote:

 Hi Thomas,
 Thank you for your update. MY code is as follows.
 
 The Controller function I used is
 
 namespace App\Controller;
 use App\Controller\AppController;
 use Authorizenet\AuthorizeNetARB;
 use Cake\ORM\TableRegistry;
 use Cake\Event\Event;
 use Cake\Network\Email\Email;
 
 public function authtest(){
 define(AUTHORIZENET_API_LOGIN_ID, LOGIN);
 define(AUTHORIZENET_TRANSACTION_KEY, KEY);
 $subscription  = new 
 AuthorizeNet_Subscription;
 $subscription-name= PHP Monthly Magazine;
 $subscription-intervalLength  = 1;
 $subscription-intervalUnit= months;
 $subscription-startDate   = 2014-08-14;
 $subscription-totalOccurrences= 12;
 $subscription-amount  = 12.99;
 $subscription-creditCardCardNumber= 60110012;
 $subscription-creditCardExpirationDate= 2018-10;
 $subscription-creditCardCardCode  = 123;
 $subscription-billToFirstName = Rasmus;
 $subscription-billToLastName  = Doe;
 
 // Create the subscription.
 $request = new AuthorizeNetARB;
 $response= $request-createSubscription($subscription);
 $subscription_id = $response-getSubscriptionId();
 echo $subscription_id;exit;
 }
 
 Regards,
 Jipson
 
 On Monday, 18 August 2014 10:42:08 UTC+1, Jipson Thomas wrote:
 Hi,
 Would you please tell me how we can access some 3rdpart vendor classes (Not 
 developed in a CakePHP platform) in our controller functions. For example, in 
 my cakePHP 3 website I need to integrate mandrill API and Authorize.net API, 
 I installed both through the compose of cakephp and both are downloaded to my 
 vendors folder.When I am trying to create their objects in our controller 
 action, I am getting fatal error as Class 'App\Controller\AuthorizeNet_
 Subscription' not found. I couldn't find any thing related to this on cakephp 
 documentation also. Would you please help me to solve this issue? I had 
 another post with this details, but that is not replied.
 
 Thanks and Regards,
 Jipson
 
 
 https://groups.google.com/forum/#!searchin/cake-php/authorize.net/cake-php/p5XbQfJGrWg/ZTBd5b1LCUcJ
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to access vendor classes in CakePHP 3

2014-08-18 Thread Jipson Thomas
Hi Thomas,
Thank you. I did that and I changed my  controller as follows.
?php
namespace App\Controller;
use App\Controller\AppController;
use Authorizenet\AuthorizeNetARB;
use Authorizenet\AuthorizeNet_Subscription;
use Cake\ORM\TableRegistry;
use Cake\Event\Event;
use Cake\Network\Email\Email;
/**
 * Vendors Controller
 *
 * @property App\Model\Table\VendorsTable $Vendors
 */
class VendorsController extends AppController {
/*
 * Function to test authorize SDK
 */  
public function authtest(){
define(AUTHORIZENET_API_LOGIN_ID, 4H9gA4hF);
define(AUTHORIZENET_TRANSACTION_KEY, 22968baA8xqMNrzc);
$subscription  = 
$this-AuthorizeNetSubscription;
$subscription-name= PHP Monthly Magazine;
$subscription-intervalLength  = 1;
$subscription-intervalUnit= months;
$subscription-startDate   = 2014-08-14;
$subscription-totalOccurrences= 12;
$subscription-amount  = 12.99;
$subscription-creditCardCardNumber= 60110012;
$subscription-creditCardExpirationDate= 2018-10;
$subscription-creditCardCardCode  = 123;
$subscription-billToFirstName = Rasmus;
$subscription-billToLastName  = Doe;
//print_r($subscription);exit;
// Create the subscription.
$request = $this-AuthorizeNetARB;
$response= $request-createSubscription($subscription);
$subscription_id = $response-getSubscriptionId();
echo $subscription_id;exit;
}

}

When I checked the code of Authorize.net, I found it as
autoload.php
==
?php
/**
 * Custom SPL autoloader for the AuthorizeNet SDK
 *
 * @package AuthorizeNet
 */

spl_autoload_register(function($className) {
static $classMap;

if (!isset($classMap)) {
$classMap = require __DIR__ . DIRECTORY_SEPARATOR . 'classmap.php';
}

if (isset($classMap[$className])) {
include $classMap[$className];
}
});


classmap.php

?php
/**
 * A map of classname = filename for SPL autoloading.
 *
 * @package AuthorizeNet
 */

$libDir= __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR;
$sharedDir = $libDir . 'shared' . DIRECTORY_SEPARATOR;

return array(
'AuthorizeNetAIM'= $libDir. 'AuthorizeNetAIM.php',
'AuthorizeNetAIM_Response'   = $libDir. 'AuthorizeNetAIM.php',
'AuthorizeNetARB'= $libDir. 'AuthorizeNetARB.php',
'AuthorizeNetARB_Response'   = $libDir. 'AuthorizeNetARB.php',
'AuthorizeNetAddress'= $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetBankAccount'= $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetCIM'= $libDir. 'AuthorizeNetCIM.php',
'AuthorizeNetCIM_Response'   = $libDir. 'AuthorizeNetCIM.php',
'AuthorizeNetCP' = $libDir. 'AuthorizeNetCP.php',
'AuthorizeNetCP_Response'= $libDir. 'AuthorizeNetCP.php',
'AuthorizeNetCreditCard' = $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetCustomer'   = $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetDPM'= $libDir. 'AuthorizeNetDPM.php',
'AuthorizeNetException'  = $sharedDir . 
'AuthorizeNetException.php',
'AuthorizeNetLineItem'   = $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetPayment'= $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetPaymentProfile' = $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetRequest'= $sharedDir . 'AuthorizeNetRequest.php',
'AuthorizeNetResponse'   = $sharedDir . 'AuthorizeNetResponse.php',
'AuthorizeNetSIM'= $libDir. 'AuthorizeNetSIM.php',
'AuthorizeNetSIM_Form'   = $libDir. 'AuthorizeNetSIM.php',
'AuthorizeNetSOAP'   = $libDir. 'AuthorizeNetSOAP.php',
'AuthorizeNetTD' = $libDir. 'AuthorizeNetTD.php',
'AuthorizeNetTD_Response'= $libDir. 'AuthorizeNetTD.php',
'AuthorizeNetTransaction'= $sharedDir . 'AuthorizeNetTypes.php',
'AuthorizeNetXMLResponse'= $sharedDir . 
'AuthorizeNetXMLResponse.php',
'AuthorizeNet_Subscription'  = $sharedDir . 'AuthorizeNetTypes.php',
);


When I tried to execute it I got the following error,
Error: Call to a member function createSubscription() on a non-object

Regards,
Jipson

On Monday, 18 August 2014 12:47:17 UTC+1, Thomas von Hassel wrote:

 ./composer.path dump-autoload

 and check that the namespace is correct


 On 18 Aug 2014, at 13:40, Jipson Thomas jip...@strategic-ic.co.uk 
 javascript: wrote:

 Hi Thomas,
 Thank you for your update. MY code is as follows.

 The Controller function I used is

 namespace App\Controller;
 use App\Controller\AppController;
 use Authorizenet\AuthorizeNetARB;
 use Cake\ORM\TableRegistry;
 use Cake\Event\Event;
 use Cake\Network\Email\Email;

 public function authtest(){

Access to Classes

2006-07-18 Thread [EMAIL PROTECTED]

I'm new to Cake, and am wondering how I access the pre-defined classes
in the cake structure.  I understand how to implement components, and
helpers.  Is there a special way at including certain classes such as
the File, NeatString, or NeatArray classes.

I was trying to create a 'new' object from the class, but it's not
finding it.  Maybe cake does that for me?  

Thanks,

Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Access to Classes

2006-07-18 Thread John David Anderson (_psychic_)


On Jul 18, 2006, at 9:31 AM, [EMAIL PROTECTED] wrote:


 I'm new to Cake, and am wondering how I access the pre-defined classes
 in the cake structure.  I understand how to implement components, and
 helpers.  Is there a special way at including certain classes such as
 the File, NeatString, or NeatArray classes.

The uses() function will automatically include CakePHP libraries for  
you.

uses('sanitize', 'neat_array', 'neat_string');

After using uses(), you can create new instantiations of the objects.

-- John



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Access to Classes

2006-07-18 Thread [EMAIL PROTECTED]

Sweet!  Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---