ATK4CRUDでサポートが必要です。AgileToolkit4.1.3を使用してプロジェクトのバックエンドを構築しました。私は次のモデルを持っています:
class Model_Product extends Model_Table
{
public $entity_code = 'product';
function init()
{
parent::init();
$this->addField('category_id')->refModel('Model_Category')->mandatory(true);
$this->addField('name')->mandatory(true);
$this->addField('picture_id')->refModel('Model_Picture')->mandatory(true);
$this->addField('short_description')->mandatory(true);
$this->addField('description')->type('text')->mandatory(true);
$this->addField('uploaded_at')->type('datetime');
$this->addField('price')->type('int')->mandatory(true);
$this->addField('quantity')->type('int')->mandatory(true);
$this->addField('status')->datatype('list')
->listData(array(
'enabled'=>'Enabled',
'disabled'=>'Disabled',
))
->defaultValue('enabled');
}
}
ページ:
<?php
class page_index extends Page {
function init(){
parent::init();
$page=$this;
$tabs = $page->add('Tabs');
$tabs->addTab('Product')->add('CRUD')->setModel('Product');
....
私のローカルホストでは、すべてのCRUD機能が問題なく機能しますが、ファイルをWebサーバーにアップロードした後、新しい製品を追加しようとすると、次のエラーが発生します。
`AJAX応答のエラー:SyntaxError:無効なXML属性値SQLException
クエリを実行できませんでした:製品に挿入(、、、、、、、、、)値(NULL category_id
、 'as' name
、 NULL picture_id
、 '' short_description
、 '' description
、 NULL uploaded_at
、2500、25、'有効')最後のクエリ:製品にprice
挿入(、、、、、、、、、 )値(NULL 、 'as' 、 NULL 、 '' 、 '' 、 NULL 、2500、25、'有効')MySQLエラー:列'category_id'をnullにすることはできません`quantity
status
category_id
name
picture_id
short_description
description
uploaded_at
price
quantity
status
クエリで欠落している値がクルード形式で表示されているのに、クエリに到達しないという奇妙なこと。追加情報:Model_Pictureでは、自動インクリメントintの代わりにvarchar idフィールドを使用しますが、ローカルホストではすべてが正常に機能します。
ありがとう!