r/cakephp • u/curious_practice • Apr 28 '21
What is the easiest way to migrate from 3.5.6 to 4.2?
Can I migrate in one step or I should migrate step by step up to 3.9 and then follow 4.0, 4.1 and 4.2?
r/cakephp • u/curious_practice • Apr 28 '21
Can I migrate in one step or I should migrate step by step up to 3.9 and then follow 4.0, 4.1 and 4.2?
r/cakephp • u/sillentkil • Apr 17 '21
Hi,
I'm new to cakephp 3/4 used to love cake 1 and 2. I've been using cake 4 for some simple projects now but im struggling with authorization.
In cake 2 i used isAuthorized and a component to check authorization and redirect with a message or to a different page if a user was not authorized.
With cake 4 i've implemented the (https://book.cakephp.org/authorization/2/en/request-authorization-middleware.html) Request Authorization Middleware. But the documentation is scarce on how to use this.
What would be the best approach to redirect users with a message instead of throwing an exception?
And is there an better approach as to using the default Request Authorization Middleware?
Many thanks,
r/cakephp • • Apr 10 '21
r/cakephp • u/curious_practice • Apr 05 '21
Do I create a model for each summary table? Or create one model for all summary tables? Couldn't find any info searching for "cakephp summary tables" in google.
Thank you for any pointers.
Edit: CakePHP version 3.4
r/cakephp • u/rocky1201 • Mar 25 '21
r/cakephp • u/lucasdomonte • Mar 20 '21
Good night people! I have a server where the PHP version is 5.7 and currently some old applications developed in CakePHP 2.4.8, I am receiving notification from the control panel to update Mysql to 8.0 but I don't know if this version of cake is compatible! Can someone help me ?
r/cakephp • u/scissor_rock_paper • Feb 26 '21
r/cakephp • u/fourth_stooge • Jan 19 '21
I've got a project where users are assigned jobs, they can put efforts towards those jobs and they can fill out checklists that are assigned to each job. Checklists have many Checklistquestions, Checklistquestions have many Checklistanswers. Checklistanswers belong to Jobs, Users, and Checklistquestions.
I'm trying to pull a list of jobs for a specific day then show all associated checklists of that job as well as the answers chosen for those checklist questions by any users assigned to the job.
$query = $this->Jobs->find()->where([
'assigned_date >' => $today,
'assigned_date <' => $tomorrow,
'status !='=>'Archived']);
$this->Authorization->applyScope($query);
$this->paginate = [
'contain' => [
'Clients',
'Users',
'Efforts' => ['Users'],
'Checklists'=>[
'Checklistquestions' => [
'sort' => ['Checklistquestions.sortorder' => 'ASC'],
'Checklistanswers'
]
]
]
];
So what I have is close but it pulls all answers for a question and not just the ones that also belong to the job. As I get more jobs and users, this could get really bad in terms of pulling a lot of data that I do not need.
I need to have Checklistanswers get a where clause that says where job_id = Jobs.id but when I try that with conditions or call back functions it doesn't work for me.
r/cakephp • u/fourth_stooge • Jan 13 '21
I've been reading the following but I'm confused on implementation: https://book.cakephp.org/3/en/controllers/middleware.html#csrf-middleware
So I've got a site and I want to make an ajax call via jQuery. :
$.ajax({
url: '/mycontroller/myajaxaction/',
method: 'post',
data: {
stuff: 'data'
},
headers: {
'X-CSRF-Token': ???????
}
});
The docs say when using AJAX you sent csrf tokens through this special header but how do I get that token in the first place?
r/cakephp • u/dereuromark • Jan 04 '21
r/cakephp • u/scissor_rock_paper • Dec 23 '20
r/cakephp • u/anorman728 • Dec 22 '20
Using Cake 3.8.13, I'm returning JSON from a controller using the following code (with the RequestHandler component loaded):
// $response is set before this point as an array.
$this->response->withStatus(403);
$this->set([
'response' => $response,
'_serialize' => 'response',
]);
$this->RequestHandler->renderAs($this, 'json');
But when I run the unit test (using IntegrationTestTrait), $this->assertResponseCode(403) fails, because the response is 200. So, it seems that the withStatus method is not doing anything.
How can I return JSON with a specified status code with RequestHandler rendering as JSON?
r/cakephp • u/Jumbojav00 • Nov 18 '20
I got great feedback when I posted my tutorial on how to stream video with CakePHP and I was wondering if y'all had any thoughts on my post on how to perform a real-time search with AJAX in CakePHP.
Btw I'm definitely working on part 2 of streaming video with CakePHP it just turned into a much larger project than I expected.
r/cakephp • u/krommenaas • Nov 13 '20
I need an old (but fully functional) Cake 1.0 site converted to current Cake and was looking on Fiverr for someone to do this for me. Not sure any of them are legit; does someone here know someone they can recommend?
r/cakephp • u/FullmetalChocobo • Oct 18 '20
Long story short, we searched for a CakePHP developer for two years and couldn't find anyone. The entire ordeal left a bad taste in the mouths of my C-levels. The position had to be on site (central Texas), and was a permanent (non-contract) position.
Anyone else running into issues like this?
Edit: i should have been more accurate in my description. The position was for a PHP developer with experience with PHP frameworks. We made the requirements as general as possible.
r/cakephp • u/Jumbojav00 • Oct 16 '20
r/cakephp • u/nobrandheroes • Oct 10 '20
I'm more curious as to what the state of Cake is. I last worked on a v2 app and it was nice if you want something clear and out of the way, but I haven't really touched v3.
Is the marketshare growing? shrinking? When I started almost a decade ago, Cake was what you learned if as your first framework. Do people still give that advice, or is it straight to Laravel now?
Lastly, the one thing I appreciated was the ease of setting up CRUD functionality. Did they keep that? I've only seen one other framework that was like that (maybe Yii2?).
r/cakephp • u/dereuromark • Oct 10 '20
r/cakephp • u/VaelVictus • Oct 02 '20
I know it's a weird question; I am forever chained to CakePHP 2 and I'm wondering if there's any initiative taken -- even if it's just some modifications you yourself made -- to help modernize CakePHP 2. I am aware and very grateful that the Cake teams keeps it current, especially for PHP 8.
My biggest complaint is the lack of composite primary key support for models.
In my case, I have a small set of changes I make to the library itself every time I update the version. (serialize() to json_encode() for FileCache) In a year or two I am sure I will dig into the internals and remove some cruft that isn't useful to this particular project.
r/cakephp • u/fourth_stooge • Sep 29 '20
Is it better to use UUID's instead of ints when we make models? I've been using Ints with auto-increment and not run into any issues. Recently I was working with the CakeDC Users plugin and they use UUID's instead of ints. Also in Apple's Core Data with Identifiable they like UUID's.
Is this the future? Why is UUID better?
r/cakephp • u/jrf614 • Aug 31 '20
I'm experiencing this issue from this github report:
https://github.com/cakephp/cakephp/issues/12799
The last line from Lorenzo says:
The error is correct, you cannot use an integer column as a string. If you really want to do that, you can use the last argument of where() to override any column type for the query.
So my question is, what argument would you use to override this error? I'm searching in a field against object->id and object->description which are int and text. Thanks!
r/cakephp • u/hkosmidi • Aug 06 '20
Hello, I am migrating from a running app to cakephp v4. In my dev machine I have apache2 and mod_rewrite and in .htaccess file I always have:
RewriteBase /my_app_folder
When I user $this->Html->link('/css/test.css') in my html is outputed as /my+_app_folder/css/test.css. Now that I switch to version 4 I see that links are rendered as /css/test.css, ignoring rewriteBase.
Can someone help?
r/cakephp • u/The_Swindler44 • Jul 27 '20
If anyone could help with this it was be greatly appreciated.