phalcon

Phalcon tutorial error PhalconException: TestController handler class cannot be loaded

前提是你 提交于 2019-12-05 16:58:36
I'm having some trouble getting Phalcon Tutorial 1 to work. In the end I've cloned the version of it on Github to make sure I'm not missing something; still getting the same behavior from that. Pointing the browser to localhost/test as shown in the tutorial gives: ` "PhalconException: TestController handler class cannot be loaded". Going to localhost/test.php , however, loads the "Hello!" test message correctly. Phalcon is shown in phpinfo() and get_loaded_extensions() . I get this behaviour even having cloned the tutorial from https://github.com/phalcon/tutorial . My guess is that apache is

Loading Models with INNER JOIN

荒凉一梦 提交于 2019-12-05 12:07:09
Let's say I have a Phalcon\Mvc\Model that I load using ::findFirst($id) . How can I swap in a custom query that would load the model row and do INNER JOIN on some other table? Thanks! I'm sure you can use the Query builder for simple joins like: <?php //Getting a whole set $robots = $this->modelsManager->createBuilder() ->from('Robots') ->join('RobotsParts') ->orderBy('Robots.name') ->getQuery() ->execute(); //Getting the first row $robots = $this->modelsManager->createBuilder() ->from('Robots') ->join('RobotsParts') ->orderBy('Robots.name') ->getQuery() ->getSingleResult(); Or PHQL example

phalcon系列(1) hello phalcon

一世执手 提交于 2019-12-05 10:05:09
接触和对比了了比较多的php框架,要说性能上,c类框架肯定比其他框架的性能要突出很多,就yaf跟phalcon而言,phalcon仅仅比yaf慢了1/10的性能,然而在组件上面却更加丰富。 Phalcon 是开源、全功能栈、使用 C 扩展编写、针对高性能优化的 PHP 框架。目前也已经兼容了 PHP7。开发者不需要学习和使用 C 语言的功能, 因为所有的功能都以 PHP 类的方式暴露出来,可以直接使用。 Phalcon 也是松耦合的,可以根据项目的需要任意使用其他对象。 官方的文档还算比较全面,不过我仍然想以从零开发的顺序,来编写一个文档,这个文档相比于官方文档可能不会涉及到所有的功能,但是会覆盖大部分常用功能,开发者还是应以官方文档为主 编译扩展无需多提,在开发的过程中,phalcon开发工具(Phalcon Developer Tools)可以快速生成代码快从而提高开发效率,该工具可以直接在 github 上下载。安装开发工具比较简单,直接按照官方手册就可以,需要注意的是,当你的电脑上存在多个php环境时,在执行phalcon时会寻找环境变量中的php所对应的php环境。 hello phalcon 当开发工具安装好之后,直接使用<code>phalcon project name</code>即可快速生成项目。 开发项目就以phalcon为例,配置虚拟域名为phal.com。

Can't call indexController's actions other than indexAction in Phalcon php

你离开我真会死。 提交于 2019-12-05 09:34:58
I have a simple project in my xampp/htdocs directory called phalcon and I have apache configured to point to that folder so that I can go to phalcon/ in my browser. The problem occurs when I try to open an index controller view other than index(default). For instance I have someAction in Index controller and in views/index I have some.phtml. If I go to phalcon/index/some I don't get the text from some.phtml outputed to the page. It's probably because it thinks as if I wan't to open IndexController->indexAction and pass some as a parameter. Would be grateful on any help provided to resolve this

Phalcon Router and Loader for subfolder structure getting bigger. How to set up?

馋奶兔 提交于 2019-12-05 08:40:47
I have a quite big project that I need to program. I used to code with CodeIgniter but since they stopped maintaining the framework, I decided to switch to another. I chose Phalcon framework. The folder structure of the application that I want to implement is next: app/ controllers/ admin/ users/ UsersController.php UserGroupsController.php dashboard/ system/ another_subfolder/ AnotherSubFolderController.php production/ settings/ SettingsController.php dashboard/ flow/ another_subfolder/ AnotherSubFolderController.php website1/ customers/ CustomersController.php CompaniesController.php another

How to retrieve similar tags data from db in phalcon?

怎甘沉沦 提交于 2019-12-04 21:27:19
I'm New in Phalcon. I decided to look at Phalcon php as an alternate php framework to Codeigniter. I'm Implementing a blog with tags. where first of im inserting tags value into a single column into the db. I follow tags plugin example from: https://github.com/mfiels/tagsly/blob/master/index.html its inserted multiple value into a single column like "php,jquery,asp,html,css". Now i just retrive the value from db to volt like this way: [controller] $bloger = $this->modelsManager->executeQuery("SELECT * FROM Blogs ORDER BY Blogs.datetime DESC"); $this->view->setVar('blogs', $bloger); [volt] <

PhalconPHP: How to set a Selected option in SELECT tag

心已入冬 提交于 2019-12-04 19:41:01
I want to set the <option> with the value coming from Db. So far I tried this but not working: $site_select = new Select('site_id', $this->_sites); Update Generating the select using DB columns as Timothy recommended: new Select('site_id', Sites::find(), array('using' => array('site_id', 'site_name'))); Setting the selected value of the given select: $site_select->setDefault('YOUR_DB_VALUE'); However there is another lovely trick about Phalcon forms. You could pass your DB entity to the form class and your form will be auto populated. Form: class YourFormClass extends Phalcon\Forms\Form {

How can I dynamically reference template file in volt template?

送分小仙女□ 提交于 2019-12-04 17:29:56
We know, {% include header.volt %} is reference file with name's header.volt . How can I dynamically reference template file in volt template? like this: {% include variable %} when variable equal footer.volt , theen the program will reference file with name's footer.volt when variable equal index.volt , then the program will reference file with name's index.volt ... thanks! I'm not sure if using variables in include will work, but you can always use partial() to include your template: {% set partialName = 'footer' %} {{ partial('partials/'~partialName) }} 来源: https://stackoverflow.com

Phalcon Multi-Module Routing

橙三吉。 提交于 2019-12-04 16:09:06
Im attempting to use the multi module configuration for the Phalcon PHP Framework. Im having an issue relating to the routing as one of my modules is inaccessible via url. It seems every time I try to access the defined modules uri, it tries to invoke the default modules namespace. Project\Module1\Controllers\Module2Controller handler class cannot be loaded The idea solution url.com/module1 => module1 url.com/moudle2 => module2 url.com => module1 In working to resolve this problem, I have verified that all paths and namespaces are correct. Ive combed through it with xdebug. Ive created my

phalcon异常处理

老子叫甜甜 提交于 2019-12-04 11:11:58
开发情况下 ,有异常直接抛出,方便调试。而在生产环境则不能暴露异常信息,此时需要对异常进行拦截并显示友好页面。 两种方式捕获异常: 通过dispatcher事件 通过一个简单的例子来展示一下: use Phalcon\Dispatcher; use Phalcon\Mvc\Dispatcher as MvcDispatcher; use Phalcon\Events\Manager as EventsManager; use Phalcon\Mvc\Dispatcher\Exception as DispatchException; //调度器 $di->setShared('dispatcher',function(){ // 创建一个事件管理 $eventsManager = new EventsManager(); // 附上一个侦听者 $eventsManager->attach("dispatch:beforeException", function ($event, $dispatcher, $exception) { //非开发模式,拦截异常并处理 if (!APP_DEBUG) { switch ($exception->getCode()) { //控制器或动作不存在的时候 case Dispatcher::EXCEPTION_HANDLER_NOT_FOUND: