Silverstripe Omnipay 中缺少 类
Missing Classes from Silverstripe Omnipay
在新鲜的苏格兰威士忌盒上https://box.scotch.io/(我一般推荐)
并与这位作曲家合作:
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "3.5.1",
"silverstripe/framework": "3.5.1",
"silverstripe/reports": "3.5.1",
"silverstripe/siteconfig": "3.5.1",
"silverstripe-themes/simple": "3.1.*",
"silverstripe/silverstripe-omnipay": "^2.1",
"omnipay/paymentexpress": "^2.2",
"firebase/php-jwt": "^4.0"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
},
"extra": {
"branch-alias": {
"3.x-dev": "3.5.x-dev"
}
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
并使用 https://github.com/silverstripe/silverstripe-omnipay
中的 payment.yml
Silverstripe 构建支付,但包含 Omnipay 类 的 none。我之前在 SS 上使用过 Omnipay,没有任何问题。
有人知道这是怎么回事吗?
你遇到了什么错误?以及您如何尝试访问 类?
您应该可以像这样调用 类(取决于 Omnipay 版本)
<?php
use Omnipay\Omnipay;
class PaymentPage extends Page
{
function ...
{
try {
$response = $gateway->purchase([...
}
}
确保 运行 command-line 上的以下内容:
$> ./framework/sake dev/build flush=all
如果你使用 F/S而不是 memcache 或类似的东西,然后 运行ning dev/build 再次。这将清除和重建您的缓存,并在此过程中告诉 SS 它可用的所有新 类。
silverstripe-omnipay makes use of php namespaces 对于它的许多文件,恰好 ServiceFactory 就是其中之一,因此为了让 SilverStripe 找到要包含的正确文件,您必须在您想要的文件顶部指定它的用途使用 ServiceFactory。
<?php
use SilverStripe\Omnipay\Service\ServiceFactory;
...
这并不完全明显,因为为 SilverStripe 制作的模块很少使用命名空间 fo,并且 silverstripe-omnipay 在其示例中没有提及 ServiceFactory 是命名空间。
在新鲜的苏格兰威士忌盒上https://box.scotch.io/(我一般推荐)
并与这位作曲家合作:
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "3.5.1",
"silverstripe/framework": "3.5.1",
"silverstripe/reports": "3.5.1",
"silverstripe/siteconfig": "3.5.1",
"silverstripe-themes/simple": "3.1.*",
"silverstripe/silverstripe-omnipay": "^2.1",
"omnipay/paymentexpress": "^2.2",
"firebase/php-jwt": "^4.0"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
},
"extra": {
"branch-alias": {
"3.x-dev": "3.5.x-dev"
}
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
并使用 https://github.com/silverstripe/silverstripe-omnipay
中的 payment.ymlSilverstripe 构建支付,但包含 Omnipay 类 的 none。我之前在 SS 上使用过 Omnipay,没有任何问题。
有人知道这是怎么回事吗?
你遇到了什么错误?以及您如何尝试访问 类?
您应该可以像这样调用 类(取决于 Omnipay 版本)
<?php
use Omnipay\Omnipay;
class PaymentPage extends Page
{
function ...
{
try {
$response = $gateway->purchase([...
}
}
确保 运行 command-line 上的以下内容:
$> ./framework/sake dev/build flush=all
如果你使用 F/S而不是 memcache 或类似的东西,然后 运行ning dev/build 再次。这将清除和重建您的缓存,并在此过程中告诉 SS 它可用的所有新 类。
silverstripe-omnipay makes use of php namespaces 对于它的许多文件,恰好 ServiceFactory 就是其中之一,因此为了让 SilverStripe 找到要包含的正确文件,您必须在您想要的文件顶部指定它的用途使用 ServiceFactory。
<?php
use SilverStripe\Omnipay\Service\ServiceFactory;
...
这并不完全明显,因为为 SilverStripe 制作的模块很少使用命名空间 fo,并且 silverstripe-omnipay 在其示例中没有提及 ServiceFactory 是命名空间。