Fixes in fields
This commit is contained in:
parent
737d0b7346
commit
3b85435367
4 changed files with 16 additions and 9 deletions
|
|
@ -30,7 +30,7 @@ class ForeignKeyField extends IntegerField{
|
|||
|
||||
$this->size=$size;
|
||||
$this->form='PhangoApp\PhaModels\Forms\SelectModelForm';
|
||||
$this->related_model=&$related_model;
|
||||
$this->related_model=$related_model;
|
||||
$this->container_model=$this->related_model->name;
|
||||
//Fields obtained from related_model if you make a query...
|
||||
$this->fields_related_model=array();
|
||||
|
|
@ -40,7 +40,7 @@ class ForeignKeyField extends IntegerField{
|
|||
$this->quot_open='';
|
||||
$this->quot_close='';
|
||||
$this->protected=0;
|
||||
$this->parameters=array(&$this->related_model, $name_field, $name_value);
|
||||
$this->parameters=array($this->related_model, $name_field, $name_value);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ class ParentField extends IntegerField{
|
|||
//field related in the model...
|
||||
public $parent_model='';
|
||||
|
||||
function __construct($parent_model, $size=11)
|
||||
function __construct($size=11, $parent_model, $name_field='', $name_value='')
|
||||
{
|
||||
|
||||
$this->parent_model=&$parent_model;
|
||||
$this->parent_model=$parent_model;
|
||||
$this->size=$size;
|
||||
$this->form='PhangoApp\PhaModels\Forms\BaseForm';
|
||||
$this->form='PhangoApp\PhaModels\Forms\SelectModelForm';
|
||||
$this->parameters=array($this->parent_model, $name_field, $name_value);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +29,13 @@ class ParentField extends IntegerField{
|
|||
|
||||
//Check model
|
||||
|
||||
$num_rows=$this->parent_model->select_count('where '.$this->parent_model->idmodel.'='.$value, $this->parent_model->idmodel);
|
||||
//$old_conditions=$this->parent_model->conditions;
|
||||
|
||||
$this->parent_model->conditions='where '.$this->parent_model->idmodel.'='.$value;
|
||||
|
||||
$num_rows=$this->parent_model->select_count();
|
||||
|
||||
//$this->parent_model->conditions=$old_conditions;
|
||||
|
||||
if($num_rows>0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use PhangoApp\PhaModels\Forms\SelectForm;
|
|||
use PhangoApp\PhaModels\Webmodel;
|
||||
|
||||
/**
|
||||
* Basic class for create forms
|
||||
* Basic class for create forms from a model
|
||||
*/
|
||||
|
||||
class SelectModelForm extends SelectForm{
|
||||
|
|
@ -26,7 +26,7 @@ class SelectModelForm extends SelectForm{
|
|||
|
||||
parent::__construct($name, $value);
|
||||
|
||||
$this->model=&$model;
|
||||
$this->model=$model;
|
||||
|
||||
$this->field_name=$field_name;
|
||||
|
||||
|
|
|
|||
|
|
@ -2219,7 +2219,7 @@ class Webmodel {
|
|||
/*$rc=new \ReflectionClass($type);
|
||||
$this->components[$name]=$rc->newInstanceArgs($arguments);*/
|
||||
|
||||
$this->components[$name]=&$type_class;
|
||||
$this->components[$name]=$type_class;
|
||||
|
||||
//Set first label...
|
||||
$this->components[$name]->label=Webmodel::set_name_default($name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue