Questions tagged [cakephp-3.6]

Questions about the 3.6.x branch of the CakePHP MVC framework. Use this tag in combination with the general [cakephp] tag. If your question applies to CakePHP more generally, use only the [cakephp] tag.

CakePHP 3.6

CackePHP is a PHP development framework using Associative Data Mapping, Front Controller and MVC design patterns.

Version 3.6.0 was released in April 2018.

Resources

47 questions
0
votes
1 answer

Filter all find queries on entity CakePHP 3.6

let's say that I have an articles database and I want to only display articles that are published on the site (where published = 1). Instead of adding the condition in every find queries like the following: $articles =…
user765368
  • 19,590
  • 27
  • 96
  • 167
0
votes
4 answers

CakePHP 3.6 - Find All Records Created Between Two Dates

I am looking for all records between two dates My variables $start = '01/01/2009'; $end = '07/24/2019'; I have tried $gross = $this->CartOrders->find('all')->where(['placed >=' => $start])->andWhere(['placed <=' => $end])->all(); Query Snippet…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
1 answer

Two users associated to one transaction in CakePHP 3.x

In my app there is a Transaction table with: seller_id, buyer_id and asset_id. seller_id and buyer_id are id's supposed to point to Users table. To stick to the convention and keep automatic associations both should be called "user_id" (which is of…
Zbigniew Ledwoń
  • 682
  • 1
  • 6
  • 19
0
votes
1 answer

Cakephp 3: execute custom command from command

In CakPHP 3.6.0 Console Commands have been added to replace Shells and Tasks long term. I'm currently designing a cronjob command to execute other commands in different time intervals. So I want to run a command from a Command class like…
mixable
  • 1,068
  • 2
  • 12
  • 42
0
votes
1 answer

CakePHP 3.x - File Upload Results in Token Mismatch

I have a form that is type => file, with an file upload control. When I submit this form without a file, it submits as expected. However, When I submit the form with a file attached, I get a CSRF Token Mismatch. Any ideas why this might be…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
1 answer

CakePHP 3.x Merge Find Results

I am currently grabbing two result sets from two different tables with the same column structure. Is it possible to do something like array_merge on these two sets of data and merge them into one set so that I can paginate the results in the view?
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
0 answers

CakePHP 3.6 File Upload Returns Missing field '...' in POST data

I am attempting to add a file/image upload form to my site, and I am getting the following error Unexpected field 'uploadfile' in POST data, Missing field 'uploadfile.name, uploadfile.type, uploadfile.tmp_name, uploadfile.error, uploadfile.size' in…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
0 answers

Xdebug 2.6.1 / PHP 7.2.13 exiting execution in PhpStorm 2019.1 EAP when iterating Traversable object

My Config: CakePHP Version: 3.6.13 Platform and Target: PHP 7.2, MySQL 5.7, Ubuntu 16.04.5 LTS, Vagrant, Apache, php-fpm, PhpStorm 2019.1 EAP php -v output PHP 7.2.13-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Dec 7 2018 08:07:08) ( NTS…
nightcoder
  • 43
  • 5
0
votes
1 answer

SQL case query with DISTINCT in cakephp3 ORM

I am trying to build a case query with distinct count in cakephp 3. This is the query in SQL: select COUNT(distinct CASE WHEN type = 'abc' THEN app_num END) as "count_abc",COUNT(distinct CASE WHEN type = 'xyz' THEN app_num END) as "count_xyz" from…
Gaurav Neema
  • 146
  • 1
  • 1
  • 12
0
votes
1 answer

CakePHP 3.x Search Multiple Unrelated Models

I have been searching around for a way to search multiple unrelated models, meaning there are no associations between the models being searched, and I have not found any documentation so far on how to do this. The idea is, is that I have a search…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
1 answer

how to allow home page to access without login and when any userlogin restrict access to home page to for that user in cakephp 3

I am trying to write code in such a manner that, when anyone logs in to my sight with user role=merchant he will not allow accessing my home page and when anyone login with user role=customer then he will allow accessing the home page, rather than…
0
votes
2 answers

CakePHP count() return wrong results?

CakePHP 3.6.14 This code reproduce wrong number: $where = [ 'Postings.source' => $source, 'Postings.approved' => 1, 'Postings.deleted' => 0, 'Postings.disabled' => 0 ]; if…
Salines
  • 5,674
  • 3
  • 25
  • 50
0
votes
1 answer

CakePHP 3.x use htaccess to rewrite directories as pagination query params

I am upgrading a CakePHP 1.x project to CakePHP 3.x The 1.x project has URLs that are published in places that we can not change, like books, so I need to rewrite the previous URLs to match the Pagination URLs in CakePHP 3.x This is an example of…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
1 answer

CakePHP 3.x OR In Find Condition With Multiple Same Fields

I would like to query the database for Plates.page_number => 1 OR Plates.page_number => Cover I am attempting to use the following code, but I am not getting the results I am looking for because of a duplicate array key, how can I search the same…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
0
votes
1 answer

How to find count in many to many relationship in MySql, Cakephp 3.6

I need to calculate the count(vendors.id) for each category. ie: how many vendors are there for each category(not sub-category) I am using cakephp 3.6 framework and MySQL as database I tried with all possible way that i knew but not found any…
D Coder
  • 331
  • 2
  • 10