phalcon

Phalcon pdo excpetion model first

懵懂的女人 提交于 2019-12-24 23:00:05
问题 I have problem with phalcon framework namely with models methods... As you know models has included methods find() and findFirst() I have generated model with phalcon-dev tools and now I am trying to do Model::find on it but I am getting an exception but dont know why... There is some more informations (e.g stacktrace) : http://exception.mateuszmarzecki.pl/ 回答1: You can try change methods in model file public static function find($parameters = array()) { return self::find($parameters); } 回答2:

How to add prefix to a controller in Phalcon PHP

半腔热情 提交于 2019-12-24 21:48:28
问题 I'm working on a website using Phalcon PHP that has an admin section mywebsite.com/admin I have created two different controller folders ( frontend-controllers & backend-controllers) an depending on the URL, I'm loading the right folder. I would like to add a prefix ( admin ) to the all backend controllers. mywebsite.com/admin/my-backend-controller-/myaction instead of mywebsite.com/my-backend-controller-/myaction I would like to know if it's possible and how to do it. 回答1: It is possible by

How to integrate javascript to .volt template engine of phalcon php

前提是你 提交于 2019-12-24 17:22:41
问题 I need to use http://blueimp.github.io/jQuery-File-Upload/ in my project which use framework PhalconPHP In order to do so, my .volt file need to contain a javascript code like this <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} //The problem begin here <tr class="template-upload fade"> <td> <span class="preview"></span> ........//Some similar code here </td> </tr> {% } %} </script> But the problem is {% and %} is .volt template syntax. When

Why does Phalcon 2 raise “undefined symbol: php_pdo_get_dbh_ce in Unknown on line 0” warning?

 ̄綄美尐妖づ 提交于 2019-12-24 16:33:22
问题 When I installed Phalcon 2.0.13 according to the https://docs.phalconphp.com/en/latest/reference/install.html description and I wanted to launch my test script then I got the following error (literally it is just a warning but it causes Phalcon not to be loaded which causes errors): { PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/phalcon.so' - /usr/lib/php/20131226/phalcon.so: undefined symbol: php_pdo_get_dbh_ce in Unknown on line 0 } What is this symptom

Phalcon PhP - Unknown filter

蓝咒 提交于 2019-12-24 05:45:11
问题 I'm trying to create custom filter for currency so I can use in my .volt templates. This is how I register the filter in my services.php $di->setShared('filter', function() { $filter = new \Phalcon\Filter(); $filter->add('currency', function ($value) { if($value === '') { return NULL; } else { return $value; // @todo implement the currency formatting } }); return $filter; }); Then when I try to use it in my .volt template, like this {{ quote['total_fees']|currency }} I get the following

google recaptcha returns false due to “invalid-input-secret”

本小妞迷上赌 提交于 2019-12-24 00:58:52
问题 I have installed the latest recaptcha from google but it always returns false upon post submit and always returning "invalid-input-secret" error even though the verification is always correct from the frontend view. What could be the reason on this. Btw I am testing everything in localhost xampp with phalcon framework. Here is the part where I check the captcha: protected function validate_data($post, $ip){ $validation = new Validation(); $validation->add( 'user_name', new PresenceOf( array(

Phalcon PHP - Form and model validation

谁说我不能喝 提交于 2019-12-23 17:51:40
问题 Phalcon support 2 validation components: Phalcon\Validation\Validator Phalcon\Mvc\Model\Validator I dont know how to use them in my situation. I have a registration form with: csrf username password repeat password email repeat email submit button I created a registration form as following: class RegistrationForm extends \Phalcon\Forms\Form { public function initialize() { $csrf = new \Phalcon\Forms\Element\Hidden('csrf'); $csrf->addValidator(new \Phalcon\Validation\Validator\Identical(array(

what's the difference between redirect and dispatch in phalcon?

做~自己de王妃 提交于 2019-12-23 12:23:37
问题 When I want to change to a page from another, I can find both $this->dispatcher->forward() and $this->response->redirect() . Both seem to work ok. What's the difference between them, and when should I use one over the other? 回答1: Broadly speaking, Redirect will do an http redirection (with the header location). It means that the browser of the client will change the page. It processes to a new routing (it can also be used to go to another website) and the actual script will end. Whereas

PHQL “WHERE xxx IN ()” can get only 1 data

大憨熊 提交于 2019-12-23 02:54:07
问题 I'm creating a RESTful API with Phalcon. I want to get some data from "Shop" table by IDs. PHP code: $app->post('/api/shops/search', function () use ($app) { $ids_shop = $app->request->getJsonRawBody(); $ids = array(); foreach($ids_shop as $id){ $ids[] = $id->id_shop; } $ids_str = implode(",", $ids); $shops = getShopsData($ids_str, $app); return $shops; }); function getShopsData($ids_shop, $app) { $phql = "SELECT * FROM Shops WHERE Shops.id IN ( :ids: )"; $shops = $app->modelsManager-

PhalconPHP database Joins In ORM

家住魔仙堡 提交于 2019-12-23 01:59:14
问题 I'm having difficulty understanding joins in Phalcon. I'm not sure if I even need to use joins or if related tables are somehow mapped automatically. I've always avoided working with ORMs in the past, so the concept is all a bit new to me! I have two tables - pages and sections class Pages extends \Phalcon\Mvc\Model { public $page_id; public $page_section_id; public $page_title; public $page_url; public $page_description; public $page_tags; public $page_content; public $page_time; public