无法更新propel中的主键字段值

时间:2018-07-16 07:36:32

标签: php mysql propel

我正在尝试更新作为主键字段的行项目的字段值。表结构如下。

mysql> desc sms_service_settings;
+-----------------------------+------------------------------+------+-----+-----------+-------+
| Field                       | Type                         | Null | Key | Default  
+-----------------------------+------------------------------+------+-----+--------
| customer_id                 | int(11) unsigned             | NO   | PRI | NULL 
| daily_limit                 | decimal(8,2)                 | YES  |     | NULL 
| account_type                | enum('Post-paid','Pre-paid') | NO   |     | Post-paid
| credit_amount               | double(8,4)                  | YES  |     | NULL 
+-----------------------------+------------------------------+------+-----+--------

表的架构定义如下

<table name="sms_service_settings" idMethod="native" phpName="SmsServiceSettings">
    <column name="customer_id" phpName="CustomerId" type="BIGINT" primaryKey="true" required="true" defaultValue="0"/>
    <column name="daily_limit" phpName="DailyLimit" type="DECIMAL" size="8" scale="2"/>
    <column name="account_type" phpName="AccountType" type="VARCHAR" sqlType="enum('Post-paid','Pre-paid')"  size="15" defaultValue="Post-paid"/>
    <vendor type="mysql">
      <parameter name="Engine" value="MyISAM"/>
    </vendor>
  </table>

我的推进代码如下。

$sms_service = SmsServiceSettingsQuery::create()
                    ->findPK($original_customer_id);
$sms_service->setCustomerId($new_customer_id);
$sms_service->save();

这没什么返回任何错误。但是customer_id不会更新。有人可以帮忙吗。

0 个答案:

没有答案