# |
May 4th 2021, 08:40 |
erwane |
Could be Session time ? |
# |
May 4th 2021, 08:05 |
eax |
Hey folks! I have system running CakePHP 3.6.14, where I have started experiencing users being logged out at random times, seemingly without rhyme or reason. Does anyone know what that could be? :$ |
# |
May 3rd 2021, 18:33 |
kevin.pfeifer |
personall i can just say that upgrading vom 4.1 to 4.2 was basically efortless when talking about basic functionality. I just had more work to do because I wanted to use the new DI Container which was introduced in 4.2 but thats an experimental feature so ;) |
# |
May 3rd 2021, 18:21 |
kevin.pfeifer |
but thats just what i heard of so sorry ,:) |
# |
May 3rd 2021, 18:20 |
kevin.pfeifer |
I have never used the upgrade tool / rector for upgrading but rather just set `E_ALL` for the errorLevel in the app.php and manually adjusted the code where it throws warnings or notices. Also I have heard that the upgrade tool can be quite "specific" to set up and work with correctly |
# |
May 3rd 2021, 18:13 |
noel |
Any ideas about `unknown command bin/cake upgrade`? |
# |
May 3rd 2021, 17:02 |
kevin.pfeifer |
and `through` Tables/Aliases can only be present on belongsToMany because there is no other association which needs a "join table" aka a table between 2 others to get your data together. Therefore there is no `through` property on any other associations then on (hasAnd)belongsToMany |
# |
May 3rd 2021, 16:38 |
kevin.pfeifer |
or use `cakephp/cakphp:^4.2` for further cakephp updates < 4.x |
# |
May 3rd 2021, 16:38 |
kevin.pfeifer |
https://getcomposer.org/doc/articles/versions.md |
# |
May 3rd 2021, 16:38 |
kevin.pfeifer |
it should be `cakephp/cakphp:4.2.*` |
# |
May 3rd 2021, 16:37 |
kevin.pfeifer |
`cakephp/cakphp:4.2.x` is not a valid composer version string |
# |
May 3rd 2021, 15:09 |
noel |
I’d still like some help with the composer issues above please if anyone reads this. Tx. |
# |
May 3rd 2021, 15:09 |
noel |
Update: seems `getThrough` is available but only on `belongsToMany` type associations, so I was checking for it on the wrong type of association. |
# |
May 3rd 2021, 15:04 |
noel |
I was able to upgrade `cakephp/bake` using the above command, so it is now version 2.5.x but still it gives the same error: ` ```Unknown command `cake upgrade```` |
# |
May 3rd 2021, 15:01 |
noel |
Then (as per migration guide) I tried `bin/cake upgrade rector --rules cakephp42 src` But this also gave an error: ```Unknown command `cake upgrade`. Run `cake --help` to get the list of commands.``` |
# |
May 3rd 2021, 15:01 |
noel |
So I did it manually by editing composer.json file and deleting the lock file. Not ideal. |
# |
May 3rd 2021, 15:00 |
slackebot |
(dev).``` |
# |
May 3rd 2021, 15:00 |
noel |
Also having trouble upgrading from 4.1 to 4.2. Tried this as per the migration guide and got this error ```php /usr/local/bin/composer require --update-with-dependencies "cakephp/cakphp:4.2.x" [InvalidArgumentException] Could not find a matching version of package cakephp/cakphp. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability |
# |
May 3rd 2021, 14:43 |
noel |
I’ve also tried v 4.2.5, no go. |
# |
May 3rd 2021, 14:36 |
noel |
How can I get `className` and `through` properties of an association? |
# |
May 3rd 2021, 14:10 |
erwane |
WoW, thanks |
# |
May 3rd 2021, 13:48 |
admad |
@erwane this should interest you https://github.com/cakephp/cakephp/pull/15477 |
# |
May 3rd 2021, 12:24 |
erwane |
Does anybody use `cakephp/twig-view` ? I've got an error for this :( ```{{ helper_Html_image('logo_square.png', ['class' => 'd-inline-block']) }}``` It's the first time i use Twig |
# |
May 3rd 2021, 11:18 |
erwane |
check 'Fail' in the page content |
# |
May 3rd 2021, 11:18 |
erwane |
AssertFlash test Session content. After renderring, Session is consumed |
# |
May 3rd 2021, 09:23 |
slackebot |
`$this->Flash->error(__('Fail'));` `return $this->redirect(['controller' => 'systems', 'action' => 'import']);` `}` Is this by design or am I doing something wrong? |
# |
May 3rd 2021, 09:23 |
slackebot |
when testing manually. In my ControllerTest I have a positive test case with this check: ```$this->assertFlashMessage('Success');``` This works as expected. I also have a negative test case that fails: ```$this->assertFlashMessage('Fail');``` But this assertion didn’t work. After some investigation, it shows that if I add a redirect to the fail part in my controller code, the assertFlashMessage works: `} else {` |
# |
May 3rd 2021, 09:23 |
peter.harder |
Testing question: In a Controller (SystemsController.php) I have an action called “import” with the following code: `if (isset($system->id)) {` `$this->Flash->success(__('Success'));` `return $this->redirect(['controller' => 'systems', 'action' => 'view', $system->id]);` `} else {` `$this->Flash->error(__('Fail'));` `}` `// Renders normal template with form input for file upload` This works as expected |
# |
May 2nd 2021, 15:58 |
kevin.pfeifer |
but someday it could be, that i want to go deeper and build the whole system myself :) |
# |
May 2nd 2021, 15:58 |
kevin.pfeifer |
since it (at least to me) seem, that cakedc has prepared some utilities to handle e.g. authorization checks in the template |
# |
May 2nd 2021, 15:57 |
kevin.pfeifer |
to be honest currently I would just use cakedc/users instead of building the whole authentication and authroization system myself |
# |
May 2nd 2021, 15:55 |
kevin.pfeifer |
but thanks for sharing your experience :) |
# |
May 2nd 2021, 15:55 |
kevin.pfeifer |
if someday i would encounter that problem |
# |
May 2nd 2021, 15:54 |
kevin.pfeifer |
but in this example i was just curious what the "correct" way would be to handle that |
# |
May 2nd 2021, 15:54 |
kevin.pfeifer |
to be honest i haven't gotten into any performance issues yet with my app :) |
# |
May 2nd 2021, 15:53 |
greg138 |
Refactored a bit to cache that object, and it got a LOT better. |
# |
May 2nd 2021, 15:53 |
kevin.pfeifer |
oh ok |
# |
May 2nd 2021, 15:53 |
greg138 |
It was mostly that it was creating and destroying the object to check permissions for each entity. |
# |
May 2nd 2021, 15:52 |
kevin.pfeifer |
i would guess either caching or correctly set indices on the db will help there a lot |
# |
May 2nd 2021, 15:51 |
kevin.pfeifer |
sure that would be pretty catastrophic |
# |
May 2nd 2021, 15:44 |
greg138 |
Beware of doing this on something that deals with a lot of entities. Had a situation recently where a long page was timing out because it was doing thousands of permission checks, and each one was about 50ms due to a missed opportunity for caching a key object... |