Questions tagged [cakephp-3.0]
Questions about the 3.0.x branch of the CakePHP MVC framework. Use this tag in combination with the general [cakephp] tag.
4,478
questions
0
votes
1
answer
25
views
Applying ucwords(strtolower(name)) to form data before submitting to DB in CakePHP
Assume a user fills a form and puts his name like AndReW(Mixed lower and uppercase), I want to get this form data, convert it to a form like this Andrew, and then submit it to the database.... I dont ...
0
votes
0
answers
30
views
I want to display product information by grouping them as one in cakephp
I have a product table with id, product_name and added_date.
I want to display product_name and added_date but I have the following condition to display the results
For product_name column: if ...
-1
votes
1
answer
41
views
How to create CakePHP project (previous version) using Composer (using an old version of PHP, in 2023)
TL;DR Technology moving on and what was deprecated is obsolete now. But fear not, Docker here to solve the problem. See the answer below to see how I create a CakePHP 3.6 project on macOS Ventura.
...
0
votes
0
answers
45
views
Loading JS files in CakePHP 3
I have a template inside a plugin in my project, that is trying to load a "general" JS file:
<?= $this->Html->script([
'base.js',
], [
'fullBase' => true,
]) ?>
...
0
votes
0
answers
43
views
Get raw request body in CakePHP request
In CakePHP 4 you can access the array of JSON POST data in $this->getRequest()->getData(). This is fine to access the data. However, we need to verify a signature that is also based on the POST ...
0
votes
1
answer
25
views
Submit post params with Files using CURL Call
I am trying to submit some post variables along with some files on 3rd party URL via CURL call.
For that i have used ajax from where i am passing whole form data on controller and from controller, i ...
0
votes
0
answers
34
views
How to fix too much time taken by python requests during get and post?
There is one website written in CakePhp and I am moving to Django.
Some pages are making get/post request to another website to collect some information.
CakePhp
$start = time();
$socket = new ...
0
votes
1
answer
46
views
Input field data not deleted once add
I have a form which is including with cakephp3 and JS.
I have a question how can i store data into the input field?
There is some condition for this task, if once user add input into the input field ...
1
vote
0
answers
47
views
Decode SAMLResponse in XML or in readable format
I am trying to integrate Okta SAML SSO in my web application.
After creation of application via development account, once i call the generated url from broswer,
it redirects to my web app with some ...
0
votes
0
answers
60
views
403 - Forbidden when I try to consume API with CakePHP 4
I'm trying to get a list of products via user ID through an API.
I can usually get the product list via postman.
Here are screenshots of the postman.
In my code I try to get the list like this:
...
1
vote
1
answer
71
views
What is the best way to save token (JWT) in cakephp 4?
I have a project and I made the backend using nodejs.
I made a user registration module and the authentication generates a token!
This token will need to be used in other requests where the user must ...
0
votes
0
answers
25
views
CakePHP deprecated warning [duplicate]
I am getting this error,while setting up an existing project.I had cloned and done composer install.[php version is 7.2,cakephp version is 3.9]Now, when I am trying to open the site,It is showing ...
0
votes
0
answers
20
views
How can I get result of find() as model name array?
How can I get result of find() as model name array?
For now, main table is getting as field name, but other joined tables are stored in model name array.
class ArticleMainsTable extends Table {
$this-...
1
vote
0
answers
49
views
Cakephp left outer join from query builder is not giving correct sql format
I want to make sql query like this. Which is working fine. but if I am trying with using cakephp query builder I could not find any path. I am also posting what I have done in cakephp query builder. ...
0
votes
1
answer
25
views
How can I reset associations?
For CakePHP2, I used following function for resetting associations.
public function unbindModelAll($reset = true) {
foreach(array('hasOne','hasMany','belongsTo','hasAndBelongsToMany') as $relation)...
0
votes
1
answer
63
views
how to search using the sum of case when in cakephp
I want to do implement a search in the generated data of the sum count of a case when in cakephp with or or conditions in each data.
SELECT `Branches`.`name` AS `Branches__name` , `Branches`.`code` AS ...
0
votes
0
answers
25
views
Is it Possible to do a datatable search using the generated sumcount of the sum case in CAKEPHP [duplicate]
I want to do a search in the serverside datatable with the number of carried and uncarried cases. how can I use the cases in the search condition. the cases is the result of a total count of carried ...
0
votes
0
answers
36
views
Cakephp 3 form does not return all data when having too many inputs
I am encountering an issue with cakephp 3. I already know there is a limit of size for POST requests in which the $this->request->getData(); method returns an empty array.
Nevertheless, in this ...
1
vote
2
answers
66
views
How can I call custom function from Model?
I'm using CakePHP3.0.5 and I'm just calling custom function from Model.
But it shows Unknown method error.
How can I call custom function from controller?
// Controller
class TopController extends ...
0
votes
1
answer
38
views
CakePhp getting the number of entries of each code
I want to do a search of data and get the number of entries it has on another table
$query = $this->find();
$query->select([
'name',
'code',
'count' => "(
SELECT
...
1
vote
1
answer
122
views
RDS [PDOException] SQLSTATE[HY000] [1045] Access denied for user
I have an instance in Amazon RDS with many databases, all of them accessed by PHP (cakephp 3.9) without any issues in Elastic Beanstalk.
I have a main user that can access all of them, and each DB ...
0
votes
0
answers
38
views
How REQUEST_URI works to protect an entire website but allow access to 1 specific file
I use the code below to protect my whole website under cakephp3 except for one url "/specifi/url" and It works well.
SetEnvIf Request_URI "\/specific\/url$" NOPASSWD=true
...
0
votes
0
answers
22
views
Cakephp 3.8 - Authentication succeed, but I stay on the login page
My cakephp 3 application works well.
I wanted to duplicate my application into an other folder to have a development environment. I use the same deposit. My production folder is linked with the master ...
0
votes
0
answers
61
views
cakephp3 how to force use indexing
Hello everyone i work with cakephp3 and i have table with 3 millions of records, to optimize search in this table i create a index sql (it's work in phpmyadmin and i get the result in short time).
The ...
0
votes
0
answers
19
views
How to make sure Shell doesn't use too much memory
I'm making a Shell that migrates blobs from the database to files in a local file structure. This is what I have currently:
public function main(){
$query = $this->DocumentContents->find('...
0
votes
0
answers
38
views
PHP - cakephp version issue
I am using cakephp version 3.3.16
I got the following errors after upgrading php version to 7.4.
Warning (2): count() [function.count]: Parameter
must be an array or an object that implements ...
0
votes
0
answers
194
views
Issue with Custom Error template in CakePHP 4.0
I would like to know what is the right method to render the custom error templates for missingController, missingTemplate exceptions in 4.x. I have an ErrorController that extends the AppController ...
0
votes
0
answers
100
views
MissingTemplateException from the Ajax request in CakePHP 3.10
We have a ctp page called 'pending' that will call a function ajaxpendingusers in our UsersController to list out all the pending users through an ajax request (getpendinglist) on page load. However, ...
0
votes
1
answer
177
views
SMTP Time out error - Send email from localhost
I tried to send email using Google SMTP from localhost, but I keep getting the SMTP time out. error.
This is my config:
'EmailTransport' => [
'default' => [
'className' => ...
0
votes
1
answer
36
views
DebugKit Error: CakePHP get() mystery empty elements in associations
EDIT: This is after upgrading from CakePHP 4.0 to 4.3
With DebugKit turned on, CakePHP is throwing the following error message:
Argument 1 passed to Cake\ORM\Entity::get() must be of the type string, ...
0
votes
0
answers
25
views
replace bookmarks in text file
We have a bunch of emails that need to be code-generate using data stored in database. Body for emails are stored in an XML file (could be moved to json or table). I like to use some sort of bookmarks ...
0
votes
1
answer
260
views
The "" cache configuration does not exist
I am updating a project from CakePHP 3.5 to 4.0.
In one of my models, I am doing this:
public function afterSave(Event $event, EntityInterface $entity)
{
Cache::clear(false, 'dbResults'...
0
votes
1
answer
18
views
CakePHP3 Cache::read() keys inside groups can't be read
Hi everyone i work with cakephp3 and i have implemented the cache from doc
Here is my cache configuration using groups
Cache::config('users', [
'className' => 'File',
'duration' =&...
0
votes
0
answers
43
views
CakePHP 3 basic authentication get authenticated user
public function beforeSave(Event $event) //for api
{
$hasher = new DefaultPasswordHasher();
$entity->api_key_plain =
Security::hash(Security::randomBytes(32), '...
0
votes
0
answers
42
views
In CakePhp3 how to go back to respective page after clicking back button
I have detail page which can be access from other two pages.
how to return to page that the user came from????
I have page like this:
page1 →index1→detail1→edit→confirm page
page2 →index2→detail2→edit→...
1
vote
0
answers
55
views
Cakephp3 cache duration not expiring
Hello everyone I work with cakephp3 I have implemented the cache from doc but the duration to expire the cache does not apply.
I tried to use minutes and hours in the duration but it doesn't work
...
0
votes
0
answers
64
views
How do you maintain pagination page number when redirecting after updating the edit page in CakePHP 3?
I'm new to cakephp 3 and i want to maintain the pagination page number after updating the view page.
if i am in page 3 and i go to edit page and make changes and click submit button, i want to ...
0
votes
0
answers
70
views
CakePHP buildRules not firing on hasMany nested assocation delete
I am having issue with build rules not firing deleting 1 element from a HasMany association on a model in CakePHP 3. My base table (Settings) is structured with the following association:
<?php
// ...
0
votes
0
answers
82
views
How To set hasMany Association Limit In Model CakePHP4
In cakePHP 1.3 we used this method to set the association limit records
'BuyRate' => array(
'className' => 'Rate',
'foreignKey' => 'currency_id',
'...
0
votes
1
answer
30
views
How can I sync differing primary key values on replicating execute?
I have two connections, d and c. Basically, whatever changes I do on certain models of d, it needs to be replicated at c as well. This is the code doing it:
public function execute()
{
...
0
votes
0
answers
85
views
CakePHP 3 - how to patchEntities where form data is collected within a foreach
My scenario is similar to this post here: CakePHP 3 - Form data format for patchEntities()
However, I am trying to update multiple entries that are represented within a foreach.
The Form looks like ...
1
vote
0
answers
52
views
Can't save record in CakePHP 3.1
So I created a table to test and can't save simple data. I did cake bake model Test, so entity and table models should be fine. Also, connection to the database is fine since other models are been ...
-1
votes
1
answer
20
views
interal error with querybuilder of cakephp on Prod
I'm working under wamp with php 7.4.26 @windows.
I have a project under cakephp. It works well on Dev Environnement.
However when I upload the code on PROD (linux/ PHP 7.4), it gives me an internal ...
1
vote
1
answer
52
views
i18n translations not working in Controller
Why would i18n translations work in a view, but not in AppController?
Doesn't work - In AppController:
class AppController extends Controller
{
public function initialize()
{
parent::...
1
vote
1
answer
193
views
FrozenDate::parseDate() doesn't reflect the date passed as parameter
It doesn't seem to matter what format I specify to FrozenDate::parseDate(), I always get the same wrong date.
Code:
$d1 = '8/28/2021';
$d2 = '10/27/2021';
debug($d1);
debug($d2);
debug(FrozenDate::...
1
vote
1
answer
185
views
Argument 1 passed to pluginSplit() must be of the type string, array given
I'm currently attempting a migration from 3.10.2 to 4.0. I've gone through the guide and I'm now trying to fix issues as they come up.
I'm finding this one rather cryptic.
Argument 1 passed to ...
1
vote
0
answers
375
views
Upgrading plugin to CakePHP4, Rector gives Class not found error
Even though I think I specified the right AUTOLOAD_PATHS to rector.php, I keep getting the same error: Class Bake\View\Helper not found.
I'm attempting to convert a CakePHP 3.10.1 plugin to CakePHP 4....
0
votes
1
answer
105
views
any PDF plugin for cakePHP?
I need to implement in a page/view of a form an option to generate a PDF file; looking for information I have seen that cakepdf exists, but there is hardly any information on how to implement/install ...
0
votes
0
answers
140
views
The action login is not defined in UsersController
I'm attempting to create and implement my own authentication and it keeps trying to reach Users.login.
Since I specify which authenticate class to use, implement my own authenticate() method, why does ...
0
votes
0
answers
28
views
CakePHP3 query object returns wrong datatype
Query object return avg rating is 3 instead of 3.5, when I have 4 and 3 values for ratings in the table
$query = $Comments->find()
->select(['rating'=>'AVG(rating)'])
...