Comments (3)
the most I can find, from a var_dump($db); is
classpath = array(); } public function addToClasspath($dir){ if(is_dir($dir)){ $this->classpath[] = $dir; }else{ throw new Exception("cannot find directory: $dir"); } } public function load($classname){ $ok = false; for($i=0;$iclasspath);$i++){ $path = $this->classpath[$i]; /* echo "load recur "" . $path . "";//
\n"; / $ok = $ok || $this->load_recursive($path, $classname); } return $ok; } protected function load_recursive($classpath, $classname){ $theList = array(); $ret = false; if ($handle = opendir($classpath)) { while (false != ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(is_dir($classpath . $file)){ $ret = $ret || $this->load_recursive($classpath . $file . "/", $classname); }else{ if($file == "class.$classname.php"){ include_once $classpath . $file; $ret = true; / echo "include_once "" . $classpath . $file . "";//
\n"; / }else if($file == "class.Boolean.$classname.php"){ include_once $classpath . $file; $ret = true; / echo "include_once "" . $classpath . $file . "";//
\n"; / }else if($file == "interface.$classname.php"){ include_once $classpath . $file; $ret = true; / echo "include_once "" . $classpath . $file . "";//
\n"; */ } } } } closedir($handle); unset($handle); } return $ret; } public function loadTestFiles(GroupTest $g){ foreach($this->classpath as $c){ $this->loadTestFilesHelper($g, $c); } } protected function loadTestFilesHelper(GroupTest $g, $classpath){ $theList = array(); if ($handle = opendir($classpath)) { while (false != ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(is_dir($classpath . $file)){ $this->loadTestFilesHelper($g, $classpath . $file . "/"); }else{ if(strpos($file, "test.class.") === 0 && strpos($file, ".php") == strlen($file)-4){ $g->addTestFile($classpath . $file); } } } } closedir($handle); unset($handle); } } } class ClassLoaderToString extends ClassLoader{ public function __construct(){ parent::__construct(); } protected function load_recursive($classpath, $classname){ $theList = array(); $ret = false; if ($handle = opendir($classpath)) { while (false != ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(is_dir($classpath . $file)){ $this->load_recursive($classpath . $file . "/", $classname); }else{ if($file == "class.$classname.php"){ include_once $classpath . $file; $this->printClass($classpath, $file); $ret = true; }else if($file == "class.Boolean.$classname.php"){ include_once $classpath . $file; $this->printClass($classpath, $file); $ret = true; }else if($file == "interface.$classname.php"){ include_once $classpath . $file; $this->printClass($classpath, $file); $ret = true; } } } } closedir($handle); unset($handle); } return $ret; } protected function printClass($classpath, $file){ if(strpos($classpath, ROOT) === 0){ $classpath = substr($classpath, strlen(ROOT)); echo "include_once(ROOT . "" . $classpath . $file . "");\n"; }else{ echo "include_once("" . $classpath . $file . "");\n"; } } } function milestone_autoload($classname){ global $classLoader; // global $control; // $str = "classname: "; // $str .= $classname; // $str .= "\n"; // if(is_object($control) && !is_int(stripos($classname, "mysql"))){ // $control->getModel()->getLogger()->log($control->getModel(), ALogger::$HIGH, $str); // } try{ $ok = $classLoader->load($classname); // $str .= ":" . $ok; // if(is_object($control) && !is_int(stripos($classname, "mysql"))){ // $control->getModel()->getLogger()->log($control->getModel(), ALogger::$HIGH, $str); // } }catch(Exception $e){ $model->getLogger()->log($model, ALogger::$HIGH, print_r($e, true)); } } spl_autoload_register('milestone_autoload'); $classLoader = new ClassLoader(); ?>
Notice: Undefined variable: classLoader in /usr/local/www/apache24/data/json-to-mysql/insertHash.php on line 68
Fatal error: Call to a member function addToClasspath() on null in /usr/local/www/apache24/data/json-to-mysql/insertHash.php on line 68
I don't know why the value is NULL. the return data is fully populated and all files are found.
from json-to-mysql.
it looks like include.classloader.php isn't included in your script. Include that file and retry, does that fix it?
from json-to-mysql.
closing since no response
from json-to-mysql.
Related Issues (20)
- Goal 1 Notes: Create Table and Insert Data
- need to handle array (object) subdata HOT 3
- DIRECTORY_SEPARATOR HOT 1
- JSON-Data won't be processed completely (ignores sub-arrays)
- "search, update, index, and validate tables with JSON" - How? HOT 3
- Dont use PHP short tags (use <?php instead) HOT 1
- example.php does not work HOT 3
- Import nested JSON sub-arrays
- Goal 2: validate table structure
- need to handle array subdata HOT 3
- Composer package
- Example typo and bug in line 208 HOT 1
- Goal 3: Search table with JSON object
- Goal 4: Auto-Index
- handle custom primary key
- handle sub object and subsubobject data
- Validate it and remove any fields not on the table
- There is no DatabaseException class HOT 2
- DatabaseException class not found; also mysql_connect (and similar are dropped from PHP)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-to-mysql.