Welcome Guest, Not a member yet? Register   Sign In
How do I Migrate from 4.3.x to 4.4.x?
#7

(This post was last modified: 10-27-2023, 02:52 PM by kenjis.)

These are all incorrect. Are you a LLM?

(10-27-2023, 04:32 AM)AnanayKayar Wrote: Here is a list of some of the major changes that you will need to make when migrating from CodeIgniter 4.3.x to 4.4.x:

Controllers no longer use echo to spew views. Instead they use return.
This means that you will need to change all of your controller methods that currently use echo to return the view instead. For example:

PHP
// CodeIgniter 4.3.x
public function index()
{
    echo view('pages/index');
}

// CodeIgniter 4.4.x
public function index()
{
    return view('pages/index');
}

(10-27-2023, 04:32 AM)AnanayKayar Wrote: The $routes array now uses PHP 8.1 named arguments.
This means that you will need to change all of your $routes array definitions to use named arguments instead of positional arguments. For example:

PHP
// CodeIgniter 4.3.x
$routes->get('pages/index', 'Pages::index');

// CodeIgniter 4.4.x
$routes->get('pages/index', [Pages::class, 'index']);

(10-27-2023, 04:32 AM)AnanayKayar Wrote: The Database::connect() method now returns a ConnectionPool object.
This means that you will need to change all of your code that currently uses the Database::connect() method to return the ConnectionPool object instead. For example:

PHP
// CodeIgniter 4.3.x
$db = Database::connect();

// CodeIgniter 4.4.x
$db = Database::connect()->getConnection('default');

(10-27-2023, 04:32 AM)AnanayKayar Wrote: The Validation::check() method now accepts a string or array of validation rules as its second argument.
This means that you will need to change all of your code that currently uses the Validation::check() method to accept a string or array of validation rules as its second argument instead of a single validation rule. For example:

PHP
// CodeIgniter 4.3.x
$validation->check($input, 'required');

// CodeIgniter 4.4.x
$validation->check($input, ['required', 'min_length' => 5]);

(10-27-2023, 04:32 AM)AnanayKayar Wrote: The Security::encrypt() and Security::decrypt() methods now accept a string or array of data as their first argument.
This means that you will need to change all of your code that currently uses the Security::encrypt() and Security::decrypt() methods to accept a string or array of data as their first argument instead of a single piece of data. For example:

PHP
// CodeIgniter 4.3.x
$encryptedData = Security::encrypt($data);

// CodeIgniter 4.4.x
$encryptedData = Security::encrypt(['data' => $data]);
These are just some of the major changes that you will need to make when migrating from CodeIgniter 4.3.x to 4.4.x. For a more comprehensive list of changes, please consult the CodeIgniter 4.4 upgrade guide.

I hope this helps!
Reply


Messages In This Thread
How do I Migrate from 4.3.x to 4.4.x? - by owino - 09-30-2023, 01:27 AM
RE: How do I Migrate from 4.3.x to 4.4.x? - by kenjis - 10-27-2023, 02:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB