cakephp

CakePHP 3 DefaultPasswordHasher

早过忘川 提交于 2021-02-05 06:10:30
问题 I am working on creating an authentication form that has a password and password_again field in it. So I can check to make sure they match, I am using the beforeSave() function of my UsersTable to take care of the hashing. As a test, I have just set it to show me the password_again, its hashed result and then die. public function beforeSave($event, $entity){ debug($entity->password_again); $hasher = new DefaultPasswordHasher(); $entity->password_again = $hasher->hash($entity->password_again);

Cakephp 4 Windows Installation Issues

杀马特。学长 韩版系。学妹 提交于 2021-01-29 22:33:57
问题 I am running into composer/installation errrors on wamp64 setup on Windows 10... had this working previously on older app but now starting new app on 4.0.3 and running into dependency issues Below is output - Any thoughts on why it's not finding any matching packages? the "myapp" folder is created and cakephp source is copied but then a number of dependencies show "no matching package found" Can these packages be ignored? some, such as migrations fall under "require" in the composer.json I

How to Fix Cakephp 4 Composer Install Error

自闭症网瘾萝莉.ら 提交于 2021-01-29 06:10:22
问题 Having issues installing all packages for cakephp 4.0 via Composer. Running a fresh wamp server install on Windows with PHP 7.4.0 Here is composer output. Using the command found in the cakephp docs. www/> composer create-project --prefer-dist cakephp/app:^4.0 myapp Installing cakephp/app (4.0.0) - Installing cakephp/app (4.0.0): Loading from cache Created project in kollectit Loading composer repositories with package information Updating dependencies (including require-dev) Your

saving belongsToMany association with same keys but different _joinData

限于喜欢 提交于 2021-01-29 05:56:56
问题 I have a belongsToMany relationship between two tables which is configured using a through table. class UsersTable extends Table { public function initialize(array $config) { $this->belongsToMany('Groups', [ 'through' => 'GroupsUsers', ]); } } class GroupsTable extends Table { public function initialize(array $config) { $this->belongsToMany('Users', [ 'through' => 'GroupsUsers', ]); } } class GroupsUsersTable extends Table { public function initialize(array $config) { $this->belongsTo('Groups

saving belongsToMany association with same keys but different _joinData

删除回忆录丶 提交于 2021-01-29 05:49:49
问题 I have a belongsToMany relationship between two tables which is configured using a through table. class UsersTable extends Table { public function initialize(array $config) { $this->belongsToMany('Groups', [ 'through' => 'GroupsUsers', ]); } } class GroupsTable extends Table { public function initialize(array $config) { $this->belongsToMany('Users', [ 'through' => 'GroupsUsers', ]); } } class GroupsUsersTable extends Table { public function initialize(array $config) { $this->belongsTo('Groups

“Wkhtmltopdf didn't return any data” with CakePHP

ぃ、小莉子 提交于 2021-01-28 20:05:23
问题 I am running a CakePHP 2.8 environment and want to print a PDF with wkhtmltopdf. Once, I could create an PDF, then, I didn't used it for few weeks because I was working on something else. Today I restarted to work on that and got the error Message: "WKHTMLTOPDF didn't return any data" APP/Plugin/CakePdf/Pdf/CakePdf.php line 236 → WkHtmlToPdfEngine->output() APP/Plugin/CakePdf/View/PdfView.php line 97 → CakePdf->output(string) CORE/Cake/Controller/Controller.php line 963 → PdfView->render(null

CakePHP 3.x - How to pass pagination configuration directly instead of using the controller `$paginate` property?

↘锁芯ラ 提交于 2021-01-28 19:57:45
问题 The below code works: // Somewhere in the Controller public $paginate = [ 'maxLimit'=>2 ]; // In the method: $query=$this->Model->find('all')->where(....); $this->set('results',$this->paginate($query)); However, I do not want to specify $paginate as public in the controller. I would rather not specify it at all. I tried to move maxLimit setting to the method but I'm doing it incorrectly. How can I change the below code? $query=$this->Model->find('all')->where(....); $this->set('results',$this

Search with concat fields in cakephp 3

感情迁移 提交于 2021-01-28 04:44:01
问题 I need to make a search query using $this->Paginate in CakePHP 3. Following is the code I am using $searchCondition = array( 'OR' => array( 'Quotes.quotenum LIKE' => "%" . $this->request->data['Quote']['keyword'] . "%", 'Branches.name LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'Contacts.fname LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'Contacts.lname LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'CONCAT(Contacts.fname, Contacts.lname)

What's the recommended approach for updating the core lib of a Cakephp3 app

戏子无情 提交于 2021-01-28 04:42:43
问题 I've used composer to install CakePHP 3 while it still was in development, so the composer.json file contains dev-versions. The composer.json file looks like this right now: { "name": "cakephp/app", "description": "CakePHP skeleton app", "homepage": "http://cakephp.org", "type": "project", "license": "MIT", "require": { "php": ">=5.4.16", "cakephp/cakephp": "3.0.*-dev", "mobiledetect/mobiledetectlib": "2.*", "cakephp/migrations": "dev-master", "cakephp/plugin-installer": "*" }, "require-dev":

Change input value based on another input's value

大城市里の小女人 提交于 2021-01-27 11:44:16
问题 hope that title makes sense. I'm a noob at javascript. What I want to do is have a form which will have a couple of inputs like, name and url for example. When the user enters their name, I'd like the url input to automatically have as a default their name with an underscore between words. So if they type in as their name pedro kinkybottom then automatically set as the default in the url input would be pedro_kinkybottom. I'm using cakephp if anyone happens to know a particularly cakey way to