Fixes in fields for new mysql behaviour
This commit is contained in:
parent
94e3d63b0b
commit
29faed4b35
7 changed files with 27 additions and 6 deletions
|
|
@ -23,6 +23,7 @@ class DoubleField extends PhangoField {
|
||||||
|
|
||||||
$this->size=$size;
|
$this->size=$size;
|
||||||
$this->form='PhangoApp\PhaModels\Forms\BaseForm';
|
$this->form='PhangoApp\PhaModels\Forms\BaseForm';
|
||||||
|
$this->value=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class ForeignKeyField extends IntegerField{
|
||||||
$this->protected=0;
|
$this->protected=0;
|
||||||
//($name, $value, $model, $field_name, $field_value)
|
//($name, $value, $model, $field_name, $field_value)
|
||||||
$this->parameters=array($this->related_model, $name_field, $this->related_model->idmodel);
|
$this->parameters=array($this->related_model, $name_field, $this->related_model->idmodel);
|
||||||
|
$this->default_value='NULL';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class IntegerField extends PhangoField {
|
||||||
$this->max_num=$max_num;
|
$this->max_num=$max_num;
|
||||||
$this->quot_open='';
|
$this->quot_open='';
|
||||||
$this->quot_close='';
|
$this->quot_close='';
|
||||||
|
$this->default_value=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class MoneyField extends DoubleField{
|
||||||
|
|
||||||
parent::__construct(11, true, 0, 0);
|
parent::__construct(11, true, 0, 0);
|
||||||
$this->form='PhangoApp\PhaModels\Forms\MoneyForm';
|
$this->form='PhangoApp\PhaModels\Forms\MoneyForm';
|
||||||
|
$this->default_value=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class SerializeField extends PhangoField {
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->related_type=$related_type;
|
$this->related_type=$related_type;
|
||||||
|
$this->default_value='{}';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class TextField extends PhangoField {
|
||||||
|
|
||||||
$this->form='PhangoApp\PhaModels\Forms\TextAreaForm';
|
$this->form='PhangoApp\PhaModels\Forms\TextAreaForm';
|
||||||
$this->multilang=$multilang;
|
$this->multilang=$multilang;
|
||||||
|
$this->default_value='';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,4 +75,4 @@ class TextField extends PhangoField {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -680,8 +680,12 @@ class Webmodel {
|
||||||
{
|
{
|
||||||
|
|
||||||
//Foreach for create the query that comes from the $post array
|
//Foreach for create the query that comes from the $post array
|
||||||
|
|
||||||
foreach($fields as $key => $field)
|
$components=$this->components;
|
||||||
|
|
||||||
|
unset($components[$this->idmodel]);
|
||||||
|
|
||||||
|
foreach($components as $key => $field)
|
||||||
{
|
{
|
||||||
|
|
||||||
$quot_open=$this->components[$key]->quot_open;
|
$quot_open=$this->components[$key]->quot_open;
|
||||||
|
|
@ -699,12 +703,23 @@ class Webmodel {
|
||||||
$fields[$key]='NULL';
|
$fields[$key]='NULL';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr_fields[]=$quot_open.$fields[$key].$quot_close;
|
if(!isset($fields[$key]))
|
||||||
|
{
|
||||||
|
|
||||||
|
$arr_fields[]=$quot_open.$this->components[$key]->default_value.$quot_close;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$arr_fields[]=$quot_open.$fields[$key].$quot_close;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'insert into '.$this->name.' (`'.implode("`, `", array_keys($fields)).'`) VALUES ('.implode(", ",$arr_fields).') ';
|
return 'insert into '.$this->name.' (`'.implode("`, `", array_keys($components)).'`) VALUES ('.implode(", ",$arr_fields).') ';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue