protected function discoverOrm($path, $prefix = '\\WakePHP\\ORM\\') { foreach (Daemon::glob($path) as $file) { $class = strstr(basename($file), '.', true); if ($class === 'Generic') { continue; } $prop = preg_replace_callback('~^[A-Z]+~', function ($m) { return strtolower($m[0]); }, $class); $class = $prefix . $class; if (!class_exists($class)) { continue; } $this->{$prop} =& $a; // trick ;-) unset($a); $this->{$prop} = new $class($this); } }