phalcon

Phalcon: the order of 2 functions “initialize” and “onConstruct” in Controller and Model

佐手、 提交于 2019-11-30 22:01:13
I check myself and see that, the order of execution on Controller is "onConstruct" then "initialize", while on Model is "initialize" then "onConstruct". So why the order of execution of these methods is different on Controller and Model? Any idea? Besides the same name, initialize has different purposes in Models and Controllers: For Models initialize will mostly take care of initializing the model's metada(column mapping, model relationships, etc) that's why it's called before the constructor since all model metadata is stored statically in the model class (btw that's why initialize is called

phalcon-入门篇2(HelloWord与PhalconTools)

烂漫一生 提交于 2019-11-30 20:05:22
#phalcon-入门篇2(HelloWord与PhalconTools)# 本教程基于phalcon2.0.9版本 ##前言## 先在这里感谢各位phalcon技术爱好者,我们提供这样一个优秀的交流平台 最近刚好趁着春节放假前几天摸鱼的时间为大家带来今天的phalcon教程,今天教程的内容只要是把phalcon运行起来以及在开发过程中的phalconTools工具的,在之后涉及到有代码教程都会存放在**<<教程代码库>>**项目中大家可以下载查阅,下面我们开始今天的phalcon之路希望大家喜欢. 注:笔者水平有限,说的不正确的地方希望大家多多指正,一同交流技术 附上: 喵了个咪的博客: http://w-blog.cn 教程代码库: http://git.oschina.net/wenzhenxi/Phalcon-tutorial phalcon官网地址: https://phalconphp.com phalcon中文社区: http://www.iphalcon.cn/ ##1. Hello,Word!## 我们在学习很多语言框架刚开始接触的基本是都是**Hello,Word!**那么让我们来看看怎么在phalcon上输出Hello,Word! 我们先创建如下的目录结构在网站/目录 比如index.php的物理地址是 -> /phalcon/public/index.php

Friendly URLs in phalcon framwork is not working in Ubuntu [closed]

瘦欲@ 提交于 2019-11-30 20:02:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have tried these two codes. but It is not working. It need to access public folder too. http://docs.phalconphp.com/en/latest/reference/tutorial.html #www/tutorial/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </IfModule> #www/tutorial/public/

Phalcon: the order of 2 functions “initialize” and “onConstruct” in Controller and Model

怎甘沉沦 提交于 2019-11-30 17:38:54
问题 I check myself and see that, the order of execution on Controller is "onConstruct" then "initialize", while on Model is "initialize" then "onConstruct". So why the order of execution of these methods is different on Controller and Model? Any idea? 回答1: Besides the same name, initialize has different purposes in Models and Controllers: For Models initialize will mostly take care of initializing the model's metada(column mapping, model relationships, etc) that's why it's called before the

Namespaces with Phalcon

邮差的信 提交于 2019-11-30 09:52:14
All my controllers are under the namespace MyApp\Controllers so, as the documentation recommended, I've set my default namespace to it: $dispatcher->setDefaultNamespace('MyApp\Controllers'); But now I need to not only organize my controllers in folders but also namespace them and have friendly URLs like: /features/featureX/ and /wizards/featureX/ . So from that example I got MyApp\Controllers\Features\FeaturesX and MyApp\Controllers\Wizards\FeaturesX . I believe that they shouldn't be considered modules right? They're just some custom routes, but from routing documentation I can't tell how to:

How to run RAW SQL query in PhalconPHP

∥☆過路亽.° 提交于 2019-11-29 14:05:38
I try to get result from this query $sql = " SET @col = NULL; SET @sql = NULL; Select Group_Concat(Distinct Concat( 'SUM(CASE WHEN tbl.sdate = ''', colname, ''' THEN tbl.result ELSE NULL END) AS ''', colname,'''' ) ) Into @col From ( select concat(month(i.invdate),'.',year(i.invdate)) as colname from invoices as i where i.invtype = 1 and i.pid = 5 order by i.invdate ) As collst; SET @sql = CONCAT('SELECT tbl.wrkname,', @col, ' FROM ( Select wl.wgname As wrkname, Concat(Month(i.invdate),''.'',Year(i.invdate)) as sdate, Sum(id.qty * id.price) As result From invoices As i Join invoicedetails As

How to echo last query string in Phalcon?

£可爱£侵袭症+ 提交于 2019-11-29 12:31:39
I have worked a lot on codeigniter. In codeigniter , if there is need to get query string that is executed last, we can get it using: echo $this->db->last_query(); exit; But currently I am working on phalcon and I am just at beginner level in this framework. I am curious if there is a way to echo last query string in phalcon. Thank you. Using Raw Queries Let us have the following query: $phql = 'UPDATE `news` SET `category_id` = 5 WHERE `id` = :id'; $this->db->execute($phql, ['id' => 1]); We can get debug query info with the following methods: print_r($this->db->getSQLStatement()); UPDATE news

git用网盘做版本仓库,实现异地同步[待验证]

主宰稳场 提交于 2019-11-28 18:37:42
git在不用github这种远程仓库时,如何实现异地同步呢? 下班前提交代码,回家后同步代码继续开发并提交,第二天来公司继续…… 这里做个实验:用网盘的目录同步功能,我们打造一个"伪远程仓库"。 以金山快盘为例: 步骤1. 在本地找个目录作为"远程仓库",假设我们将 e:\kuaipan\phalcon 这个作为远程仓库,那么就将这个目录拖进快盘(U盘)里,然后再快盘客户端里右键该目录,开启同步。 步骤2. 创建裸版本库,根据git的规则,只有裸版本库才能接受git push/pull请求。所以我们这样操作(在cygwin虚拟环境下): <!-- lang: shell --> cd e:/kuaipan/phalcon git init --bare 步骤3. 创建本地的版本库,假设在 e:/workspace/phalcon_local 创建 <!-- lang: shell --> cd e:/workspace git clone e:/kuaipan/phalcon phalcon_local 步骤4. 开发,并提交 <!-- lang: shell --> cd e:/workspace/phalcon_local touch index.html git add . && git commit -m "add index.html" git push e:

How to run RAW SQL query in PhalconPHP

假装没事ソ 提交于 2019-11-28 07:37:31
问题 I try to get result from this query $sql = " SET @col = NULL; SET @sql = NULL; Select Group_Concat(Distinct Concat( 'SUM(CASE WHEN tbl.sdate = ''', colname, ''' THEN tbl.result ELSE NULL END) AS ''', colname,'''' ) ) Into @col From ( select concat(month(i.invdate),'.',year(i.invdate)) as colname from invoices as i where i.invtype = 1 and i.pid = 5 order by i.invdate ) As collst; SET @sql = CONCAT('SELECT tbl.wrkname,', @col, ' FROM ( Select wl.wgname As wrkname, Concat(Month(i.invdate),''.''

How to echo last query string in Phalcon?

那年仲夏 提交于 2019-11-28 06:22:18
问题 I have worked a lot on codeigniter. In codeigniter , if there is need to get query string that is executed last, we can get it using: echo $this->db->last_query(); exit; But currently I am working on phalcon and I am just at beginner level in this framework. I am curious if there is a way to echo last query string in phalcon. Thank you. 回答1: Using Raw Queries Let us have the following query: $phql = 'UPDATE `news` SET `category_id` = 5 WHERE `id` = :id'; $this->db->execute($phql, ['id' => 1])