Questions tagged [cakephp]

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. It uses commonly known design patterns like MVC and ORM within the convention over configuration paradigm.

Filter by
Sorted by
Tagged with
1 vote
0 answers
36 views

Using exceptions inside CakePHP controller actions to simplify flow

I'm looking to simplify controller logic where multiple validation steps will either result in redirecting the browser or re-rendering the current view. Overall I'm looking to: Avoid excessive nested ...
0 votes
1 answer
51 views

Is using beforeFind() event in background to dynamic update SQL queries a good practice? [closed]

I have a Projects table, which I need to ORDER BY code column. But problem is ...
user avatar
4 votes
2 answers
2k views

CakePHP static pages (without entity) but with dynamic content

I have a few pages that is not connected with entities (index page, terms of use page, email page). Detailed description: In CakePHP, when you want to have a static page (such as index for example), ...
  • 265
4 votes
1 answer
1k views

Change the limit from CakePHP 3 Paginator by click in link inside an <option>

I'm using the CakePHP 3.0 to paginate some content, but I can't find a way to change the limit (user on browser choose the limit of content displayed on screen) using ...
  • 265
2 votes
1 answer
111 views

Using Cache::remember for banners and stores

I'm using Cache::remember to cache 3 results in my action, 2 in the same call to Cache::remember. It works, but I have 2 ...
  • 265
2 votes
0 answers
138 views

Controller method to add a product, stored across three database tables

I have some questions on how I can improve this "add" action method in a controller. Using a single form, the user can upload a product to be displayed on the site. A Product is composed of three ...
  • 265
1 vote
1 answer
1k views

CakePHP login action returning json

I have some questions on how I can improve this "add action" (method) in "controller": I'm using the add action only if post request. Is it correct? This ...
  • 265
4 votes
1 answer
140 views

CakePHP change 'miniMap' action and respect template

I have some questions on how I can improve this "action" (method) in "controller": My template has a navbar with dynamic content (if the user is logged in a special button appears, his name appears ...
  • 265
1 vote
1 answer
2k views

CakePHP image upload component

I would like to know how I can improve this CakePHP 3.0 Component (inside folder controller) 1st: to use external libs (stored on vendor folder) I'm using the <...
  • 265
0 votes
1 answer
83 views

Better way to validate user input in cakephp

I'm trying to find a way to make my code easeier to read, so i found that major part of the code is validation trough if, ifelse: ...
1 vote
1 answer
90 views

CakePHP Membership Management

I have a 'Membership' model that keeps track of a Member's membership. A membership can be updated by an admin (admin_add), or by the user (update). This code is working great, but I'd love some ...
  • 201
3 votes
2 answers
217 views

CakePHP view with interleaved PHP and HTML

It's CakePHP, though I'm more interested in what people think about the layout of the indentation, the mark-up, position of logic etc. Any feedback that relates to the subject of writing CakePHP ...
3 votes
2 answers
188 views

Admin method in CakePHP to add a venue to the database

I have a VenuesController and an EventsController. My venues controller has an admin_add ...
2 votes
1 answer
303 views

CakePHP Ticket Component

I have the following code that allows easy creation, pulling, and deletion of Tickets in a CakePHP application. ...
  • 345
2 votes
1 answer
401 views

How to optimize the pagination query?

This is completely optimization question, I have a pagination query like this: ...
  • 131
2 votes
1 answer
1k views

CakePHP return url validator

I have the following snippet of code that redirects a user to a specific page on successful login to the application. ...
  • 345
3 votes
0 answers
663 views

CakePHP Best strategy for getting HABTM data in multiple ways within the same tool

School HABTM AthleticDirector I am building a tool for assigning athletic directors (ADs) to schools. The tool has a school menu/filter which, when selected, shows a list of ADs already assigned to ...
2 votes
1 answer
2k views

Is there a better way to loop through records and call an api?

I have a CakePHP function here that gets info for a twitter screen_name from the twitter api and writes it to a mysql db. I'm just looking for feedback about other ways to accomplish this that might ...
  • 21
5 votes
1 answer
2k views

CakePHP 2.x Custom PagesController & Routing

I want to direct all requests that haven't got a valid controller action to my custom page controller. I.e. I want /pages/new & ...
  • 173
2 votes
2 answers
90 views

methods in the class so close in what they do

I have this class that has these two methods that are so closely related to the each other. I do not want to pass the flags so I kept them separate. I was wondering if there is a way to rewrite it so ...
  • 205
2 votes
2 answers
1k views

Flexible and modular CMS with user management in CakePHP

Please review my database design: I think it is quite self-explanatory, but to be absolutely clear: My goal is to make an application which has a super flexible user management (which is why the ...
  • 121
2 votes
3 answers
543 views

Using CakePHP models/controllers properly

I'd like to know if I'm doing this properly. Basically, I have 3 models: Student, Course, ...
  • 201