Questions tagged [cakephp-3.x]

Questions about 3.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.

963 questions
2
votes
1 answer

Localization not working in CakePHP 3

# head -n2 src/Locale/de/default.po msgid "route_shop" msgstr "shop" In my controller, I just have exit(__('route_shop')); but it is returning route_shop. ini_get('intl.default_locale'); // returns de (as set in config/bootstrap.php) 'locales' =>…
Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95
2
votes
2 answers

Multiple like in a query with OR

I need to add in this cakephp 3 another "like", the query has to check also in the last_name field. How can i do it, i want to respect the CakePHP 3 rules. thanks. $users = $this->Users ->find() ->where(function ($q) use ($keyword)…
Brian Millot
  • 179
  • 11
2
votes
2 answers

Cakephp 3 Fulltext Search

I am trying to make a FULLTEXT search in Cakephp 3, but there is no native implementation. I can use ->conditions(["MATCH(Ads.title, Ads.text) AGAINST('$search')"]) but this is going to be vulnerable to injections because there is no sanitization…
Lyes BEN
  • 990
  • 4
  • 14
2
votes
1 answer

How do I implement a reusable validator that I have created for cakephp 3?

I have created a validation rule that checks to see if a url actually exists. I can make it work fine if I implement it as a custom rule within my tables validators. However I would like to make it reusable... I have tried a few different ways and I…
David dB
  • 69
  • 1
  • 8
2
votes
2 answers

CakePHP 3: Different login redirection depending on user roles

I'm using CakePHP 3 and trying to change the default route after user is logged in. I want to set default route different depends on user's role_id. I found a solution but it's only for CakePHP 2. I can't use it in CakePHP 3, I can't use Session…
Andrew P.
  • 148
  • 1
  • 3
  • 11
2
votes
2 answers

How to send variables to an element in CakePHP 3.x from a controller and keep variables when using element in a different view?

I created an application that allows admins to save slider content to the database and now I want to include the slider on the home page. I have a Slides controller with a slider function that just send the slides content to the slider view. Here is…
Battousai
  • 503
  • 7
  • 17
2
votes
2 answers

CakePHP 3.0: How to check execution of query builder updating data

I'm using cakePHP 3.0 for back-end API. This is my code. namespace App\Controller; use Cake\Datasource\ConnectionManager; use Cake\ORM\TableRegistry; use App\Controller\AppController; use Cake\Routing\Router; class MainController extends…
2
votes
1 answer

CakePHP 3: Form and Digest Auth in one App

I'm currently developing an application in CakePHP 3, this application contains a Web Front End and a plugin for API/WebServices that serves mobile apps. The web front end login system rely on FORM Based Authentication and work perfectly, but i want…
rcastellanosm
  • 57
  • 3
  • 5
2
votes
1 answer

Can't create simple CakePHP plugin

I would like to create a plugin for CakePHP 3.1.4. The documentation is straight forward, but the example doesn't work (http://book.cakephp.org/3.0/en/plugins.html#creating-your-own-plugins) The steps are: composer create-project --prefer-dist…
ST2OD
  • 705
  • 1
  • 5
  • 15
2
votes
1 answer

CakePHP 3: Scope in Tree behavior

I thought I'd use the tree behavior for my menus as the manual suggests but I've become increasingly confused. I would like to be able to retrieve menu data based on the current controller which i can get from the request object. I thought if i had…
2
votes
1 answer

CakePHP 3 Routing: How to route controller basis

I am using cakephp 3. I want to hide frontends controller in url. My Routes config: Router::connect('/:action', array('controller' => 'frontends')); And I want to refer all function to bloggers controller when url start as…
Abdus Sattar Bhuiyan
  • 3,016
  • 4
  • 38
  • 72
2
votes
0 answers

Missing template rest api CakePHP 3.x

I build a rest api with CakePHP 3.x but when I testing with Postman 3.1.1 is 500 internal server error: The view for UsersController::token() was not found.) In file routes.php : Router::prefix('api', function ($routes) { …
JachMa
  • 21
  • 2
2
votes
3 answers

CakePHP 3.0: Response as json

I'm creating a CakePHP 3.0 REST API. I followed this instructions (routing in the book) and received response in json. Here is my code. 01 src/config/rout.php Router::extensions('json'); 02 src/controler/UsersController.php public function…
1
vote
0 answers

CAKEPHP 3: Like condion special character paginate

I'm having trouble finding likes with special characters as follows in the database i have a record with the name Toan"123 now, in cakephp 3 i use query ORM $sqlSub = $sysLogTable ->find('all', [ 'fields' => array('id' ,'name') …