cakephp

Self-Referential ManyToMany Convention in CakePHP

I have an existing data model where I can rename things freely to match CakePHP's conventions. I have a type of graph node, where a node can have an arbitrary number of child nodes and an arbitrary number of parent nodes (uni-directional relationships). Here's the table of nodes, following CakePHP's conventions: Table: nodes Column: no...

Most concise and complete Recursive Association Support in CakePHP?

I'm currently mucking about with CakePHP, deciding if I'll use it in an upcoming web application. The problem is, I've got several tables which at some point share relevant data with each other. If I were to write all the code myself I would use an SQL query using rather a lot of different joins and subqueries. But from what I understan...

Checking the status of my PHP beanstalkd background processes

I have a website written in PHP (CakePHP) where certain resource intensive tasks are handled by a background process. This is done through the Beanstalkd message queue. I need some way to retrieve the status of that background process so I can monitor it with Monit. The background process is a CakePHP Shell (just a PHP CLI script) that ...

Associating a model twice, CakePHP

I have the following scheme: My site is a trivia game, so every Question "hasMany" Answers, but a Question also "hasOne" correct Answer that is also represented by the Answer model. I have yet to test this, but my programmer's instinct tells me that the retrieved array will be kind of redundant and it will not separate the correct Answer...

How long will my current session still last?

How can I figure out when my current session will run out? Is the session timeout updated on every request? ...

Sending email on multi-step (2 page) form

I have a bit of a problem i am trying to sort out. I have 2-step form page 1 (mandatory): fill in your personal details page 2 (optional): complete your inventory At the moment the form sends 2 emails to the recipient, 1 after the first page is completed, and one if the second page is completed. The second email is identical to the f...

Unit testing in CakePHP?

I'm wondering, how do you guys unit-test in CakePHP? How do you incorporate tests in projects? What parts of a project do you test? How do you decide which parts gets to be unit-tested? Do you guys still get to finish the job before the deadline? I'd really appreciate your answers. Thanks in advance! ...

Why does CakePHP bork when I use jquery to modify values of hidden inputs?

I'm using cakephp to build a survey and want to use javascript (specifically jquery as it's used elsewhere) to modify some hidden inputs. To be clear, commenting out the offending lines of jquery allows cake to do it's thing properly. But when the values are modified with jquery, this happens: To take just one of the hidden inputs in...

CakePHP add/edit form is working, except for foreign key references

I have a cakephp object (SecurityPerson) that has a few foreign key relationships to other objects. Here's the add/edit view code that's generating the pulldowns for the foriegn-key references: echo $form->input('ContractNumber'); echo $form->input('Location'); Here's the references to these objects in the model: var $belongsTo = ar...

Feasibility of HAML + PHP/CakePHP

Is anyone using a HAML implementation for PHP like phpHaml or pHAML? Both projects have seen no activity for about 2 years, and both are < 1.0. Is it feasible/wise to use HAML for a large PHP application, or is it too immature? Does anybody have experience with Chaml for CakePHP? I played around with it, and it seems to be really picky ...

Dropdown list for newer version of cakephp

hi all, am a newbie in cakephp. i need to get values from the DB & populate it in the view. from all the forums i have visited, i came to know that generateList() has been deprecated. if so, what do i need to use. where shud i place these codes.could any of u guys explain me the code part. ...

Should I upgrade my project from Cake 1.2.5 to CakePHP 1.3.0?

My web project (to be launched in a few months) is currently using CakePHP 1.2.5 / PHP 5.1.6 / MySQL 5.0.77. From a performance point of view, is it a good idea to upgrade to 1.3? Will it make it easier to later upgrade to the (PHP5-only) CakePHP 2? ...

Cakephp Shopping Cart

Hi all, I was wondering which php based carts will be the easiest to integrate with cakephp. I've heard about bakesale but I have no info on it whether is up to par with magento, cubecart or other carts out there. It's been a while since they have updated info on bakesale (August 2008). So if anyone has any info how reliable and secur...

Manually Building a Tree in CakePHP

I'm currently working on building an application in CakePHP. There's a quite extensive existing data set that's conceptually a tree, but wasn't previously stored as one. What I mean by that, is there's no real relationship defined in the data. The problem I'm having is getting it to work correctly with the CakePHP tree behaviour. B...

Pagination Helper Customizations (styling)

I'm using the PaginationHelper and in my view I need to set the class for the current page's link to "current number" and I also need to get rid of the | characters before and after the pages. I can set the overall class but not the current page class using: <?php echo $paginator->numbers(array('before'=>'','after'=>'','class'=>'number...

Convert SQL query into CakePHP pagination query

How can I use the following query: SELECT * FROM `laps` WHERE `id` = ( SELECT `id` FROM `laps` AS `alt` WHERE `alt`.`user_id` = `laps`.`user_id` ORDER BY `lap_time` ASC LIMIT 1 ) ORDER BY `lap_time` ASC in my CakePHP app and paginate the results? ...

Auto converting data from a datetime field to a specific format in CakePHP

Hi is possible automatically to format (using date()) all data from a datetime field in CakePHP? I'm thinking about using a callback function in the model but I don't know if I could filter fields coming from a datetime type. Thanks in advance! ...

Writing PHP5 only code for CakePHP 1.2

Given that CakePHP 1.2 supports both PHP 4 and 5, what's the politics on writing plug-ins, helpers, components etc to be shared with the public that only run in PHP5? I want to be better my own code, properly marking functions as protected or private which is only possible in PHP5, but at the same time make reusable code that benefits o...

Custom Query Pagination Cakephp

I have a custom query in my controller and I would like to implement the custom query pagination I found on cakephp.org but their example is not similar to mine. Can someone please help me paginate this result in my view: $cars = $this->Car->query(" select Car.id, Car.make, Car.model, Car.year, Car.description, CarImage.thumbnail ...

Is it possible to detect the field type of a MySQL field in CakePHP?

Hi, I'm planning on converting all the datetime data from a MySQL database to the format date('d-M-Y'). I'm thinking of doing it in the afterFind() callback but I'm wondering, how do detect the field type in CakePHP so I can create conditional statements? Thanks in advance! ...