110 questions
0
votes
0
answers
57
views
PDO Exception Unknown column when removing column from data table
I am currently working on removing deprecated columns from my database. After dropping a specific column, I encountered the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column
'...
0
votes
1
answer
305
views
How to send email in cakephp 3.6.7..?
I am using cakephp3.6.7 while configuring app.php it will show error.
Error:
Could not send email: mail(): Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" ...
0
votes
1
answer
54
views
Using plugin model for non-plugin controller
I have two separate CakePHP 3.1 apps that each use the same database, but display the information in very different ways. To reduce code duplication, I'm extracting most of the models into a plugin. ...
0
votes
2
answers
95
views
How to make cakephp 3 url ready for marketing?
I am new for cakephp. I am trying to rewrite the url to make it SEO friendly.
I have create module in cakephp3 for cms page.
Page Table - url field would like to use as "about-us"
CREATE TABLE IF ...
1
vote
3
answers
2k
views
Creating Rest API without views using cakePHP 3.5
I'm trying to create Rest API without view and planning to use these api's in angular 2 application. does have any idea about it?
0
votes
0
answers
160
views
How to put begin-commit transaction in controller: cakephp 3.1?
I want to apply transactions but only for this request.is it any impact on insert , update on other table by other users at same.
$conn = ConnectionManager::get('default');
$conn->begin();
try{
...
2
votes
2
answers
3k
views
Login redirecting in cakePHP 3.4
I'm trying to redirect to current page after logged in, using cakephp 3.4 but I'm getting like this
localhost page isn't working, locahost page redirecting you too many
times. Try clearing your ...
0
votes
0
answers
334
views
How to Create Custom Field Types w/ CakePHP 3.0
Is there a way you can create custom field types with CakePHP 3.0? Do you do it via PHPMyAdmin or a Bake Plugin. I want to do it for custom fields for this custom portal I been working on that is ...
1
vote
2
answers
450
views
How do I count unique page view count to my web page using Cakephp 3.0?
I'm trying to implement total unique page view count to my webpage, Any one knows that how to do that just give me an idea to implement using CakePHP 3.0
5
votes
2
answers
1k
views
Cakephp3.1: Using matching() and notMatching() on the same associated model at once
I want do implement a search function for recipes and their associated ingredients. The user should specify ingredients that he wants to exclude from the search and at the same time ingredients that ...
0
votes
3
answers
2k
views
what is difference between get or find in cakephp 3
What is difference b/w get or find in cakephp 3. Why we use get or find in cakephp 3 .
0
votes
1
answer
466
views
Cakephp 3.1 - How to redirect based on query string values?
We recently updated our site from pure php to cakephp 3 and having trouble redirecting urls that have params to a new url.
For example this redirect works fine
$routes->redirect('/webcast.php', '/...
0
votes
1
answer
548
views
CakePHP 3.x multiple file upload not working
When using the line:
<?= $this->Form->input('ad_photos[]', ['type' => 'file', 'multiple' => true, 'label' => 'Add Some Photos']); ?>
The form won't even submit. It is like the ...
0
votes
1
answer
586
views
Override Cakephp 3.1 data type using typeMap()
When I have a query:
$jobs = $this->Jobs->find('all', [
'fields' => [
'id',
'existingdatetime',
'newdatetime' => '"2016-05-10 16:12:10"',
],
]);
The ...
1
vote
1
answer
1k
views
cakephp 3.1 mysql has gone away
I have a Shell script that runs continuously on a loop.
It checks the database for records and alters them if needs be.
set_time_limit(0);
while(true){
try{
...
5
votes
1
answer
1k
views
CakePHP deleteAll for many to many relationship does not remove join records
I'm on CakePHP v3.17 w/ Postgres 9.4
I'm trying to get $this->SomeTable->deleteAll([...]) to remove the records in the join table too.
Imaging a bus system with a table for Stops and a table ...
2
votes
1
answer
708
views
cakephp3 find data with selected columns [duplicate]
Hi I'm trying to find data in Cakephp3
What I'm doing is I'd like to find data with selected columns which are product name, product code, and small image url.
$contain = [
'Image' => [
...
1
vote
1
answer
2k
views
Curl PUT Request and empty request data (rest api)
I am trying to make a PUT request, in order to edit some user's data, but I am receiving empty data instead of what I'm sending through my request.
I have tried with postman (a chrome plugin) and ...
1
vote
1
answer
260
views
Including sidebar in Cake PHP template
I'm trying to create a sidebar in my template but I'm getting Cake\View\Exception\MissingElementException. I've created sidebar.ctp in /src/View/Element/ directory, and call it like this :
<?= $...
0
votes
1
answer
471
views
Cakephp 3 best coding practice for model functions
I have a current_day_users table and users table.What is the better coding practice between the following to extract data from current_day_users:
1.UsersTable.php code
$this->CurrentDayUsers-&...
0
votes
0
answers
1k
views
Get IP address in cakephp 3.2
Here i want to find the ip address of system,which i want to implement.
but i stucked here.
I am using cakephp version 3.2.
i have worked on it
,getting an incomplete ip ::1,while my machine ip is 155....
1
vote
1
answer
379
views
matching associations and no associated record cakephp 3
I have an association of Price belongsTo Season
I am trying to query all prices that match a specific date range when passed in the season as well as any that have none (Prices.season_id=0)
Here is ...
0
votes
1
answer
650
views
CakePHP3 Plugin cell is missing
My Process
make plugin cell
$ bin/cake bake plugin Abc
$ bin/cake bake cell Abc.New
upper process make 3 files
plugins/Abc/src/View/Cell/NewCell.php
plugins/Abc/src/Template/Cell/Menu/...
0
votes
1
answer
1k
views
cakephp 3.x how to use session in model?
We are developing shopping cart application. Our application we are merging the cart items with login user when user logged in. So can you please help me how to use Session inside the model
1
vote
1
answer
616
views
CakePHP 3: Caching database object in component
i'm trying to save an database object from the (plugin) component into the CakePHP Cache.
This works ( note the toArray() )
$domains = Cache::read('domains', 'long');
if ($domains ==...
7
votes
4
answers
10k
views
Session destroyed out of nowhere in PHP
I am experiencing issue with a session being destroyed out of nowhere:
session_start(): Failed to decode session object. Session has been destroyed.
Kind of impossible to replicate the issue since I ...
0
votes
1
answer
229
views
requestAction shows a blank page in CakePHP 3.1
I am using CakePHP 3.1 and whenever I make use of requestAction, the page goes blank while I get an error in the console. The basic code is:-
$test = $this->requestAction('/dockets/find'.$...
1
vote
0
answers
60
views
Crypt and decrypt cakephp 3 Security component [duplicate]
What is wrong on this code in CakePHP 3?
crypt function is ok, but when I am trying to decrypt password, it returns false.
public function beforeSave($event){
if(isset($event->data['...
0
votes
1
answer
669
views
CakeDC Users Plugin: Disable/Override Username Validation
How to configure CakeDC's Users plugin to override/disable the username field?
I have reconfigured the plugin to use 'email' field as username for login - and it works great for login - but I no ...
4
votes
1
answer
999
views
How to configure PhpStorm 10.x to run unit tests in CakePHP 3.x?
Does anyone have a verified method to configure PhpStorm 10.x to run unit tests in CakePHP 3.x?
edit:
after @ndm's answer I fixed my PhpStorm configuration, adding "phpunit.xml.dist" to PHPUnit > ...
0
votes
1
answer
322
views
How create a grouped structure based off of a field in a query result?
I am trying to group by Year in cakephp3. I am able to get data using
following way, but it's not still grouped by year(The way I want.)
$query = $this->Alerts->query();
$year = $query->...
5
votes
1
answer
6k
views
CakePHP 3 changing the radio input template
Cakephp 3 create a radio container with label -> input like that
<div class="radio">
<label class="radio-acces-checked" for="condition-access-1">
<input id="condition-access-...
0
votes
1
answer
958
views
How to use prefixed email templates in cakephp 3.1?
I'm using cakephp 3.1.6 and I have an admin prefix to separate my administration section. Using this approach I've generated this folder structure for templates:
src/Template
├── Admin
│ ├── ...
3
votes
0
answers
3k
views
Image is not displaying using TCPDF
I am working in CakePHP 3 application. Here I am using TCPDF for PDF Generation. Everything works fine except image. Image is not displaying.
Here my pdf() action file:
public function pdf()
{
...
0
votes
1
answer
5k
views
PHPExcel - Call to a member function getCacheData() on null
I am getting an error something like below when writing a file
Error: Call to a member function getCacheData() on null
File E:\websites\d3a-qa\vendor\PHPExcel\PHPExcel\Worksheet.php
Line: 2554
Line ...
0
votes
1
answer
68
views
cakephp 3 img pending request, image doesn't load
I'm developing with cakephp 3 right now. I have a controller that has a img in it's view. The problem is that it is pending and doesn't load (in chrome not in firefox).
One factor could be the ...
2
votes
2
answers
2k
views
CakePHP3.1: disable options in a select input
I want to disable options in a select input so I tried:
echo $this->Form->select("status",
[
'options' => $status,
'value' => $order->status,
'label' => false,
...
0
votes
1
answer
795
views
How to select only those records that have at least one associated record?
I have the following associations: Orders belongsTo Sites
I execute the following query:
$sites = $this->Sites->find('all')
->select(['id', 'name'])
->contain([
'Users' => ...
0
votes
0
answers
83
views
cakephp3.1: Cannot limit the fields loaded in association
I execute the following query:
$sites = $this->Sites->find('all')
->select(['id', 'name'])
->contain([
'Users' => function ($q) {
return $q->select(['id', '...
0
votes
1
answer
1k
views
cakephp 3 saving associated data
I'm trying to save associated data, but even though it seems to be set right it doesn't commit to the database. I have to explicitly use the associated table to save the data. using the 'associated' ...
0
votes
1
answer
1k
views
cakephp 3.1 input field with european date format
I have a table with records of users (name, forename, birthdate, etc.) and I want to find users by name or birthdate or every possible combination of this.
My code works well, but the birthdate is ...
0
votes
2
answers
3k
views
CAKEPHP 3.1 clear form after submit
Usually on cakephp2 i used to unset form data and everything was ok.
Some times i use redirects to clear it. But i cant do that in this current page.
Anyone has found this issue or a solution for ...
1
vote
1
answer
1k
views
CakePHP 3: Paginator sort by languages (with i18n translate behavior)
I have a table with all entries including all translations in multiple languages: How can I create pagination sort links on translated fields? (Cake 3.1.6)
Summary: This is not working, I can't sort ...
0
votes
0
answers
578
views
CakePhp 3.x not saving datetime correctly
I have events that have a datetime input for the start and end of the event. If I try to save the start 12-8-2015 at 11:30am and the end 12-8-2015 at 12:30pm the event gets save but it makes the date ...
5
votes
1
answer
678
views
CakePHP 3.1 patchEntity always marking belongsToMany associations as dirty when clean
So I noticed that If I patch an entity (edit method) and whether or not I make any data changes to the record if it has belongsToMany associations it marks them as dirty. I would expect that if I make ...
2
votes
2
answers
1k
views
CakePHP 3 : Image upload from controller
I am trying to uploading image from controller using PHP. Here image upload is working fine but content is not saving in database, only image path saving. If I comment on image upload code then ...
0
votes
1
answer
896
views
CakePHP 3: hasOne association not getting saved / created
Cake PHP Version: 3.1.5
I have a problem with saving a hasOne association, which works fine on one table but not with a second.
Ticketsand Cashdrafts are related to Cashpositions in a belongsTo ...
0
votes
3
answers
315
views
File fails to upload when using xety/cake3-upload plugin
I am not able to upload a file from one folder to another in CakePHP. Here is my code.
First I loaded the plugin and added this code in ProductsTable.php
$this->addBehavior('Xety/Cake3Upload.Upload'...
0
votes
0
answers
127
views
How to check ajax response before the request is considered completed in CakePHP 3.x?
I have been trying to add two users (one at a time) and then pay using stripe. I originally thought the problem lied in the fact that ajax is asynchronous, posting both user forms at the same time, ...
0
votes
1
answer
319
views
Cakephp 3 habtm with additional data
While going through a cakephp 3 tutorial about bookmarks and tags I've struggled with a problem: I want to add the third field to the users_tags table (tag_type: important or not), but when it saves ...