I create table in mysql :
CREATE TABLE api_failed_logins
(
user_id INT UNSIGNED NOT NULL,
logs LONGTEXT,
ip VARCHAR(15) NOT NULL,
PRIMARY KEY (user_id, ip)
);
then meta data in Model
public function metaData()
{
return array(
//Every column in the mapped table
MetaData::MODELS_ATTRIBUTES => array(
'user_id', 'ip','logs'
),
//Every column part of the primary key
MetaData::MODELS_PRIMARY_KEY => array(
'user_id','ip'
),
//Every column that isn't part of the primary key
MetaData::MODELS_NON_PRIMARY_KEY => array(
'logs'
),
//Every column that doesn't allows null values
MetaData::MODELS_NOT_NULL => array(
'user_id','ip'
),
//Every column and their data types
MetaData::MODELS_DATA_TYPES => array(
'user_id' => Column::TYPE_INTEGER,
'logs' => Column::TYPE_TEXT,
'ip' => Column::TYPE_VARCHAR,
),
//The columns that have numeric data types
MetaData::MODELS_DATA_TYPES_NUMERIC => array(
'user_id' => true
),
//The identity column, use boolean false if the model doesn't have
//an identity column
MetaData::MODELS_IDENTITY_COLUMN => array('user_id','ip'),
//How every column must be bound/casted
MetaData::MODELS_DATA_TYPES_BIND => array(
'user_id' => Column::BIND_PARAM_INT,
'logs' => Column::BIND_PARAM_STR,
'ip' => Column::BIND_PARAM_STR,
),
//Fields that must be ignored from INSERT SQL statements
MetaData::MODELS_AUTOMATIC_DEFAULT_INSERT => array(
//'created' => 100
),
//Fields that must be ignored from UPDATE SQL statements
MetaData::MODELS_AUTOMATIC_DEFAULT_UPDATE => array(
// 'modified' => true
)
);
}
when it inserts it's succesful and my database has one record but display error : Phalcon\Mvc\Model::_doLowInsert(): Property should be string . When update it's always succesful . I don't know why when insert it show error. Please explan for me.
Thanks Vu