# Need Help

**URL:** https://discourse.cakephp.org/c/need-help/5.md?page=2

[Latest](https://discourse.cakephp.org/latest.md) · [Categories](https://discourse.cakephp.org/categories.md) · [Tags](https://discourse.cakephp.org/tags.md)

**Page:** 3

---

## [Saving BelongsTo Associations (CakePHP 5.1)](https://discourse.cakephp.org/t/saving-belongsto-associations-cakephp-5-1/12612)

<div class="topic-metadata">

**Author:** [@Benj](https://discourse.cakephp.org/u/Benj)\
**Replies:** 2\
**Last updated:** [July 8, 2025, 10:39am UTC](https://discourse.cakephp.org/t/saving-belongsto-associations-cakephp-5-1/12612 "2025-07-08T10:39:34Z")

</div>

Hello, I have a behavior problem when saving a belongsTo association. In my project I have a missions table and a contacts table with : // MissionsTable.php $this-\>belongsTo('Contacts') -\>setForeignKey('contact\_id');…

---

## [Migration from 4.0.7 to?](https://discourse.cakephp.org/t/migration-from-4-0-7-to/12609)

<div class="topic-metadata">

**Author:** [@dantedantas](https://discourse.cakephp.org/u/dantedantas)\
**Replies:** 1\
**Last updated:** [July 6, 2025, 10:16am UTC](https://discourse.cakephp.org/t/migration-from-4-0-7-to/12609 "2025-07-06T10:16:21Z")

</div>

Hello everyone. My project is currently using: CakePHP 4.0.7 XAMPP 3.2.4 MSSQL Server 16 PHP 7.4 But we need to migrate to a new server, this server is set with a more updated environment. XAMPP 3.3.0 MSSQL Serve…

---

## [CakePHP 5: Paginator fails silently with a complex query (Search Plugin + custom helpers)](https://discourse.cakephp.org/t/cakephp-5-paginator-fails-silently-with-a-complex-query-search-plugin-custom-helpers/12596)

<div class="topic-metadata">

**Author:** [@apricotpoodle](https://discourse.cakephp.org/u/apricotpoodle)\
**Replies:** 3\
**Last updated:** [July 2, 2025, 7:51am UTC](https://discourse.cakephp.org/t/cakephp-5-paginator-fails-silently-with-a-complex-query-search-plugin-custom-helpers/12596 "2025-07-02T07:51:06Z")

</div>

Hello everyone, I am trying to correctly implement server-side pagination for a Tabulator grid using CakePHP 5’s built-in Paginator. My goal is to use the core features of the framework as intended, because it would be …

---

## [Passing query options as paginator settings is no longer supported](https://discourse.cakephp.org/t/passing-query-options-as-paginator-settings-is-no-longer-supported/12193)

<div class="topic-metadata">

**Author:** [@Zenzs](https://discourse.cakephp.org/u/Zenzs)\
**Replies:** 15\
**Last updated:** [June 28, 2025, 12:46pm UTC](https://discourse.cakephp.org/t/passing-query-options-as-paginator-settings-is-no-longer-supported/12193 "2025-06-28T12:46:26Z")

</div>

Cakephp Version: 5.0.10 Hi, Please be advised that I have asked this question on SO (cakephp - Paginating with sort and direction - Stack Overflow) but unfortunately I was unable to find a solution. And without a solut…

---

## [\[Solved\] Custom ErrorLogger in CakePHP 4.6](https://discourse.cakephp.org/t/solved-custom-errorlogger-in-cakephp-4-6/12587)

<div class="topic-metadata">

**Author:** [@perseus](https://discourse.cakephp.org/u/perseus)\
**Replies:** 8\
**Last updated:** [June 5, 2025, 7:36am UTC](https://discourse.cakephp.org/t/solved-custom-errorlogger-in-cakephp-4-6/12587 "2025-06-05T07:36:38Z")

</div>

I am trying to set up a custom ErrorLogger in CakePHP 4.6 like so: src/Error/MyErrorLogger.php \<?php declare(strict\_types=1); namespace App\\Error; use Cake\\Error\\ErrorLogger as CakeErrorLogger; use Cake\\Log\\Log; use…

---

## [AddEmbeddedImage in PHPMailer](https://discourse.cakephp.org/t/addembeddedimage-in-phpmailer/12578)

<div class="topic-metadata">

**Author:** [@Klaus](https://discourse.cakephp.org/u/Klaus)\
**Replies:** 4\
**Last updated:** [May 25, 2025, 9:16pm UTC](https://discourse.cakephp.org/t/addembeddedimage-in-phpmailer/12578 "2025-05-25T21:16:36Z")

</div>

Hello, is there anything compareable with the PHPMailer methode: \*\*AddEmbeddedImage\*\* in the cake mailer class? Or do you suggest something else? I like to embedd images into a mail body, it is ignoring the images. …

---

## [Reading and writing spatial/geometry fields in CakePHP 5.1.0+](https://discourse.cakephp.org/t/reading-and-writing-spatial-geometry-fields-in-cakephp-5-1-0/12436)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cakephp.org/u/alex)\
**Replies:** 5\
**Last updated:** [May 25, 2025, 12:01pm UTC](https://discourse.cakephp.org/t/reading-and-writing-spatial-geometry-fields-in-cakephp-5-1-0/12436 "2025-05-25T12:01:22Z")

</div>

(This is a follow-up to Read data from spatial MySQL field (Point, Polygon ...). Starting a new thread because that one focuses on reading, and my question is both on reading and writing.) What’s the correct way to read…

---

## [When used http client cakephp 3 Cannot Get Response](https://discourse.cakephp.org/t/when-used-http-client-cakephp-3-cannot-get-response/10707)

<div class="topic-metadata">

**Author:** [@wakikuk](https://discourse.cakephp.org/u/wakikuk)\
**Replies:** 3\
**Last updated:** [May 21, 2025, 12:13am UTC](https://discourse.cakephp.org/t/when-used-http-client-cakephp-3-cannot-get-response/10707 "2025-05-21T00:13:35Z")

</div>

i’ll tried to request with http client, to url : https://equran.id/api/surat/1 , that my code public $urlquran = "https://equran.id/api/surat"; public function getayat($randomsurat =null){ $http = new Client(); …

---

## [NOOB question from tutorial](https://discourse.cakephp.org/t/noob-question-from-tutorial/12197)

<div class="topic-metadata">

**Author:** [@Howan](https://discourse.cakephp.org/u/Howan)\
**Replies:** 9\
**Last updated:** [May 18, 2025, 8:32am UTC](https://discourse.cakephp.org/t/noob-question-from-tutorial/12197 "2025-05-18T08:32:52Z")

</div>

Hey everyone, I’m super new to cake and just work through the first tutorial on the main page and cant make the tag sections work. I can add end edit Articles and can also add and Edit Tags but cant set the Tags for the…

---

## [Paginator for cakephp5. x. The URL on the next page has removed fields with empty values](https://discourse.cakephp.org/t/paginator-for-cakephp5-x-the-url-on-the-next-page-has-removed-fields-with-empty-values/12568)

<div class="topic-metadata">

**Author:** [@maxg](https://discourse.cakephp.org/u/maxg)\
**Replies:** 3\
**Last updated:** [May 13, 2025, 11:31am UTC](https://discourse.cakephp.org/t/paginator-for-cakephp5-x-the-url-on-the-next-page-has-removed-fields-with-empty-values/12568 "2025-05-13T11:31:11Z")

</div>

Click the ‘检索’ button Click the ‘next\>’ button The null value in the path has been deleted, I don’t want to delete it. cakephp5.x\>users UsersController.php protected array $paginate = \[ 'limit' =\> 5, …

---

## [Need help with CakePHP setup](https://discourse.cakephp.org/t/need-help-with-cakephp-setup/12561)

<div class="topic-metadata">

**Author:** [@marviana](https://discourse.cakephp.org/u/marviana)\
**Replies:** 2\
**Last updated:** [May 7, 2025, 9:00pm UTC](https://discourse.cakephp.org/t/need-help-with-cakephp-setup/12561 "2025-05-07T21:00:40Z")

</div>

I’m new to CakePHP and I’m having some trouble getting things to work properly. I’ve followed the basic setup guide but something seems off. Could anyone please help or point me in the right direction?

---

## [Sessions with different lifetimes for different users](https://discourse.cakephp.org/t/sessions-with-different-lifetimes-for-different-users/12554)

<div class="topic-metadata">

**Author:** [@larsgw](https://discourse.cakephp.org/u/larsgw)\
**Replies:** 6\
**Last updated:** [April 29, 2025, 9:46am UTC](https://discourse.cakephp.org/t/sessions-with-different-lifetimes-for-different-users/12554 "2025-04-29T09:46:38Z")

</div>

We’d like to have relatively long session lifetimes for logged in users (2 weeks currently), but have a lot of trouble with API clients and crawlers that create millions of sessions. These sessions take too long to expir…

---

## [CMS tutorial issue for a newbe](https://discourse.cakephp.org/t/cms-tutorial-issue-for-a-newbe/12546)

<div class="topic-metadata">

**Author:** [@Ricardo](https://discourse.cakephp.org/u/Ricardo)\
**Replies:** 1\
**Last updated:** [April 18, 2025, 4:01am UTC](https://discourse.cakephp.org/t/cms-tutorial-issue-for-a-newbe/12546 "2025-04-18T04:01:35Z")

</div>

Hello, I just started to learn PHP/CakePHP. I’m a Systems Engineer so, I’m very familiar with coding, but in my old days the languages were others: VB, COBOL, Pascal, etc. So, moving into a WEB development is a challenge…

---

## [Router::scope() deprecated block cake bake after migration](https://discourse.cakephp.org/t/router-scope-deprecated-block-cake-bake-after-migration/10097)

<div class="topic-metadata">

**Author:** [@Viduc](https://discourse.cakephp.org/u/Viduc)\
**Replies:** 7\
**Last updated:** [April 16, 2025, 4:22am UTC](https://discourse.cakephp.org/t/router-scope-deprecated-block-cake-bake-after-migration/10097 "2025-04-16T04:22:45Z")

</div>

Hi, i migrate my project to 4.1 in 4.3. But now when i want use cake bake i have this error message: \`Router::scope()\` is deprecated, use the non-static method \`RouteBuilder::scope()\` instead. /var/www/TALA/back\_end/ven…

---

## [A route matching "array ( 'prefix' =\> 'Api', 'controller' =\> 'Admins', 'action' =\> 'login', 'plugin' =\> 'DebugKit', '\_ext' =\> NULL, )" could not be found](https://discourse.cakephp.org/t/a-route-matching-array-prefix-api-controller-admins-action-login-plugin-debugkit-ext-null-could-not-be-found/12532)

<div class="topic-metadata">

**Author:** [@clarenz](https://discourse.cakephp.org/u/clarenz)\
**Replies:** 1\
**Last updated:** [April 8, 2025, 1:47pm UTC](https://discourse.cakephp.org/t/a-route-matching-array-prefix-api-controller-admins-action-login-plugin-debugkit-ext-null-could-not-be-found/12532 "2025-04-08T13:47:58Z")

</div>

I’m trying to make the default route into /Api/Admins/login whenever the project is opened using this route: $builder-\>connect('/', \['prefix' =\> 'Api', 'controller' =\> 'Admins', 'action' =\> 'login'\]); this is because m…

---

## [Any complete web project written in CakePHP that is possible to download as demo for studying?](https://discourse.cakephp.org/t/any-complete-web-project-written-in-cakephp-that-is-possible-to-download-as-demo-for-studying/11411)

<div class="topic-metadata">

**Author:** [@Hoodas](https://discourse.cakephp.org/u/Hoodas)\
**Replies:** 5\
**Last updated:** [September 25, 2023, 7:18pm UTC](https://discourse.cakephp.org/t/any-complete-web-project-written-in-cakephp-that-is-possible-to-download-as-demo-for-studying/11411 "2023-09-25T19:18:33Z")

</div>

Hi, ive desided to use CakePHP and because of PHP version on my webserver im a littlep ressed to use version CakePHP 3.x Im looking for some kind of complexive project written in that is free to download and i can use i…

---

## [What is 'fixedNowTime' in debug()?](https://discourse.cakephp.org/t/what-is-fixednowtime-in-debug/12528)

<div class="topic-metadata">

**Author:** [@jarekgol](https://discourse.cakephp.org/u/jarekgol)\
**Replies:** 5\
**Last updated:** [April 5, 2025, 10:01am UTC](https://discourse.cakephp.org/t/what-is-fixednowtime-in-debug/12528 "2025-04-05T10:01:04Z")

</div>

As in subject. Cake version 3.1, Carbon. For example you can see it with: $time = Time::now(); debug($time);

---

## [PHP CAKE + NextJs](https://discourse.cakephp.org/t/php-cake-nextjs/12517)

<div class="topic-metadata">

**Author:** [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Replies:** 2\
**Last updated:** [March 29, 2025, 5:24pm UTC](https://discourse.cakephp.org/t/php-cake-nextjs/12517 "2025-03-29T17:24:39Z")

</div>

Can you please advise me on the best way to run a nextjs application in phpcake? It can be statically exposed, but I would like the NextJs application to run on a certain URL and receive routes… Example… /articles and /…

---

## [Dependency Injection into controller constructors](https://discourse.cakephp.org/t/dependency-injection-into-controller-constructors/10425)

<div class="topic-metadata">

**Author:** [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Replies:** 8\
**Last updated:** [March 22, 2025, 11:56pm UTC](https://discourse.cakephp.org/t/dependency-injection-into-controller-constructors/10425 "2025-03-22T23:56:00Z")

</div>

In this documentation Dependency Injection - 4.x It describes three places injection works: when calling actions invoking console commands and finally You can also have dependencies injected into controller constru…

---

## [Allowing cookies](https://discourse.cakephp.org/t/allowing-cookies/12508)

<div class="topic-metadata">

**Author:** [@efjot](https://discourse.cakephp.org/u/efjot)\
**Replies:** 3\
**Last updated:** [March 22, 2025, 7:13am UTC](https://discourse.cakephp.org/t/allowing-cookies/12508 "2025-03-22T07:13:06Z")

</div>

Hi together, on all websites if you open it for the first time, there is a question to allow All cookies just needed No cookies can someone tell me how to realize such stuff?

---

## [Run Seed from Migration?](https://discourse.cakephp.org/t/run-seed-from-migration/12504)

<div class="topic-metadata">

**Author:** [@general2000vn](https://discourse.cakephp.org/u/general2000vn)\
**Replies:** 2\
**Last updated:** [March 21, 2025, 5:52am UTC](https://discourse.cakephp.org/t/run-seed-from-migration/12504 "2025-03-21T05:52:11Z")

</div>

Hi all, Is there any way to run data Seed from database structure Migrations? My goal is having several migration for newer version of application, and some data for types, statuses, dropdown menu seeded as well withou…

---

## [Download a file with https](https://discourse.cakephp.org/t/download-a-file-with-https/12507)

<div class="topic-metadata">

**Author:** [@michefu](https://discourse.cakephp.org/u/michefu)\
**Replies:** 7\
**Last updated:** [March 19, 2025, 6:26pm UTC](https://discourse.cakephp.org/t/download-a-file-with-https/12507 "2025-03-19T18:26:20Z")

</div>

Hi, I’m using $response-\>withDownload to have user download file I generated (.csv) but Chrome and other browser refuse to download it because “This file should be served over HTTPS” (since my site is using https). How…

---

## [Custom login conditions](https://discourse.cakephp.org/t/custom-login-conditions/12483)

<div class="topic-metadata">

**Author:** [@efjot](https://discourse.cakephp.org/u/efjot)\
**Replies:** 4\
**Last updated:** [March 19, 2025, 1:27pm UTC](https://discourse.cakephp.org/t/custom-login-conditions/12483 "2025-03-19T13:27:24Z")

</div>

Hi, I implemented the standard Auth in my project. Means user need to login with email and password. But I need a 3rd criterion to login. In DB there is a field with status. During login I want to check if status = 2…

---

## [Cake 5.1: Model =\> Table =\> validator](https://discourse.cakephp.org/t/cake-5-1-model-table-validator/12498)

<div class="topic-metadata">

**Author:** [@coolex](https://discourse.cakephp.org/u/coolex)\
**Replies:** 4\
**Last updated:** [March 19, 2025, 8:36am UTC](https://discourse.cakephp.org/t/cake-5-1-model-table-validator/12498 "2025-03-19T08:36:07Z")

</div>

Hi, I have 2 fields “partner\_id” and “center\_id” and I would like to do a validation where at least one of them must be filled in, but not both. This format works only if both fields are filled. $validator …

---

## [Cake 4.5: cakephp-captcha passive tries to validate captcha\_result](https://discourse.cakephp.org/t/cake-4-5-cakephp-captcha-passive-tries-to-validate-captcha-result/12432)

<div class="topic-metadata">

**Author:** [@magic77](https://discourse.cakephp.org/u/magic77)\
**Replies:** 1\
**Last updated:** [March 16, 2025, 4:55pm UTC](https://discourse.cakephp.org/t/cake-4-5-cakephp-captcha-passive-tries-to-validate-captcha-result/12432 "2025-03-16T16:55:50Z")

</div>

After an upgrade from Cake 3.10 to 4.5.x and an upgrade from “dereuromark/cakephp-captcha” to 1.4, the Honeypot Captcha no longer works. I have customized my setup based on the docs: cakephp-captcha/docs/Passive.md at c…

---

## [Class Hash not found](https://discourse.cakephp.org/t/class-hash-not-found/12496)

<div class="topic-metadata">

**Author:** [@alexd1977](https://discourse.cakephp.org/u/alexd1977)\
**Replies:** 5\
**Last updated:** [March 16, 2025, 4:31pm UTC](https://discourse.cakephp.org/t/class-hash-not-found/12496 "2025-03-16T16:31:59Z")

</div>

Using CakePhp 4.4.11 In my controller I have: $languages = Hash::extract($user-\>languages, '{n}.name'); But when going to the page, I get: Class 'App\\Controller\\Hash' not found Am I supposed to install something?

---

## [If($this-\>request-\>is('post')) {} Always returns false](https://discourse.cakephp.org/t/if-this-request-is-post-always-returns-false/4653)

<div class="topic-metadata">

**Author:** [@bichomen](https://discourse.cakephp.org/u/bichomen)\
**Replies:** 7\
**Last updated:** [March 14, 2025, 3:31pm UTC](https://discourse.cakephp.org/t/if-this-request-is-post-always-returns-false/4653 "2025-03-14T15:31:26Z")

</div>

Hello, I can not login, it seems like the post, never comes, I’m not sure if it’s a problem with the AJAX or Cakephp Let’s see if you can help me. Thanks, then I put the code of the different files: AppController: pu…

---

## [Method 'App\\Policy\\UsersTablePolicy::beforeScope()' is not compatible with method](https://discourse.cakephp.org/t/method-app-policy-userstablepolicy-beforescope-is-not-compatible-with-method/12471)

<div class="topic-metadata">

**Author:** [@lish](https://discourse.cakephp.org/u/lish)\
**Replies:** 7\
**Last updated:** [March 14, 2025, 3:45am UTC](https://discourse.cakephp.org/t/method-app-policy-userstablepolicy-beforescope-is-not-compatible-with-method/12471 "2025-03-14T03:45:57Z")

</div>

Fatal error : Declaration of App\\Policy\\UsersTablePolicy::beforeScope(Authorization\\IdentityInterface $user, Cake\\Database\\Query $query, string $action): Cake\\Database\\Query must be compatible with Authorization\\Policy\\B…

---

## [Customize message in requirePresence validation](https://discourse.cakephp.org/t/customize-message-in-requirepresence-validation/12472)

<div class="topic-metadata">

**Author:** [@MDebus](https://discourse.cakephp.org/u/MDebus)\
**Replies:** 3\
**Last updated:** [March 10, 2025, 2:47pm UTC](https://discourse.cakephp.org/t/customize-message-in-requirepresence-validation/12472 "2025-03-10T14:47:35Z")

</div>

Hi there, i can’t customize my message in requirePresence Validation: $validator-\>requirePresence(\[ 'user\_id' =\> \[ 'mode' =\> 'create', 'message' =\> 'My custom message.', \] \]); $validator-\>r…

---

## [Redirect when it is in URL](https://discourse.cakephp.org/t/redirect-when-it-is-in-url/12441)

<div class="topic-metadata">

**Author:** [@efjot](https://discourse.cakephp.org/u/efjot)\
**Replies:** 6\
**Last updated:** [March 9, 2025, 7:47pm UTC](https://discourse.cakephp.org/t/redirect-when-it-is-in-url/12441 "2025-03-09T19:47:02Z")

</div>

I solved the topic to get redirected to login page when someone is trying to open a post directly without login. The user will be redirected to login page like this. http://www.mypage.com/users/login?redirectUrl=%2Fpos…

[Previous page](https://discourse.cakephp.org/c/need-help/5.md?page=1)

[Next page](https://discourse.cakephp.org/c/need-help/5.md?page=3)
