在cfwheels中更新nestedproperties记录时收到错误

时间:2015-10-27 06:29:32

标签: coldfusion coldfusion-9 coldfusion-10 cfwheels

我有与其他表有很多关系的模型

  <cfcomponent extends="Model">
    <cffunction name="init">
        <cfset table("products")>
        <cfset hasOne(name="productInventory") />
        <cfset hasmany(name="productDescriptions",dependent="deleteAll") />
        <cfset hasmany(name="productPrices",dependent="deleteAll") />
        <cfset nestedProperties(associations="productDescriptions,productPrices,productInventory",allowDelete=true)>

    </cffunction>
  </cfcomponent>

它在此更新声明中给出了错误

Problem occured may because of structure created by cfwheels for object. as we look into to params.product dump having different id for many relation and in cfwheels object there is different id . may that why its creating problem of nested properties.

    <cfset variables.product = model("product").findOne(include="productDescriptions,productPrices,productInventory", includeSoftDeletes="true", where="products.id=#params.product.id#") />
            <cfset updateResult = product.update(params.product) />

错误消息的屏幕截图:

Screenshot 1

Screenshot 2

0 个答案:

没有答案