使用作曲家时未定义的属性

时间:2019-01-12 11:17:08

标签: php composer-php

im是在php中使用composer的新功能。我用它来将slydepay集成到我的项目中

它说。建议您使用Composer安装Slydepay PHP 所以我用了

它在我的目录中创建了一个供应商文件夹

然后我尝试创建一个test.php文件,以尝试代码是否基于其自述文件运行 https://github.com/DreamOval/slydepay-php-connector

代码看起来像这样     

require 'vendor/autoload.php';

use Slydepay\Order\Order;
use Slydepay\Order\OrderItem;
use Slydepay\Order\OrderItems;

// Instantiate Slydepay
$slydepay = new Slydepay\Slydepay("menandrodelosreyes@gmail.com", "123456");

// Create a list of OrderItems with OrderItem objects
$orderItems = new OrderItems([
    new OrderItem("1234", "Test Product", 10, 2),
    new OrderItem("1284", "Test Product2", 20, 2),
]);

// Shipping and tax pulled either from ini/properties file. Hard coded here for illustration
$shippingCost = 20; 
$tax = 10;

// Create the Order object for this transaction. 
$order = Order::createWithId(
    $orderItems,
    "order_id_1", 
    $shippingCost,
    $tax,
    "description",
    "no comment"
);

try {
    // Make request to Slydepay and get the response object for the redirect url
    $response = $slydepay->processPaymentOrder($order);
    echo $response->redirectUrl();
} catch (Slydepay\Exception\ProcessPayment $e) {
    echo $e->getMessage();
}

当我尝试执行代码时,我得到了错误

通知:未定义的属性:Slydepay \ Order \ OrderItem :: $$ Description in C:\ wamp \ www \ slydepay \ vendor \ slydepay \ slydepay-soap \ src \ Order \ OrderItem.php在第43行

通知:未定义的属性:Slydepay \ Order \ OrderItem :: $ ImageUrl在第43行的C:\ wamp \ www \ slydepay \ vendor \ slydepay \ slydepay-soap \ src \ Order \ OrderItem.php中

通知:未定义的属性:Slydepay \ Order \ OrderItem :: $$ Description in C:\ wamp \ www \ slydepay \ vendor \ slydepay \ slydepay-soap \ src \ Order \ OrderItem.php在第43行

通知:未定义的属性:Slydepay \ Order \ OrderItem :: $ ImageUrl在第43行的C:\ wamp \ www \ slydepay \ vendor \ slydepay \ slydepay-soap \ src \ Order \ OrderItem.php中

我缺少一些步骤吗?

我还没有见过像我这样的话题。我对作曲家和使用名称空间确实很陌生。如果我的问题重复,请给我一个现有主题的链接。谢谢

0 个答案:

没有答案