Welcome Guest, Not a member yet? Register   Sign In
  MVC vs MVCS vs CodeIgniter
Posted by: FlavioSuar - 11 hours ago - No Replies

Hi,
Reading this post Better than MVC.
What do you think? 
I saw some messages about using CI that way and makes sense to me...

Cheers.


  my controller fails to find helper function
Posted by: PaulC - Yesterday, 05:40 AM - Replies (8)

Hi Team,
I love the new error interface - great job!
Its helping me to upgrade my ci3 to ci 4.6.0
Latest snag is my controller which extends BaseController cannot find the validation function:
- the function is 'is_valid_level' which is defined in a Helper myvalidate_helper.php
- the myvalidate helper is loaded (I think) by adding to the $helpers array in the BaseController (I can see it in the list of files).
- ci3 call was

PHP Code:
if (!is_valid_level($level3)) { .... 
- and I changed it to after a bit of research
PHP Code:
if (!myvalidate(is_valid_level($level3))) { .... 
- and the error reported is: Call to undefined function App\Controllers\myvalidate()
Clearly I have misunderstood something important, so could someone explain what I have got wrong please?
Thx Paul


  Update to 4.6.1
Posted by: serialkiller - Yesterday, 01:33 AM - Replies (12)

I'm updating some applications and one of the files that has changed is Config/Paths.php.
Compared to the previous one, it has a different value for the $systemDirectory variable, before it was:

PHP Code:
public string $systemDirectory __DIR__ '/../../vendor/codeigniter4/framework/system'


now instead I find:

PHP Code:
public string $systemDirectory __DIR__ '/../../system'


But this will never work, the system folder is not located there.

Am I doing something wrong?


  systemDirectory conundrum
Posted by: codeus - 05-06-2025, 06:48 AM - Replies (2)

Hi all,
Just did a test install of CI v4.6.1 with composer. All worked fine and dandy.

I noticed that in app/Config/Paths the $systemDirectory is:

PHP Code:
    public string $systemDirectory __DIR__ '/../../vendor/codeigniter4/framework/system'


I'm sure that in v4.5 (and earlier) $systemDirectory was
PHP Code:
public string $systemDirectory __DIR__ '/../../system'

and that for every install I would have to edit this to _DIR__ . '/../../vendor/codeigniter4/framework/system' in Paths.php

Was this a bug? I'm curious because I've just seen a v4.4.0 installation (not mine) with system directory at the same level as app.

Don't know why system directory would be at the same level as app. Was this for a non-composer install??

TIA
Mike


  Can't create new database with forge
Posted by: occitan - 05-05-2025, 09:01 PM - Replies (3)

I have tried this: 

PHP Code:
$forge = \Config\Database::forge();
$forge->createDatabase('test_1002'); 


and this:

PHP Code:
$dbName 'test_1002';
$sql "CREATE DATABASE {$dbName}";
$query $this->db->query($sql); 


and I get: 

PHP Code:
CRITICAL 2025-05-06 03:35:45 --> [Caused bymysqli_sql_exceptionAccess denied for user 'development'@'%' to database 'test_1002' 


The server is Liquid Web Alma Linux, Maria DB, Plesk... the db user has full access to all functions and all databases. 
I can create a db over ssh but it doesn't show up to Plesk, because Plesk only tracks it's own databases. 
Does anyone know how to get past this, and create Plesk visible databases with CI4?


  5 Things I Wish I Knew Before Starting a Startup as a Software Engineer
Posted by: php_rocs - 05-05-2025, 05:29 AM - Replies (1)

StartUp advice (DevTo): https://dev.to/code42cate/5-things-i-wis...ineer-208i


  Why Every Programmer Needs a Non Computer Hobby
Posted by: php_rocs - 05-05-2025, 05:26 AM - Replies (1)

Good advice ( DevTo): https://dev.to/mahdijazini/why-every-pro...-hobby-fgf


  Using Pager with an Array
Posted by: nneves - 05-04-2025, 01:55 PM - No Replies

Hi

I have some results from a Model that needs to be cached after being parsed to clean user comments.

Is there's a way to use Pager with an Array?

Thanks


  CodeIgniter 4.6.1 has been released
Posted by: InsiteFX - 05-03-2025, 03:01 AM - Replies (2)

CodeIgniter 4.6.1 has been released Download
Upgrading from 4.6.0 to 4.6.1
Changes
Bugs Fixed
I' am sorry to say that while I was cleaning up the SPAM this morning I Accidently deleted the thread.
Which I' am reporting to MyBB because the thread was not even checked a post was.
Again sorry for my mistake.

I have emailed Paul to let him know about it.


  Feature to not append database prefix in QueryBuilder
Posted by: objecttothis - 05-02-2025, 02:37 AM - Replies (5)

Currently I'm not aware of the means to prevent query builder from appending the database prefix, so which you need to run a query where you do not want the prefix appended, you either can't use QueryBuilder or you have to use acrobatics to make it work. Please consider adding a parameter to QueryBuilder turning off the appending of the database prefix.

Take this code as an example of what I mean

PHP Code:
function dropForeignKeyConstraints(array $foreignKeysstring $table): void {
    
$db Database::connect();

    
$prefixName $db->getPrefix();
    
$db->setPrefix('');
    
$database_name $db->database;

    foreach (
$foreignKeys as $fk)
    {
        
$builder $db->table('INFORMATION_SCHEMA.TABLE_CONSTRAINTS');
        
$builder->select('CONSTRAINT_NAME');
        
$builder->where('TABLE_SCHEMA'$database_name);
        
$builder->where('TABLE_NAME'$table);
        
$builder->where('CONSTRAINT_TYPE''FOREIGN KEY');
        
$builder->where('CONSTRAINT_NAME'$fk);
        
$query $builder->get();

        if(
$query->getNumRows() > 0)
        {
            
$db->query("ALTER TABLE `$table` DROP FOREIGN KEY `$fk`");
        }
    }

    
$db->setPrefix($prefixName);


To prevent the query builder from appending the dbPrefix to INFORMATION_SCHEMA.TABLE_CONSTRAINTS, which would break the query, I need to capture the prefix, set it to an empty string, then put it back after I'm done with the QueryBuilder so that code below resumes the prefix appending. While this isn't needed all the time, it's better if I don't pepper the code with these extra three lines. I could write $prefixName = removePrefix() and restorePrefix($prefixName) helper functions, but that really only saves me one line of code. It would be better if I could call something like $builder = $db->table('INFORMATION_SCHEMA.TABLE_CONSTRAINTS', false); where the false parameter in the table() function returned the query without the prefix appended.


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
my controller fails to fi...
by PaulC
3 minutes ago
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
11 hours ago
Update to 4.6.1
by serialkiller
Yesterday, 11:58 AM
Can't create new database...
by paulbalandan
Yesterday, 08:49 AM
Help parsing the log file...
by sophia2005
Yesterday, 05:02 AM
systemDirectory conundrum
by FlavioSuar
Yesterday, 04:28 AM
Set session expiration ti...
by grimpirate
05-06-2025, 02:46 PM
Understanding JSON Web To...
by Feba98
05-06-2025, 07:30 AM
Is hiring a digital marke...
by codeus
05-06-2025, 07:15 AM
Database connection probl...
by codeus
05-06-2025, 02:35 AM

Forum Statistics
» Members: 144,617
» Latest member: 789WINconversesale
» Forum threads: 78,379
» Forum posts: 379,405

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB