我无法解决这个问题,我宁愿不必用 unBinds 填充我的控制器。我有一个需要验证的贤者薪酬表格。因此,我使用以下内容建立了一个圣人模型:
class Sage extends AppModel {
var $useTable = false;
var $_schema = array(
'CardHolderName' =>array('type'=>'string', 'length'=>100),
'CardType' =>array('type'=>'string', 'length'=>100),
'CardNumber' =>array('type'=>'string', 'length'=>100),
'EndMonth' =>array('type'=>'string', 'length'=>100),
'EndYear' =>array('type'=>'string', 'length'=>100),
'BILLING_address_line_1' =>array('type'=>'string', 'length'=>100),
'BILLING_city' =>array('type'=>'string', 'length'=>100),
'BILLING_county' =>array('type'=>'string', 'length'=>100),
'BILLING_country' =>array('type'=>'string', 'length'=>100),
'BILLING_country' =>array('type'=>'string', 'length'=>100),
'BILLING_post_code' =>array('type'=>'string', 'length'=>100),
'DELIVER_name' =>array('type'=>'string', 'length'=>100),
'DELIVER_address_line_1' =>array('type'=>'string', 'length'=>100),
'DELIVER_city' =>array('type'=>'string', 'length'=>100),
'DELIVER_county' =>array('type'=>'string', 'length'=>100),
'DELIVER_country' =>array('type'=>'string', 'length'=>100),
'DELIVER_post_code' =>array('type'=>'string', 'length'=>100),
'CSV' =>array('type'=>'string', 'length'=>3)
);
public $validate = array(
'CardHolderName'=>array(
'Please enter your name.'=>array(
'rule'=>'notEmpty',
'message'=>'Please enter your name.'
)
),
'CardType'=>array(
'Card Type Select'=>array(
'rule'=>'notEmpty',
'message'=>'You must select a card type.'
)
),
'CardNumber'=>array(
'Card Number Length'=>array(
'rule'=> array('between', 16, 20),
'message'=>'Card numbers are at least 16 numbers long.'
),
'Not empty'=>array(
'rule'=> 'notEmpty',
'message'=>'Card Number is missing.'
),
'Is a number' => array(
'rule' => 'numeric',
'message' => 'This must be a number (no spaces either).'
)
),
'EndMonth'=>array(
'End Month Select'=>array(
'rule'=>'notEmpty',
'message'=>'No Month.'
)
),
'EndYear'=>array(
'End Year Select'=>array(
'rule'=>'notEmpty',
'message'=>'No Year.'
)
),
'CSV'=>array(
'Card Number Length'=>array(
'rule'=> array('between', 3, 3),
'message'=>'A CSV is 3 numbers long.'
),
'CSV not empty'=>array(
'rule'=>'notEmpty',
'message'=>'Please enter your security code.'
),
'Is a number' => array(
'rule' => 'numeric',
'message' => 'A CSV is 3 numbers long.'
)
)
);
}
但是,当我转到订单的索引页面(其中有一个$this->paginate('Order');
)时,我得到以下信息:
错误:SQLSTATE [42S02]:未找到基表或视图:1146 表 'wr_shop.sages' 不存在
SQL 查询: SELECT COUNT(*) AS
count
FROMwr_shop
。orders
如左Order
加入wr_shop
。users
ASUser
ON (Order
.user_id
=User
.id
) 左连接wr_shop
。baskets
ASBasket
ON (Basket
.order_id
=Order
.id
) 左连接wr_shop
。sages
ASSage
ON (Sage
.order_id
=Order
.id
) 其中 1 = 1
有人可以告诉我我错过了什么,我似乎无法在任何地方在线找到答案。
---UPADATE--- 我已经通过创建一个'sages'表临时解决了这个问题,即使它永远不会保存任何数据。