• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class not found when loading a library

#1
Hi, I have some libraries created under a subdirectory inside Library folder:

../app/Libraries/commonLibraries/

Inside this folder, i have 10 different libraries that i will use in a lot of parts of the web application.

The problem is that inside a library y may have different classes, and i would like to initialize this classes (the classes names are different of the file name)

Example:

I have a library that is: /app/Libraries/commonLibraries/FileDoSomething.php

Inside this library, i have a class defined that is :

class anythingToDo{
...
}


How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?

Reply

#2
Look at Classmap

But I think this is bad design.

Everything will be fine as long as you remember what is where.
Reply

#3
(03-15-2021, 05:25 AM)fedeburo Wrote: Inside this library, i have a class defined that is :

class anythingToDo{
...
}[/font][/size][/color]

How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?


Have you tried:

PHP Code:
$todo = new anythingToDo(); 
as long as the FileDoSomething is included, that should work, right?
Reply

#4
(03-22-2021, 08:37 AM)Kaosweaver Wrote:
(03-15-2021, 05:25 AM)fedeburo Wrote: Inside this library, i have a class defined that is :

class anythingToDo{
...
}[/font][/size][/color]

How can i create an object anythingToDo in another part of the project that is not in the FileDoSomething?


Have you tried:

PHP Code:
$todo = new anythingToDo(); 
as long as the FileDoSomething is included, that should work, right?
This is not working. The vs code catches the class, but when executing the function in the explorer says class not found
Reply

#5
PHP Code:
$todo = new App\Libraries\commonLibraries\FileDoSomething(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.