Questions tagged [cakephp-3.4]

Questions about the 3.4.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.4

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

Version 3.4.0 was released in February 2017.

Resources

138 questions
7
votes
2 answers

How to output custom HTTP body contents with CakePHP 3.4? Echoing causes "Unable to emit headers" error

Using CakePHP 3.4, PHP 7.0. I'm attempting to do a really simple controller method to output some JSON. It is outputting "Cannot modify headers...". public function test() { $this->autoRender = false; echo json_encode(['method' =>…
ryantxr
  • 4,119
  • 1
  • 11
  • 25
6
votes
1 answer

fetch security salt in cakephp 3

I read documents and I am not able to get it how to get Security.salt value from app.php in Cakephp 3. I am trying to get it like this $salt = Configure::read('Security.salt'); Importing following libraries use Cake\Core\Configure; use…
Varuni N R
  • 802
  • 3
  • 11
  • 31
3
votes
1 answer

CakePHP 3.4: set up an email transport only for tests

I'm trying to write tests for an action that sends an email, using get() / posts() methods provided by the IntegrationTestCase class. The code is something like this: $this->getMailer('User') ->set('someVarName', 'someVarValue) …
Mirko Pagliai
  • 1,220
  • 1
  • 19
  • 36
3
votes
1 answer

How to include a class from outside of cakephp folder

Please see my current file structure CakePHP - bin - config - src - vendor - webroot RowPHP - push.php I want to import/include Push class into my cakephp2 application which stands at push.php file outside of cakephp Which I have…
tarikul05
  • 1,843
  • 1
  • 16
  • 24
2
votes
0 answers

$this->Auth->identify(); returns false cakephp 3.4

I am not able to get user details as $this->Auth->identify(); returns false. I am not using DefaultPasswordHasher. Instead i am using LegacyPasswordHasher. Below code is for LegacyPasswordHasher:
Varuni N R
  • 802
  • 3
  • 11
  • 31
2
votes
2 answers

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 cookies for 2 sec after that it's redirecting to…
Ashok
  • 184
  • 2
  • 14
2
votes
1 answer

Router::url printing localhost in Shell in CakePHP 3

I'm working on CakePHP 3.4 I have a shell script to run as cron and send email to the user, email contains a link back to the website to specified controller. To achieve this, I'm using Router::url() in the Shell to generate base url becuase…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
2
votes
1 answer

CakePHP 3.4: query where or matching

I read the cookbook, but I can not figure out how to combine in a single query a matching() and a orWhere(). Example: I have Photo that belongs from Album. Both have the active field. So I'm trying to write a findInactive() method. A "inactive"…
Mirko Pagliai
  • 1,220
  • 1
  • 19
  • 36
1
vote
1 answer

Cakephp 3 unauthorizedRedirect not working

I'm doing a page trying to set the unauthorizedRedirect for the auth component in the AppController and is not working, it does nothing. i have tried putting it on false and nothing works This is the app controller public function initialize() { …
1
vote
1 answer

How to use own element file for flash instead of Bootstrap-ui's default, CakePHP 3?

I am using bootstrap-ui plugin for Form but it automatically loads flash. I want to use my own element file for Success/Error/Warning etc but bootstrap-ui automatically uses its default.ctp element for rending flash message. So how can I use my own…
1
vote
1 answer

Use OR conditions on associated model in CakePHP 3

I have 3 models, the base model is Jobs and Customers, Contacts are the models associated with jobs. Here is the association. $this->belongsTo('Customers', [ 'className' => 'Customers', 'foreignKey' => 'customer_id', …
bikash.bilz
  • 821
  • 1
  • 13
  • 33
1
vote
0 answers

Cakephp3 / PHP72 Paginator, Parameter must be an array or an object that implements Countable

After migrating from php5.6 to php7.2 a classical row goes to this error $books = $this->paginate($query, ['limit' => 10]); I read about first use ->toList() before using count() but in this case... Any idea how can i solve this ? I use cakephp…
Konya Istvan
  • 41
  • 1
  • 4
1
vote
0 answers

cakephp 3.5 gives empty result but the query generated by query builder gives data if executed at mysql

The following code gives empty result but if the query which is generated by the query builder is executed in mysql console than it returns value. Code: $query = $this->Vehicles->find() ->where([ 'Vehicles.first_enlisting_date IS…
Mushfiqur Rahman
  • 306
  • 4
  • 18
1
vote
1 answer

How to set and get Cookies in Cakephp 3.5

I have read the Cakephp documentation but it doesn't working well. Here is my code, $this->response = $this->response->withCookie('remember_me', [ 'value' => 'yes', 'path' => '/', 'httpOnly' => true, 'secure' => false, 'expire'…
Zahid
  • 470
  • 1
  • 3
  • 15
1
vote
0 answers

convert hyphened url to controller action in cakephp 3. Like add-user should call users/add and so on for every controller and action

I want to create route to run contoller and action separated by hyphen(-) instead of calling controller/action. I tried below code : Router::scope( '/add-user', ['controller' => 'Users'], function(RouteBuilder $routes){ …
1
2 3
9 10