cakephp-2.0

CakePHP - authentication component, using a different table name and column name

时光总嘲笑我的痴心妄想 提交于 2019-12-04 02:21:55
问题 Just for organization sake, I wanted to use a different table for the authentication component to check, but it doesn't quite work. While I can initially state: $this->Auth->userModel = "CoreUsers" plus set the loginAction to my proper MVC works to look at that table just to confirm it's there, but the login doesn't work, it only keeps returning an incorrect password. Something happens in the authentication component; I can't tell what makes it fail. When I rename my table to "Users", it

CakePHP 2.0 - Use MySQL ENUM field with form helper to create Select Input

跟風遠走 提交于 2019-12-04 01:49:15
问题 I've been researching a bit and I found that CakePHP's form helper doesn't interpret ENUM fields correctly, so it simply outputs a text input. I found a post that suggested to use a helper for that specific purpose. Does anybody know a better way to achieve this? Or if CakePHP devs intend to correct this some day? Thanks for reading! 回答1: Below is one of the helper extention. App::uses('FormHelper', 'View/Helper'); /** * APP/View/Helper/MySqlEnumFormHelper.php * It extends FormHelper to

How do I get a list of all functions inside a controller in cakephp

不问归期 提交于 2019-12-04 01:26:23
I needed to select a controller in CakePHP 2.4 and display all the functions written in it. I found how to list controllers from this question & answer thread on Stack Overflow but what I need now is given a specific controller I need to get the list of all functions it contains. Here what i have done public function getControllerList() { $controllerClasses = App::objects('controller'); pr($controllerClasses); foreach($controllerClasses as $controller) { $actions = get_class_methods($controller); echo '<br/>';echo '<br/>'; pr($actions); } } pr($controllerClasses); gives me list of controllers

Adaptive images CakePHP htaccess

元气小坏坏 提交于 2019-12-03 19:46:07
问题 I'm trying to get Matt Wilcox adaptive images to work with CakePHP without success. http://adaptive-images.com/ CakePHP comes with three .htaccess files of it's own. In in / , one in /app/ and one in /app/webroot/ I need to get these four files to work together in such a way that image-requests are sent to the file adaptive-images.php that I've put in the root. This is the htaccess from adaptive-images <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On # Adaptive-Images -------

CakePHP: Creating new HABTM row instead updates other

╄→尐↘猪︶ㄣ 提交于 2019-12-03 17:09:07
I have two models with a HABTM (Has and belongs to many) relationship: Qsets and Questions. The following action (in QsetsController.php) should result in a new row in the qsets_questions table, with the new question appearing in the new qset. But instead it updates existing rows, resulting in that question begin taken from a previous qset and added to the new one. What am I doing wrong? public function admin_add_question( $qset_id, $question_id) { //find the qset... $qset = $this->Qset->find('first', array('id'=>$qset_id)); $this->Qset->QsetsQuestion->create(); $data = array( "Qset"=> array (

CakePHP: posted file data not included in request->data

杀马特。学长 韩版系。学妹 提交于 2019-12-03 17:03:08
I'm trying to upload a file to 3rd party endpoint, but I can't post the file directly from my form because the API requires an api_key which I can't expose to the end user. Therefore, my plan was to point the form to a controller/action and post the data from there. However, when I debug($this->request->data) from inside the controller, the file data is missing. The form on the view: echo $this->Form->create('Media', array('type'=>"file", 'url'=>array('controller'=>'media', 'action'=>'upload') ) ); echo $this->Form->input('name', array("name"=>"name") ); echo $this->Form->input('file', array(

CakePHP passing arguments in Controller::redirect

感情迁移 提交于 2019-12-03 16:17:22
In controller actions to make redirect I use this: $this->redirect(array('controller' => 'tools', 'action' => 'index')); or this $this->redirect('/tools/index'); And when I pass data with redirect I use this: $this->redirect('tools/index/?myArgument=12'); But I couldn't find how to pass "myargument" by "this-redirect-array" notation. I don't want to use this because some routing issues: $this->redirect(array('controller' => 'tools', 'action' => 'index', "myArgument")); I need something like this: $this->redirect(array('controller' => 'tools', 'action' => 'index', "?myArgument=12")); Cake does

FULL TEXT SEARCH in cakephp ? any example

烂漫一生 提交于 2019-12-03 13:24:28
I am using ordinary search functionality in my business controller . but now need to implement FULL TEXT SEARCH with paginate can any one give idea or sample ? I am using MySQL with MyISAM tabes and this my table structure, fields marked bold are need to use in search CREATE TABLE IF NOT EXISTS businesses ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, created date NOT NULL, modified datetime NOT NULL, user_id bigint(20) NOT NULL, slug varchar(255) NOT NULL, **`name` varchar(255) NOT NULL,** **street_name varchar(255) DEFAULT NULL,** **shopping_center varchar(255) DEFAULT NULL,** state_id

CakePHP 2.1.x - Run a query without any models in AppController

南楼画角 提交于 2019-12-03 11:08:44
问题 I am trying to run a query in AppController on a table that has no Model associated with it. I don't want to use a Model cause this query would fire on every request and I guess using a Model would make it a bit slower. I found out in one forum that this can be achieved with the following code in CakePHP 1.3 $db = ConnectionManager::getInstance(); $conn = $db->getDataSource('default'); $conn->rawQuery($some_sql); But this is not working in CakePHP 2.1.3. Any help would be appreciated. Thanks

Migrating from Cake 1.3 to 2.0 and beyond - migrate existing, or only use for new?

半城伤御伤魂 提交于 2019-12-03 11:07:18
I'm nearling completion of my first CakePHP-driven website and just saw they're already working on CakePHP 2.0 (not the stable release yet). My questions: Is it incredibly time consuming to move to a new version of CakePHP (when it becomes the "stable" release that is)? I know they have migration guides, but - I've never used a framework before, so I've never had to migrate anything. Do you migrate your code for existing projects, or leave it as is and use the new stable version for future projects only? Where can I find what version of CakePHP I currently have installed? I've looked at the