cakephp不保存数据

发布于 2025-01-06 02:44:46 字数 1800 浏览 0 评论 0原文

对于我的一生,我无法弄清楚出了什么问题。当我调试 $order->save 操作的值时,我得到一个 1 (我假设它的意思是 true)。这就是我正在做的:

$order = $this->Order->find('first', array(
    'conditions' => array('Order.token' => urldecode($token))
));

debug($order);

$this->Order->id = $order['Order']['id'];
$orderData = array('Order' => array(
    'id' => $order['Order']['id'],
    'billing_email' => urldecode($payPalResponse['EMAIL']),
    'billing_name' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTONAME']),
    'billing_address' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTOSTREET']),
    'billing_city' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTOCITY']),
    'billing_state' => $payPalResponse['PAYMENTREQUEST_0_SHIPTOSTATE'],
    'billing_zipcode' => $payPalResponse['PAYMENTREQUEST_0_SHIPTOZIP']
));
debug($orderData);
$this->Order->save($orderData);

这就是我得到的:

controllers/markets_controller.php (line 149)
Array
(
    [Order] => Array
        (
            [id] => 13
            [token] => **************
            [player_id] => 1
            [status_id] => 1
            [timestamp] => 2012-02-15 12:09:24
            [date_filled] => February 15, 2012
        )

    [OrderItem] => Array
        (
        )

)

controllers/markets_controller.php (line 161)
Array
(
    [Order] => Array
        (
            [id] => 13
            [billing_email] => *********@************.com
            [billing_name] => Test User
            [billing_address] => 1 Main St
            [billing_city] => San Jose
            [billing_state] => CA
            [billing_zipcode] => 95131
        )

)

为什么它告诉我它正在保存,但事实并非如此?

For the life of me I can't figure out what's going wrong. When I debug the value of the $order->save operation, I get a 1 (which I assume to mean true). Here's what I'm doing:

$order = $this->Order->find('first', array(
    'conditions' => array('Order.token' => urldecode($token))
));

debug($order);

$this->Order->id = $order['Order']['id'];
$orderData = array('Order' => array(
    'id' => $order['Order']['id'],
    'billing_email' => urldecode($payPalResponse['EMAIL']),
    'billing_name' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTONAME']),
    'billing_address' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTOSTREET']),
    'billing_city' => urldecode($payPalResponse['PAYMENTREQUEST_0_SHIPTOCITY']),
    'billing_state' => $payPalResponse['PAYMENTREQUEST_0_SHIPTOSTATE'],
    'billing_zipcode' => $payPalResponse['PAYMENTREQUEST_0_SHIPTOZIP']
));
debug($orderData);
$this->Order->save($orderData);

And here's what I'm getting:

controllers/markets_controller.php (line 149)
Array
(
    [Order] => Array
        (
            [id] => 13
            [token] => **************
            [player_id] => 1
            [status_id] => 1
            [timestamp] => 2012-02-15 12:09:24
            [date_filled] => February 15, 2012
        )

    [OrderItem] => Array
        (
        )

)

controllers/markets_controller.php (line 161)
Array
(
    [Order] => Array
        (
            [id] => 13
            [billing_email] => *********@************.com
            [billing_name] => Test User
            [billing_address] => 1 Main St
            [billing_city] => San Jose
            [billing_state] => CA
            [billing_zipcode] => 95131
        )

)

Why is it telling me that it's saving but it's not?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜警司 2025-01-13 02:44:46

好吧,我之前曾尝试清除缓存,但由于某种原因没有成功。我最终清除了订单模型的缓存文件,并修复了它。

Okay, I had tried to clear the cache before, but for some reason it didn't take. I finally cleared the cache file for the Order model, and that fixed it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文