cakephp-2.1

How to give string in the url in RESTful api in Cakephp?

泪湿孤枕 提交于 2019-12-10 18:05:18
问题 As per the this Cakephp CookBook the simple setup for RESTful api : HTTP Method URL.method Controller action invoked GET /recipes*.method* RecipesController::index() GET /recipes/123.method RecipesController::view(123) POST /recipes*.method* RecipesController::add() PUT /recipes/123*.method* RecipesController::edit(123) DELETE /recipes/123.method RecipesController::delete(123) POST /recipes/123*.method* RecipesController::edit(123) here all the URL parameters are numeric i.e 123. When I tried

CakePHP 2.1 Auth->login() not working, but adding user does

旧时模样 提交于 2019-12-10 17:26:11
问题 I've searched through many posts on stackoverflow for an answer, and prehaps I'm just overlooking something, but I can't seem to get $this->Auth->login() to work. I've tried many different suggestions from other posts. I will try to be as thorough as possible when describing other methods I've tried. I do have adding a user working. The MD5 hashing is working correctly. I hashed a password and then checked it using miracle salad md5 http://www.miraclesalad.com/webtools/md5.php I do not use a

ConnectionManager getDataSource undefined method

风流意气都作罢 提交于 2019-12-10 12:01:18
问题 Using cakephp 2.3.8 I am attempting to setup a connection to a custom couchbase datasource I have made within another datasource. The datasource I am attempting to load functions properly on the rest of the site when being loaded via a model. I want to use the connection manager to load this datasource. This is what I have so far: database.php file: public $queriesCB = array( 'datasource' => 'CouchbaseSource', 'username' => 'queries', 'password' => '', 'bucket' => 'queries', 'prefix' => 'q_',

CakePHP One Core, One App, One Database, Multiple Domains & Multiple Themes

ⅰ亾dé卋堺 提交于 2019-12-10 11:23:06
问题 I am a new addition to the world of CakePHP, and have only created / followed the blog tutorial, and extended it with users. I have been reading the 2.0 book to become more familiar with the framework. Before I commit to moving to CakePHP, I have a couple of questions. Currently, I develop a multi domain / multi theme CMS system which is procedural PHP. By doing this I have been able to create a single system on a single database with multiple domains and themes. I take the $_SERVER['SERVER

Cakephp - HABTM record won't delete with unique set to true

淺唱寂寞╮ 提交于 2019-12-10 10:58:44
问题 CakePHP has the default of unique set to true, I've coded it just to make sure as well. So I have the following DB structure: Item HABTM Action, with unique set to true. The situation is as followed: Deletion works fine upon save when I delete 1 or more records, if ATLEAST 1 record stays 'alive' Deletion doesn't work upon save when I delete all records ( or 1 record, if that's the only one). It simply keeps all existing records that way. I've made sure with debug($this->request->data) right

CakePHP: How to use Containable for nested HABTM models

早过忘川 提交于 2019-12-10 10:42:27
问题 I'm trying to use Containable to return a model with several of its associated models (and those arrays of data). The models deal with test results. Here are the models: Models: Question : has and belongs to many Category Category : has and belongs to many Question Attempt : has many AttemptedQuestions AttemptedQuestion : belongs to Question I want to return an Attempt with all of it's AttemptedQuestions and their corresponding Quesions + Category So basically, the relationships map like this

right way to install cakephp-scripts for v2.2.1?

梦想的初衷 提交于 2019-12-10 06:30:00
问题 I am using ubuntu and as per instruction I use 'apt-get isntall cakephp-scripts' I am using latest stable release of cake v 2.2.1, but when I run cake bake -app , I always get console for v1.3.2 Why do I get CakePHP v1.3.2 Console on cakephp v 2.2.1 回答1: As the others already pointed out, CakePHP from the repositories is v1.3.2 which doesn't work with your 2.1. After uninstalling ( sudo apt-get remove cakephp-scripts ) it, do the following: Download CakePHP 2.1 and extract it somewhere

cakephp loses sessions when using safari and internet explorer

只愿长相守 提交于 2019-12-09 22:56:43
问题 I'm using ajax and sessions for a cakephp project but it looks like the session gets lost when I use either safari or IE. I've followed the solutions in Sessions in IE and cakephp 1.3 not working properly when saving via AJAX I've set my core.php files to the settings below. Configure::write('Session.checkAgent', false); Configure::write('Security.level', 'low'); I've already upgraded my cake version to 2.3.0 and I'm still having the same issues. Please help? Thank you. Here are my pastebins

What can I put in _schema Model field to build a custom tableless Model?

守給你的承諾、 提交于 2019-12-08 13:57:18
问题 I already read this "trick" in the cookbook: http://book.cakephp.org/2.0/en/models/model-attributes.html#usetable Now I would like to build a custom schema for my model, but there isn't the format for this array. For example, I don't know what should I put for a bool type: "boolean" or "bool"? If I want to obtain a "select box" when I use $this->Form->input, what type should I put? Should I create a hasMany relationship (with 2 tableless models)? 回答1: the docs are here: http://book.cakephp

get extension of uploaded file in cake php

删除回忆录丶 提交于 2019-12-08 11:08:26
问题 I am using cakephp 2.1 and i am trying to upload files and how can i retrive the extension of the file. Database/users Id Auto_Increment username file_name Controller/UsersController.php public function register(){ if ($this->request->is('post')){ $filename = $this->data['User']['file_name']['name']; //$temp_ext = $this->data['User']['resume_file']['ext']; $this->Session->setFlash('Extension : ' . $temp_ext); } } When tried the above code, to get extension. it only gives single letters like L