Intelephense (1014)
Asked Answered
B

2

13

It bothers me because with the most recent update to PHP Intelephense that I received today, the intelephense keeps displaying an error for an unknown property, functions.

Intelephense (1014)

and this is my code:

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Firm extends CI_Controller
{

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *      http://example.com/index.php/welcome
     *  - or -
     *      http://example.com/index.php/welcome/index
     *  - or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */

    function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        $this->load->database();
        $this->load->model('Users');
        $this->load->model('Projects_Details');
        $this->load->model('Categories');
        date_default_timezone_set('asia/manila');
    }

    public function index()
    {

        $this->load->view('services/default/header');
        $this->load->view('services/firm/firm');
        $this->load->view('services/default/footer');
    }

    public function services()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/services/sidebar-menu');
            $this->load->view('firm/services/services-1');
        }
    }

    public function firm_services()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-services/sidebar-menu');
            $this->load->view('firm/firm_services/firm_services');
        }
    }

    public function add_firm_services()
    {
        $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

        $user_id = $this->input->post('user_id');
        $service_code =  substr(str_shuffle($permitted_chars), 0, 10) . rand(10000000, 99999999);
        $category_id = $this->input->post('category_id');
        $sub_category_id = $this->input->post('sub_category_id');
        $service_name = $this->input->post('service_name');
        $description = $this->input->post('description');
        $display_service_name = $service_name;
        $display_amount = $this->input->post('display_amount');
        $ope = rand(0, 1);
        $status = 1;
        $vat = 12;
        $data = array(
            'user_id' => $user_id,
            'service_code' => $service_code,
            'category_id' => $category_id,
            'sub_category_id' => $sub_category_id,
            'service_name' => $service_name,
            'description' => $description,
            'display_service_name' => $display_service_name,
            'display_amount' => $display_amount,
            'ope' => $ope,
            'status' => $status,
            'vat' => $vat
        );

        $this->db->insert('services', $data);
        $this->session->set_flashdata('success', 'Service successfully added.');
        redirect('Firm/firm_services', 'refresh');
    }

    public function projects()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/projects/sidebar-menu');
            $this->load->view('firm/projects/project_view1');
        }
    }

    public function edit_projects($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['project'] = $this->Projects_Details->get_id($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/projects/sidebar-menu');
            $this->load->view('firm/projects/project_view_edit', $data);
        }
    }

    public function update_projects($id)
    {
        $data = array(
            'project_id' => $this->input->post('project_id'),
            'service_id' => $this->input->post('service_id'),
            'firm_id' => $this->input->post('firm_id'),
            'assigned_id' => $this->input->post('assigned_id'),
            'package_id' => $this->input->post('package_id'),
            'amount' => $this->input->post('amount'),
            'ope' => $this->input->post('ope'),
            'start_date' => $this->input->post('start_date'),
            'due_date' => $this->input->post('due_date'),
            'status' => $this->input->post('status'),
            'comment' => $this->input->post('comment'),
            'updated_at' => $this->input->post('updated_at'),
        );

        $this->db->where('id', $id);
        $this->db->update('projects', $data);
        redirect('Firm/projects', 'refresh');
    }

    public function show_projects($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['project'] = $this->Projects_Details->get_id($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu');
            $this->load->view('firm/projects/project_view_show', $data);
        }
    }

    public function delete_projects($id)
    {
        $this->db->delete('projects', ['id' => $id]);
        redirect('Firm/projects', 'refresh');
    }

    public function specialist_view()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('services/default/header');
            $this->load->view('services/services');
            $this->load->view('services/default/footer');
        }
    }
    public function project_details()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('services/default/header');
            $this->load->view('services/services');
            $this->load->view('services/default/footer');
        }
    }
    public function add_specialist($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['project'] = $this->Projects_Details->get_id($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/projects/sidebar-menu');
            $this->load->view('firm/add_specialist', $data);
        }
    }

    public function firm_projects()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/view-project-details/sidebar-menu');
            $this->load->view('firm/projects/project_details_view');
        }
    }

    public function firm_editprojects($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['project'] = $this->Projects_Details->get_id_pd($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/view-project-details/sidebar-menu');
            $this->load->view('firm/projects/project_details_edit', $data);
        }
    }

    public function firm_showprojects($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['project'] = $this->Projects_Details->get_id_pd($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu');
            $this->load->view('firm/projects/project_details_show', $data);
        }
    }

    public function delete_projects_details($id)
    {
        $this->db->delete('projects_details', ['id' => $id]);
        redirect('Firm/firm_projects', 'refresh');
    }

    public function specialist()
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu');
            $this->load->view('firm/firm_specialist/firm_specialist_view');
        }
    }


    public function edit_specialist($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['user'] = $this->Users->get_id($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu');
            $this->load->view('firm/firm_specialist/firm_edit-specialist_view', $data);
        }
    }

    public function show_specialist($id)
    {
        $this->load->library('session');
        if (!$this->session->userdata('user')) {
            redirect('login', 'refresh');
        } else {
            $data['user'] = $this->Users->get_id($id);
            $this->load->view('firm/projects/header-nav');
            $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu');
            $this->load->view('firm/firm_specialist/firm_show-specialist_view', $data);
        }
    }

    public function update_specialist($id)
    {
        $data = array(
            'first_name' => $this->input->post('first_name'),
            'last_name' => $this->input->post('last_name'),
            'registered_address' => $this->input->post('registered_address'),
            'city' => $this->input->post('city'),
            'contact_number' => $this->input->post('contact_number'),
            'email' => $this->input->post('email'),
        );

        $this->db->where('id', $id);
        $this->db->update('users', $data);
        $this->session->set_flashdata('success', 'User Details Updated Successfully.');
        redirect('Firm/specialist', 'refresh');
    }

    public function delete_specialist($id)
    {
        $this->Users->delete_id($id);
        $this->session->set_flashdata('success', 'User Deleted Successfully.');
        redirect('Firm/specialist', 'refresh');
    }
}

Is there a way to make the IntelliSense stop reporting errors even though there no error in the code?

Bide answered 5/1, 2023 at 15:32 Comment(2)
First make sure that all CI base classes (like CI_Controller) are indexed (Intelephense: Index workspace) in the IDE. Sometimes it loses the indexes, which can cause this issue when extending a class that hasn't been indexed.Dogfight
@M. Eriksson, How to do it please.Rasputin
U
26

You can disable Intelephense > Diagnostics: Undefined Properties in the Intelephense extension config using settings editor;

Or put this line in the settings.json

"intelephense.diagnostics.undefinedProperties": false

This happens because CodeIgniter injects these properties dynamically into the controller at runtime via CI_Loader, as Inteliphense could not find these properties declared in your code, it reports an unknown property error.

Unattended answered 12/1, 2023 at 19:23 Comment(0)
S
0

If you're using Sublime Text 4

  1. open LSP-intelephense.sublime-settings via:

    • Preferences > Package settings > LSP > Servers > LSP-intelephense
    • or press CTRL+SHIFT+P and select Preferences: LSP intelephense Settings
  2. insert the following JSON on the right panel or integrate it with eventual existing code, then save:

{
    "settings": {
        "intelephense.diagnostics.undefinedProperties": false
    },
}
Skinnydip answered 5/2 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.