function _createDataSet() { if (!$this->class_path) { throw new lmbException('Class path is not defined!'); } $class_path = new lmbClassPath($this->class_path); $class_path->import(); $class_name = $class_path->getClassName(); if (is_null($this->record_id) && is_null($this->record_ids)) { if (!$this->find) { return lmbActiveRecord::find($class_name); } else { $method = 'find' . lmb_camel_case($this->find); $callback = array($class_name, $method); if (!is_callable($callback)) { throw new lmbException('Active record of class "' . $class_name . '" does not support method "' . $method . '"'); } return call_user_func_array($callback, $this->find_params); } } if ($this->record_id) { try { if ($this->find) { $method = 'find' . lmb_camel_case($this->find); $callback = array($class_name, $method); if (!is_callable($callback)) { throw new lmbException('Active record of class "' . $class_name . '" does not support method "' . $method . '"'); } $record = call_user_func_array($callback, array($this->record_id)); } else { $record = lmbActiveRecord::findById($class_name, $this->record_id); } } catch (lmbARNotFoundException $e) { $record = array(); } return $this->_singleItemCollection($record); } elseif ($this->record_ids) { return lmbActiveRecord::findByIds($class_name, $this->record_ids); } return new lmbCollection(); }
function testImportShortNamedClass() { file_put_contents(LIMB_VAR_DIR . '/FooBarZooTest3.class.php', "<?php\n class FooBarZooTest3{}\n ?>"); require_once LIMB_VAR_DIR . '/FooBarZooTest3.class.php'; $class_path = new lmbClassPath('FooBarZooTest3'); $class_path->import(); unlink(LIMB_VAR_DIR . '/FooBarZooTest3.class.php'); }