# |
Jan 11th 2020, 08:31 |
alexdd55976 |
morning |
# |
Jan 11th 2020, 05:21 |
akhil.mohan |
Never mind, I found the problem |
# |
Jan 11th 2020, 04:31 |
slackebot |
implements AuthenticationServiceProviderInterface to src/Application.php breaks everything in results in HTTP 500 error. The lines that I have changed inside src/Application.php are listed here https://pastebin.com/GhuRWypy I would appreciate if anyone help on this. |
# |
Jan 11th 2020, 04:31 |
akhil.mohan |
Hey Everyone, I am trying to setup CakePHP 4 with authentication. Tried following the examples https://book.cakephp.org/4/en/tutorials-and-examples/cms/authentication.html and https://book.cakephp.org/authentication/2/en/index.html Both of the examples lead me to an error: Subject must be an instance of Authentication\AuthenticationServiceInterfaceorAuthentication\AuthenticationServiceProviderInterface, App\Application given. Also adding |
# |
Jan 11th 2020, 03:55 |
latenal |
input mask sucks. I found a workaround modifying the values in beforeMarchal |
# |
Jan 11th 2020, 03:31 |
admad |
Just don't accept such values, use input masks in UI for comma separated disply and submit standard values only |
# |
Jan 11th 2020, 02:33 |
latenal |
Hi guys! how do you fix numbers with commas during validation? I mean things like “1,000” |
# |
Jan 10th 2020, 20:08 |
phantomwatson |
`->requirePresence('fieldname', false)` would cover the condition of the field not being present in the data array, but I want to avoid tripping any validation errors if it _is_ present and `null`. |
# |
Jan 10th 2020, 19:56 |
phantomwatson |
`Validation::isInteger()` looks like it would fail for `null`, but the `allowEmptyFoo()` methods seem to all expect empty values of non-null types. |
# |
Jan 10th 2020, 19:53 |
phantomwatson |
I'm somehow forgetting a basic validation thing for CakePHP 3. If a field is a nullable integer field, does `$validator->integer('fieldname')` cover that, or is an `->allowEmptyFoo()` rule also necessary? With `allowEmpty()` being deprecated, I forget what the equivalent is of "allow null values". |
# |
Jan 10th 2020, 17:35 |
sdevore |
Bake will offer to overwrite if I remember correctly and will ask you confirm |
# |
Jan 10th 2020, 17:28 |
dereuromark |
Since they are not in git, you can easily wipe via ide and delete |
# |
Jan 10th 2020, 16:42 |
jotpe |
I don't think so |
# |
Jan 10th 2020, 16:42 |
wizardfix |
Is there an `unbake` command or will bake wipe out the previous code if I rerun it? |
# |
Jan 10th 2020, 16:41 |
jotpe |
like you did for the users table |
# |
Jan 10th 2020, 16:41 |
jotpe |
Btw.: I would add a id field to your results table |
# |
Jan 10th 2020, 16:41 |
wizardfix |
Ok, thanks @jotpe I'll try that! :) |
# |
Jan 10th 2020, 16:40 |
jotpe |
Yes :) |
# |
Jan 10th 2020, 16:40 |
jotpe |
I would rename the field to avoid ambiguities and rebake |
# |
Jan 10th 2020, 16:40 |
wizardfix |
So maybe if I change the key names to *not* include `_id` could solve it? |
# |
Jan 10th 2020, 16:38 |
jotpe |
@wizardfix in your `results` table you have a field called `job_processing_id.` By convention cake assumes that this is an association with the `job_processings` table which is not existing, I guess. See https://book.cakephp.org/3/en/intro/conventions.html#database-conventions |
# |
Jan 10th 2020, 16:34 |
slackebot |
this error caused by `bake`'s inability to deal with composite primary keys? 2. What would be the best way to overcome it? Abandon the composite primary key and rebake, then add back the key later, or just set up my functionality manually? Or just edit the references to these spurious non-keys in my controller? :) |
# |
Jan 10th 2020, 16:34 |
slackebot |
=> ['JobProcessings', 'TestTypes'],];`. Also in the `add()` and `edit()` methods these spurious fields are referred to, e.g.: `$this->set(compact('result', 'jobProcessings', 'testTypes'));` I This makes me think bake is misinterpreting something, as these are inflexions of just parts of the key names in the primary key: `PRIMARY KEY (job_processing_id, test_type_id, test_counter)` ----------------------------------------- My questions are: 1. Is |
# |
Jan 10th 2020, 16:34 |
wizardfix |
7. I noted the warning, `<warning>Bake cannot generate associations for composite primary keys at this time</warning>.` 8. I pointed the browser at `http://127.0.0.1/trportal/results` and was served an error page, attached, with the message `SQLSTATE[42S02]: Base table or view not found: 1146 Table 'trdb.job_processings' doesn't exist`. 9. If I look in my `ResultsController`, I find the `index()` method has `$this->paginate = ['contain' |
# |
Jan 10th 2020, 16:34 |
slackebot |
template file... Creating file /opt/lampp/htdocs/trportal/src/Template/Results/add.ctp Wrote `/opt/lampp/htdocs/trportal/src/Template/Results/add.ctp` Baking `edit` view template file... Creating file /opt/lampp/htdocs/trportal/src/Template/Results/edit.ctp Wrote `/opt/lampp/htdocs/trportal/src/Template/Results/edit.ctp` Bake All complete.``` |
# |
Jan 10th 2020, 16:34 |
slackebot |
`/opt/lampp/htdocs/trportal/tests/TestCase/Controller/ResultsControllerTest.php` Baking `index` view template file... Creating file /opt/lampp/htdocs/trportal/src/Template/Results/index.ctp Wrote `/opt/lampp/htdocs/trportal/src/Template/Results/index.ctp` Baking `view` view template file... Creating file /opt/lampp/htdocs/trportal/src/Template/Results/view.ctp Wrote `/opt/lampp/htdocs/trportal/src/Template/Results/view.ctp` Baking `add` view |
# |
Jan 10th 2020, 16:34 |
slackebot |
Baking controller class for Results... Creating file /opt/lampp/htdocs/trportal/src/Controller/ResultsController.php Wrote `/opt/lampp/htdocs/trportal/src/Controller/ResultsController.php` Bake is detecting possible fixtures... Baking test case for App\Controller\ResultsController ... Creating file /opt/lampp/htdocs/trportal/tests/TestCase/Controller/ResultsControllerTest.php Wrote |
# |
Jan 10th 2020, 16:34 |
slackebot |
/opt/lampp/htdocs/trportal/tests/Fixture/ResultsFixture.php Wrote `/opt/lampp/htdocs/trportal/tests/Fixture/ResultsFixture.php` Deleted `/opt/lampp/htdocs/trportal/tests/Fixture/empty` Bake is detecting possible fixtures... Baking test case for App\Model\Table\ResultsTable ... Creating file /opt/lampp/htdocs/trportal/tests/TestCase/Model/Table/ResultsTableTest.php Wrote `/opt/lampp/htdocs/trportal/tests/TestCase/Model/Table/ResultsTableTest.php` |
# |
Jan 10th 2020, 16:34 |
slackebot |
`/opt/lampp/htdocs/trportal/src/Model/Table/ResultsTable.php` Deleted `/opt/lampp/htdocs/trportal/src/Model/Table/empty` Baking entity class for Result... Creating file /opt/lampp/htdocs/trportal/src/Model/Entity/Result.php Wrote `/opt/lampp/htdocs/trportal/src/Model/Entity/Result.php` Deleted `/opt/lampp/htdocs/trportal/src/Model/Entity/empty` Baking test fixture for Results... Creating file |
# |
Jan 10th 2020, 16:34 |
slackebot |
results`, with the following result: ```$ ./bin/cake bake all results Bake All --------------------------------------------------------------- One moment while associations are detected. <warning>Bake cannot generate associations for composite primary keys at this time</warning>. Baking table class for Results... Creating file /opt/lampp/htdocs/trportal/src/Model/Table/ResultsTable.php Wrote |
# |
Jan 10th 2020, 16:34 |
slackebot |
url VARCHAR(1024), added_by INT(11) UNSIGNED, added_on DATETIME, FOREIGN KEY (added_by) REFERENCES users(id), PRIMARY KEY (job_processing_id, test_type_id, test_counter) );``` 3. I edited `config/app.php` with database access credentials. 4. I checked the default landing page and got all 9 green chef's hats. 5. I ran `./bin/cake bake all users` successfully. All user actions perform as expected. 6. I ran `./bin/cake bake all |
# |
Jan 10th 2020, 16:34 |
slackebot |
NOT NULL, status TINYINT(1) UNSIGNED DEFAULT 1, created_by INT(11) UNSIGNED, FOREIGN KEY (created_by) REFERENCES users(id), created_on DATETIME ); CREATE TABLE results ( job_processing_id INT(11) UNSIGNED, test_type_id INT(5) UNSIGNED, test_counter INT(5) UNSIGNED, number VARCHAR(20), country VARCHAR(100), start_time DATETIME, end_time DATETIME, connect_time DATETIME, score FLOAT(5, 2) UNSIGNED, |
# |
Jan 10th 2020, 16:34 |
wizardfix |
Hi. :) I have a baking problem with which I would be grateful for help: *Error baking table* 1. I created a CakePHP 3.8 app, `trportal`. 2. I created `trdb`, a database of two tables (`users` and `results`) with the below SQL: ```CREATE TABLE users ( id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(128) NOT NULL, email VARCHAR(512) NOT NULL UNIQUE, admin TINYINT(1) UNSIGNED DEFAULT 0, password VARCHAR(128) |
# |
Jan 10th 2020, 16:20 |
jotpe |
Nothin seems to work. |
# |
Jan 10th 2020, 16:20 |
jotpe |
```public function beforeRender(Event $event) { parent::beforeRender($event); $this->viewBuilder()->helpers(['Users.User']); }``` |
# |
Jan 10th 2020, 16:20 |
jotpe |
In my AppView: $this->loadHelper('Users.User'); or in my Controller: |
# |
Jan 10th 2020, 16:19 |
jotpe |
And yes it is in a plugin and yes, I used plugin syntax :) |
# |
Jan 10th 2020, 16:19 |
jotpe |
What could cause a helper not to get loaded? |
# |
Jan 10th 2020, 15:56 |
lubos |
when i trying to save text from twitter with emoji into database, i am getting sql error, i would expect this to be escaped. any idea? |
# |
Jan 10th 2020, 15:53 |
neon1024 |
I’m sure the authors would appreciate your help to upgrade them! I know @dereuromark has a big to do list of upgrades, perhaps you could help him out :) |
# |
Jan 10th 2020, 15:53 |
neon1024 |
@ssalvatori This sounds like the plugins your project is using have not been upgraded to cake 4 yet |