关于使用Phalcon [PHQL]:Model could not be loaded
2017-09-27 20:43
465 查看
出错代码:
报错如下
主要原因是phalcon默认只识别单模块,由于我需要多模块开发,所以使用
基于:https://github.com/KevinJay/PhalconCMS
博主已经将模块拆开,我在上面进行DIY框架改造
结果如图:
感谢:
http://www.mamicode.com/info-detail-2015655.html
https://github.com/KevinJay/PhalconCMS
public function indexAction(){ //在这里想要使用PHQL只能单模块才能识别 $query = $this->modelsManager->createQuery("SELECT * FROM UserModel"); try{ $result = $query->execute(); }catch (Exception $e){ echo $e->getMessage(); } var_dump($result->toArray());exit; return $this->get_repository("User")->getUser(); }
报错如下
主要原因是phalcon默认只识别单模块,由于我需要多模块开发,所以使用
基于:https://github.com/KevinJay/PhalconCMS
博主已经将模块拆开,我在上面进行DIY框架改造
phalcon模型管理器在多模块下需要主动挂载注册,才能被当前模块识别:
public function indexAction(){ //如这样注册是可以识别挂载点的,那么phalcon模型管理器可以找到该模块下的模型 //所以使用Di注入modelsManager服务时,注意注册相应模块下模型挂载点即可 $this->modelsManager->registerNamespaceAlias("Frontend","Marser\App\Frontend\Models"); $query = $this->modelsManager->createQuery("SELECT * FROM Frontend:UserModel"); try{ $result = $query->execute(); }catch (Exception $e){ echo $e->getMessage(); } var_dump($result->toArray()); }
结果如图:
感谢:
http://www.mamicode.com/info-detail-2015655.html
https://github.com/KevinJay/PhalconCMS
相关文章推荐
- 关于The MBean class could not be loaded by the default loader repository的解决方法
- 关于Servlet class org.apache.jasper.servlet.JspServlet for servlet debugjsp could not be loaded
- 关于“File setupdd.sys could not be loaded”错误
- 关于在xcode中使用Versions时,比较文件出现The File Merge application could not be located. 解决方法
- 关于HIS客户端程序登陆后提示“the oracle library OCI.DLL could not be loaded”
- 关于在xcode中使用Versions时,比较文件出现The File Merge application could not be located. 解决方法
- pb开发的客户端,使用oracle 9i客户端 提示oci.dll could not be loaded
- cocos2d-js 使用http时 出现 Response failed, error buffer: The resource could not be loaded because the Ap
- The java class could not be loaded. java.lang.UnsupportedClassVersionError
- 解决 关于Silverlight使用WCF时抛出异常 Could not find default endpoint element that references contract...
- the session file could not be loaded
- VS同步调试时出现"bootstrap could not be loaded"
- 关于myeclipse启动错误的解决方法 com.genuitec.myeclipse.product.ide could not be found
- Extension GL_VERSION_1_2 could not be loaded.
- SharePoint 2010 BDC Model项目部署出错:“The default web application could not be determined.”
- 重装系统的问题file setupdd.sys could not be loaded
- %CommonDir%\publish.tlb could not be loaded
- 使用squid代理时出现“The requested URL could not be retrieved”
- 关于使用FileUpload控件报 Could not find a part of the path "X\1.jpg"
- WCF:The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed.