Welcome Guest, Not a member yet? Register   Sign In
resultset Model Error
#1

This is my code :
PHP Code:
$data['lista_documenti_dichiarante'] = $isee_documenti_documenti_dichiarante_model->where('id_isee' $id)
                                                                                  ->findAll(); 


In view :

PHP Code:
<?php print_r($lista_documenti_dichiarante?>

The result is : 

Code:
Array ( [0] => App\Models\Entities\Isee_documenti_documenti_dichiarante_Entity Object ( [datamap:protected] => Array ( ) [dates:protected] => Array ( [0] => created_at [1] => updated_at [2] => deleted_at ) [casts:protected] => Array ( ) [attributes:protected] => Array ( [id] => 19 [id_isee] => 6 [nome_file] => 6*documenti_personali*1612808674*cammelli.jpeg [id_div] => o_1eu1e6m3abih1o93mb88fm8lg23 [created_at] => 2021-02-08 19:24:34 [updated_at] => 2021-02-08 19:24:34 [deleted_at] => ) [original:protected] => Array ( [id] => 19 [id_isee] => 6 [nome_file] => 6*documenti_personali*1612808674*cammelli.jpeg [id_div] => o_1eu1e6m3abih1o93mb88fm8lg23 [created_at] => 2021-02-08 19:24:34 [updated_at] => 2021-02-08 19:24:34 [deleted_at] => ) [_cast:CodeIgniter\Entity:private] => 1 ) )


Instead of :

Code:
[id] => 19 [id_isee] => 6 [nome_file] => 6*documenti_personali*1612808674*cammelli.jpeg [id_div] => o_1eu1e6m3abih1o93mb88fm8lg23 [created_at] => 2021-02-08 19:24:34 [updated_at] => 2021-02-08 19:24:34 [deleted_at] =>


Why ?
Reply
#2

Error?
1. You have set Entity to return result
2. You are using findAll() method (returns an array of results)

There is no error here.
Reply
#3

(02-08-2021, 01:36 PM)iRedds Wrote: Error?
1. You have set Entity to return result
2. You are using findAll() method (returns an array of results)

There is no error here.


this is my entity:

PHP Code:
<?php
namespace App\Models\Entities;

use 
CodeIgniter\Entity;
use 
App\Models\IseeModel;

class 
Isee_documenti_documenti_dichiarante_Entity extends Entity
{
    function isee()
    {
      $model= new IseeModel();
      return $model->find($this->id_isee);
    
    
}



and this is my model :

PHP Code:
<?php

namespace App\Models;

use 
CodeIgniter\Model;


class 
Isee_documenti_documenti_dichiaranteModel extends Model {

   protected $table 'isee_documenti_documenti_dichiarante';
    protected $primaryKey 'id';

    protected $returnType 'App\Models\Entities\Isee_documenti_documenti_dichiarante_Entity';
    protected $useSoftDeletes true;

    protected $allowedFields = ['id','id_isee','nome_file','id_div','created_at','updated_at','deleted_at'];
    protected $useTimestamps true;
    protected $createdField 'created_at';
    protected $updatedField 'updated_at';
    protected $deletedField 'deleted_at';

    protected $validationRules = [];
    protected $validationMessages = [];
    protected $skipValidation false;

    
  function oggetto_di_user($user_id,$id)
    
  {
        
$this->where('id_users',$user_id);
        
$this->where('id ',$id);

                $res=$this->findAll();

                if($this->countAllResults()==0){
        
  return TRUE;
        }else{
        
  return FALSE;
        }
    
  }



    public function value_unique_on_update($id,$value){

        $this->where('value',$value);
        $this->where('id !=',$id);

        

        
if($this->countAllResults()==0){
          return TRUE;
        }else{
          return FALSE;
        }

    }



but in other project not return this result but only multidimensional array
Reply




Theme © iAndrew 2016 - Forum software by © MyBB