cakephp

CakePHP hasAndBelogsToMany using save() vs. saveAll()

Heyall, I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table (Entity) that have it's id on several other tables as the Foreign Key entity_id Some tables are one to one relations (Like a Company is one Entity) and some are one to many (...

Why doesnt paginator remember my custom parameters when I go to page 2?

When using the paginator helper in cakephp views, it doesnt remember parts of the url that are custom for my useage. For example: http://example.org/users/index/moderators/page:2/sort:name/dir:asc here moderators is a parameter that helps me filter by that type. But pressing a paginator link will not include this link. ...

When deleting hasOne or hasMany associations, should the foreignKey be set to NULL?

Given : Group hasMany Persons but the relationship is independent (ie. Persons can exist without belonging to a Group), should the foreign key in the persons table (ie group_id) be set to 0 (or NULL) when deleting a group? If you do not, the person will try to belong to a group that does't exist. The reason I ask is that this is...

How do I send arrays between views in CakePHP

Hello, I am not sure if I formulated the question right, but still ... I have a view that shows a flash embed and this flash take as parameter a /controller/action URL that generates a XML. I nee to send, from this view, an array to the XML generator action. How is the best way ? Is there some helper->set() method like or I have to cre...

PHP Array, key without an assigned value

I am currently plowing my way through IBM's tutorial on CakePHP At one point I run into this snippet of code: <?php class Dealer extends AppModel { var $name = 'Dealer'; var $hasMany = array ('Product' => array( 'className' => 'Product', 'conditions'=>, // is this allowed? 'order'=>, // same thing here 'foreignKey'=>'dealer_id') ); } ?...

code igniter / cakephp and ms access

I'm trying to use Microsoft Access as the db for a demo project that I'm thinking of doing in either Code Igniter or CakePHP. Ignoring the possibly folly of using MS Access, I haven't been able to figure out precisely how the connection string corresponds to the frameworks' db settings. In straight php, I can use this code to connect to ...

Is it correct that Model::$AssociatedModel is not set if AssociatedModel::$useTable is false?

Basically I have two models that are associated, but im building them to work both with and without an existing database (basically they degrade by not remembering settings). I can do $this->AssociatedModel->find() in my models when they are using a table, but for some reason I get Undefined property: Model::$AssociatedModel [APP\plug...

CakePHP - How do i set the page title to an item name?

OK, so I'm trying to teach myself the CakePHP framework, and I'm trying to knock up a simple demo app for myself. I have the controllers, views and models all set up and working, but I want to do something slightly more than the basic online help shows. I have a guitars_controller.php file as follows... <?php class GuitarsController e...

Complex Find in Cake PHP

Hey all I'm hoping someone has enough experience with Cake PHP to make this work. I'm working on something that at the moment could affectionately be called a twitter clone. Essentially I have a set up like this. Users have many friends. This is a many to many relationship to the user table. It is stored in a link tabled called frien...

How to pass querystring to testAction in CakePHP 1.2?

In CakePHP putting a querystring in the url doesn't cause it to be automatically parsed and split like it normally is when the controller is directly invoked. For example: $this->testAction('/testing/post?company=utCompany', array('return' => 'vars')) ; will result in: [url] => /testing/post?company=utCompany While invoking the u...

Cakephp redirect

Does anybody knows how to redirect parent page from an ajax call. I made an ajax call to the server and from controller function that handles the call I whant to go to another page. Usually this function updates an element from current page , but in some cases I want to redirect browser to another page... ...

Validate field in model with no table (CakePHP)

I've got a model in CakePHP that doesn't have a table, called Upload. I've got a validation in this Model for a field called source_id. I've got a form that builds a nice looking $this-data, giving me a well formated set, including: $this->data['Upload']['source_id'] However, the validation rule I have set doesn't seem to run at all....

Phalanger with cakephp

Has anybody been able to use CakePHP in Visual Studio using Phalanger ...

Validate combobox (selector) in cakephp

I am a Cake PHP novice. I want to edit the table "Issue". This table contains a field "priority_id" related to another table called "Priority" by an foreign key. This table contains three values "Severe", "Disaster", "ToDo". User can select the priority using a combobox (input select). The priorities are loaded like this: $priorities...

tableA HABTM tableA - cakePHP DB Design Question

I have the need to create the functionality to allow my registered users to associate themselves with other uses and create a family. My database tables look something like this: db.persons - (Bob, Jane, Timmy, etc) id name email db.persons_persons id person__id_parent person_id_child relationtype_id db.relationtypes - (spouse, ...

Linking to a file (e.g. PDF) within a CakePHP view.

I'd like to link to some PDFs in one of my controller views. What's the best practice for accomplishing this? The CakePHP webroot folder contains a ./files/ subfolder, I am confounded by trying to link to it without using "magic" pathnames in my href (e.g. "/path/to/my/webroot/files/myfile.pdf"). What are my options? EDIT: I didn't ade...

CakePHP - Parameters?

I'm new to CakePHP but I've been though their FAQs and guides to no avail. This is so simple that I just must not be thinking straight: How can I access a parameter sent through the URL within my view files? Example: http://example.com/view/6 How would I take that parameter ("6") and cycle it through the controller to another view p...

Multiple Login pages Cake PHP

Hey all, I'm trying to get authentication working to my liking in a cake php app and running into a snag. I want to let the user login from either the home page or from a dedicated login page. I'm using the Auth component to manage login and right now the login itself works. I am submitting the form on the home page to /Users/Login a...

CakePHP and Flex - Can they integrate and if so is it ugly or nice?

I'm looking at a new project and we are wanting to use Flex (to provide the easy integration with AIR and provide a desktop app for our project). How easy does CakePHP play with Flex or is there a better PHP framework to use with Flex, or should we use none? ...

Cakephp, change provinces combo and cities combo

Hi All I am a newbie in cakephp; I have two combos, provinces and cities with cakephp. I would like to change cities value when the province combo value changes. Here is my code <div class="cities form"> <?php $v = $ajax->remoteFunction(array('url' => '/cities/','update' => 'divcity')); print $form-> input('Province.province_id...