# |
Jun 22nd 2021, 11:12 |
neon1024 |
I guess it just dies when the request instance does |
# |
Jun 22nd 2021, 11:12 |
kevin.pfeifer |
``` $cookie = Cookie::create( 'remember_my_data', $data ); $this->response = $this->response->withCookie( $cookie );``` |
# |
Jun 22nd 2021, 11:10 |
neon1024 |
`$this->getRequest()->getCookieCollection()->add($cookie);` I’ve tried this and no cookie shows in my browser debug tools |
# |
Jun 22nd 2021, 11:10 |
neon1024 |
Stupid question but how do I write a cookie which will persist across requests? |
# |
Jun 22nd 2021, 10:21 |
kevin.pfeifer |
even if it is tidious |
# |
Jun 22nd 2021, 10:21 |
kevin.pfeifer |
otherwise I would personally just go from error to error till it works ^^ |
# |
Jun 22nd 2021, 10:20 |
drashti.b.patel |
ok will check thanks for the help |
# |
Jun 22nd 2021, 10:19 |
neon1024 |
Ahh, just found `$this->getRequest()->getSession()->id()` |
# |
Jun 22nd 2021, 10:19 |
kevin.pfeifer |
never done it myself so no promises :shrug: |
# |
Jun 22nd 2021, 10:18 |
kevin.pfeifer |
but I have heard that it can be quite finicky to setup |
# |
Jun 22nd 2021, 10:18 |
kevin.pfeifer |
there is a rector tool which partially upgrades your code https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html |
# |
Jun 22nd 2021, 10:17 |
drashti.b.patel |
Or Is there any shortcut or any command line to update it |
# |
Jun 22nd 2021, 10:16 |
neon1024 |
I was looking at `Session::create()` but doesn’t seem to be it |
# |
Jun 22nd 2021, 10:16 |
drashti.b.patel |
In most of the controller I have used the initialize() function Do I need to set the return param every where? |
# |
Jun 22nd 2021, 10:16 |
neon1024 |
Anyone know how I can restore / reconnect to a session by using the ID from the Cookie? |
# |
Jun 22nd 2021, 10:15 |
drashti.b.patel |
public function middleware($middlewareQueue) and when I fixed it to public function middleware($middlewareQueue): MiddlewareQueue |
# |
Jun 22nd 2021, 10:14 |
kevin.pfeifer |
which does not have the same parameters as the core one |
# |
Jun 22nd 2021, 10:14 |
kevin.pfeifer |
your `src/Application.php` has a middleware function |
# |
Jun 22nd 2021, 10:14 |
kevin.pfeifer |
yes, you now need to adjust your code according to the errors shwon |
# |
Jun 22nd 2021, 10:13 |
slackebot1 |
Fatal error: Declaration of App\Application::middleware($middlewareQueue) must be compatible with Cake\Http\BaseApplication::middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue in /var/www/html/cp-kickpages/src/Application.php on line 72``` |
# |
Jun 22nd 2021, 10:13 |
drashti.b.patel |
It worked for the installation but after that when I tried to run application showing below error: Child process error (exit code 255): PHP Fatal error: Declaration of App\Application::middleware($middlewareQueue) must be compatible with ``` Cake\Http\BaseApplication::middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue in /var/www/html/cp-kickpages/src/Application.php on line 72 |
# |
Jun 22nd 2021, 10:09 |
drashti.b.patel |
ok |
# |
Jun 22nd 2021, 10:09 |
kevin.pfeifer |
try to remove the composer.lock and vendor folder and then re-install everything with ```composer install``` |
# |
Jun 22nd 2021, 10:08 |
kevin.pfeifer |
|
# |
Jun 22nd 2021, 10:04 |
slackebot1 |
"minimum-stability": "stable", "prefer-stable": true } |
# |
Jun 22nd 2021, 10:04 |
slackebot1 |
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests", "Elements\\Test\\": "./plugins/Elements/tests", "Admin\\": "plugins/Admin/src/" } }, "scripts": { "post-install-cmd": "App\\Console\\Installer::postInstall", "post-create-project-cmd": "App\\Console\\Installer::postInstall", "//post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump" }, |
# |
Jun 22nd 2021, 10:04 |
slackebot1 |
tests to be run without system-wide install.", "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP." }, "autoload": { "psr-4": { "App\\": "src", "Elements\\": "./plugins/Elements/src", "Admin\\": "plugins/Admin/src/" } }, "autoload-dev": { "psr-4": { "App\\Test\\": "tests", |
# |
Jun 22nd 2021, 10:04 |
slackebot1 |
"dereuromark/cakephp-tools": "^2.0", "cakephp/debug_kit": "^4.0.0", "stripe/stripe-php": "^7.24", "paypal/rest-api-sdk-php": "*", "phpunit/phpunit": "^8.5", "cakephp/bake": "^2.0.3", "cakephp/cakephp-codesniffer": "~4.1.0" }, "require-dev": { "psy/psysh": "@stable", "phpstan/phpstan": "^0.12.18" }, "suggest": { "phpunit/phpunit": "Allows automated |
# |
Jun 22nd 2021, 10:04 |
drashti.b.patel |
{ "name": "cakephp/app", "description": "CakePHP skeleton app", "homepage": "http://cakephp.org", "type": "project", "license": "MIT", "require": { "php": ">=5.5.9", "cakephp/cakephp": "^4.0", "mobiledetect/mobiledetectlib": "2.*", "cakephp/migrations": "^3.0@beta", "cakephp/plugin-installer": "*", "dereuromark/cakephp-queue": "^5.4", |
# |
Jun 22nd 2021, 10:03 |
kevin.pfeifer |
can you share your composer.json? |
# |
Jun 22nd 2021, 10:00 |
drashti.b.patel |
I tried to downgrade those version and it is showing the lower version in composer.json file but while running this commend always showing this |
# |
Jun 22nd 2021, 09:52 |
steinkel |
you can also try this nice tool done by @dereuromark https://toolbox.dereuromark.de/utilities/upgrade |
# |
Jun 22nd 2021, 09:52 |
kevin.pfeifer |
your installed plugins require either cakephp 4.1 or 4.2 |
# |
Jun 22nd 2021, 09:52 |
kevin.pfeifer |
try ```composer require --update-with-dependencies "cakephp/cakephp:^4.2"``` |
# |
Jun 22nd 2021, 09:48 |
slackebot1 |
2.5.1 requires cakephp/cakephp ^4.1 -> found cakephp/cakephp[4.1.0, ..., 4.2.7] but it conflicts with your root composer.json require (4.0.*). Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. Installation failed, reverting ./composer.json and ./composer.lock to their original content. |
# |
Jun 22nd 2021, 09:48 |
slackebot1 |
composer.json require (4.0.*). Problem 2 - cakephp/debug_kit is locked to version 4.4.3 and an update of this package was not requested. - cakephp/debug_kit 4.4.3 requires cakephp/cakephp ^4.2.0 -> found cakephp/cakephp[4.2.0, ..., 4.2.7] but it conflicts with your root composer.json require (4.0.*). Problem 3 - cakephp/bake is locked to version 2.5.1 and an update of this package was not requested. - cakephp/bake |
# |
Jun 22nd 2021, 09:48 |
slackebot1 |
--with-dependencies Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - dereuromark/cakephp-tools is locked to version 2.3.0 and an update of this package was not requested. - dereuromark/cakephp-tools 2.3.0 requires cakephp/cakephp ^4.1 -> found cakephp/cakephp[4.1.0, ..., 4.2.7] but it conflicts with your root |
# |
Jun 22nd 2021, 09:48 |
drashti.b.patel |
Hi everyone, I am upgrading cakephp version from 3.9 to 4.0. I am following the "https://www.cakedc.com/rafael_queiroz/2020/09/15/upgrading-to-cakephp-4" and original doc but having an issue while doing the dependency update for a composer. Please find the error given below: composer require --update-with-dependencies "cakephp/cakephp:4.0.*" ./composer.json has been updated Running composer update cakephp/cakephp |
# |
Jun 22nd 2021, 09:26 |
slackebot1 |
!empty($records)) { $this->records = Hash::extract($records, '{n}.' . $model->alias); } } } }``` May be i missed a configuration in the doc ? Or if you have a better solution than mine. Thanks :) |
# |
Jun 22nd 2021, 09:26 |
slackebot1 |
!isset($this->import['connection']) ? 'default' : $this->import['connection'] ); $db = $model->getDataSource(); $query = [ 'fields' => $db->fields($model, null, array_keys($this->fields)), 'table' => $db->fullTableName($model), 'alias' => $model->alias, ] + $recordsImportOptions; $records = $db->fetchAll($db->buildStatement($query, $model), false, $model->alias); if ($records !== false andand |
# |
Jun 22nd 2021, 09:26 |
slackebot1 |
$recordsImportOptions = $this->import['options']; $this->import['records'] = false; } parent::init(); if (!is_null($recordsImportOptions)) { list($plugin, $modelClass) = pluginSplit($this->import['model'], true); App::uses($modelClass, $plugin . 'Model'); if (!class_exists($modelClass)) { throw new MissingModelException(array('class' => $modelClass)); } $model = new $modelClass( null, null, |