# |
Jun 23rd 2021, 19:52 |
tyler.adam.lazenby |
So I tried the solution that was given yesterday on how to exclude an action from csrf protection checks... but when I test it... this is the error I get |
# |
Jun 23rd 2021, 15:01 |
joacir.santos |
So, I missunderstood the setter concept on entity. Appreciate your help! |
# |
Jun 23rd 2021, 14:52 |
joepferguson |
Submitted 2 talks. Thanks for the reminder! |
# |
Jun 23rd 2021, 14:46 |
joepferguson |
Chris: there's some ideas on the submit page https://cakefest.org/submit • CakePHP features • Optimization and performance • Development and deployment techniques • Integration with other packages or platforms • Plugins and extending the framework • CakePHP 4 • Successful projects in CakePHP |
# |
Jun 23rd 2021, 14:44 |
dereuromark |
Thats what behaviors are for, after all ;) Check out alone my tools ones, a huge list of specific things to modify specific fields with. I always try to keep these things out of entities, as this can only blow up. |
# |
Jun 23rd 2021, 14:42 |
chris301 |
what sort of things might you be looking for? |
# |
Jun 23rd 2021, 14:39 |
ndm |
Long story short, if you want to store base64 encoded data, use either `beforeSave`, or a custom database type. |
# |
Jun 23rd 2021, 14:39 |
amanda.goff |
As soon as talk submissions close! We planned maybe the end of this month but may extend through July. I will PM you each soon to discuss details :cake::cake::) |
# |
Jun 23rd 2021, 14:39 |
slackebot |
saved, ie the decoded value returned from your getter will land in the database. Basically your code is a complex noop. |
# |
Jun 23rd 2021, 14:39 |
ndm |
The value passed to the getter method is the value as it exists in the entity, the getter method can then return it in a modified fashion, it's intended to work that way. The setter receives the value passed from the outside when setting a property, the modified value will be stored in the entity. The getter/accessor will not only be invoked when you read the value in your code, it will also be invoked when the entity is being |
# |
Jun 23rd 2021, 14:38 |
joacir.santos |
Yea, I had use beforeSave too in cake 2, I am migrating to cake 4 and had think now I have should use setter to do it. |
# |
Jun 23rd 2021, 14:34 |
jamison508 |
I'm really not sure. I've never used an entity setter in Cake, only ever used beforeSave. |
# |
Jun 23rd 2021, 14:33 |
joacir.santos |
I had imagine the setter had must be used to convert the field and save on database converted. It´s wrong? |
# |
Jun 23rd 2021, 14:30 |
joacir.santos |
I agree about the args on getters, but I saw it like this in cake book reference. |
# |
Jun 23rd 2021, 14:26 |
jamison508 |
Secondarily, unless it is critical that the name be base64-encoded on the entity, if you are OK with it being unencoded until you actually save to the database, this might be better handled in the table's `beforeSave()` |
# |
Jun 23rd 2021, 14:25 |
jamison508 |
Why are you passing a parameter to `_getName()`? Shouldn't that just be a basic getter with no args? |
# |
Jun 23rd 2021, 14:24 |
kevin.pfeifer |
I was curious about the same question :) |
# |
Jun 23rd 2021, 14:23 |
jamison508 |
Already submitted, any hints as to when we'll hear back? :) |
# |
Jun 23rd 2021, 14:22 |
slackebot |
$this->Users->get(1, ['fields' => ['id', 'name']]); $this->assertEquals('joacir', $saved->name); // success $this->assertEquals('joacir', $user->name); // fail, why???? I think it suppose to be saved in base64 ``` |
# |
Jun 23rd 2021, 14:22 |
joacir.santos |
Greetings guys! I am have some dificulty to understand why my field do not save like it suppose to, using entity mutetor on field: ```// on entity protected function _setName($name) { if (!empty($name)) { $name = base64_encode($name); } return $name; } // test $user = $this->Users->get(1, ['fields' => ['id', 'name']]); $user->name = 'joacir'; $saved = $this->Users->save($user); $user = |
# |
Jun 23rd 2021, 14:21 |
martin |
I’m not really a speaker |
# |
Jun 23rd 2021, 14:17 |
amanda.goff |
@channel - REMINDER: if anyone is interested in being a speaker for virtual CakeFest in October, please submit your talk (you just need a quick description) at CakeFest.org. :cake: |
# |
Jun 23rd 2021, 11:32 |
drashti.b.patel |
No problem |
# |
Jun 23rd 2021, 09:42 |
drashti.b.patel |
ok will check thank you for your help |
# |
Jun 23rd 2021, 09:35 |
drashti.b.patel |
It is showing when I run rector command "sudo bin/cake upgrade rector --rules cakephp40 <path/to/app/src>" It seems because it is using the "https://github.com/phpstan/phpstan" package and when I checked separately through the phpstan command then also showing similar error. |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Configure::read('Config.CDN_IMG_URL')); Configure::write('App.cssBaseUrl', Configure::read('Config.CDN_CSS_URL')); Configure::write('App.jsBaseUrl', Configure::read('Config.CDN_JS_URL')); $transactionListener = new TransactionListener(); EventManager::instance()->on($transactionListener);``` |
# |
Jun 23rd 2021, 09:15 |
slackebot |
correctly pluralize or singularize * table, model, controller names or whatever other string is passed to the * inflection functions. */ //Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']); //Inflector::rules('irregular', ['red' => 'redlings']); //Inflector::rules('uninflected', ['dontinflectme']); //Inflector::rules('transliteration', ['/å/' => 'aa']); Configure::write('App.imageBaseUrl', |
# |
Jun 23rd 2021, 09:15 |
slackebot |
enables the automatic conversion of * locale specific date formats. For details see * @link https://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data */ Type::build('time') ->useImmutable(); Type::build('date') ->useImmutable(); Type::build('datetime') ->useImmutable(); Type::build('timestamp') ->useImmutable(); /* * Custom Inflector rules, can be set to |
# |
Jun 23rd 2021, 09:15 |
slackebot |
ServerRequest::addDetector('mobile', function ($request) { $detector = new \Detection\MobileDetect(); return $detector->isMobile(); }); ServerRequest::addDetector('tablet', function ($request) { $detector = new \Detection\MobileDetect(); return $detector->isTablet(); }); /* * Enable immutable time objects in the ORM. * * You can enable default locale format parsing by adding calls * to `useLocaleParser()`. This |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Email::setConfig(Configure::consume('Email')); Log::setConfig(Configure::consume('Log')); Security::setSalt(Configure::consume('Security.salt')); /* * The default crypto extension in 3.0 is OpenSSL. * If you are migrating from 2.x uncomment this code to * use a more compatible Mcrypt based implementation */ //Security::engine(new \Cake\Utility\Crypto\Mcrypt()); /* * Setup detectors for mobile and tablet. */ |
# |
Jun 23rd 2021, 09:15 |
slackebot |
{ $s = null; if (env('HTTPS')) { $s = 's'; } $httpHost = env('HTTP_HOST'); if (isset($httpHost)) { Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); } unset($httpHost, $s); } Cache::setConfig(Configure::consume('Cache')); ConnectionManager::setConfig(Configure::consume('Datasources')); TransportFactory::setConfig(Configure::consume('EmailTransport')); |
# |
Jun 23rd 2021, 09:15 |
slackebot |
ConsoleErrorHandler(Configure::read('Error')))->register(); } else { (new ErrorHandler(Configure::read('Error')))->register(); } /* * Include the CLI bootstrap overrides. */ if ($isCli) { require __DIR__ . '/bootstrap_cli.php'; } /* * Set the full base URL. * This URL is used as the base of all absolute links. * * If you define fullBaseUrl in your config file you can remove this. */ if (!Configure::read('App.fullBaseUrl')) |
# |
Jun 23rd 2021, 09:15 |
slackebot |
correct encoding. */ mb_internal_encoding(Configure::read('App.encoding')); /* * Set the default locale. This controls how dates, number and currency is * formatted and sets the default language to use for translations. */ ini_set('intl.default_locale', Configure::read('App.defaultLocale')); /* * Register application error and exception handlers. */ $isCli = PHP_SAPI === 'cli'; if ($isCli) { (new |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Configure::write('Cache._cake_core_.duration', '+1 years'); // disable router cache during development Configure::write('Cache._cake_routes_.duration', '+1 years'); } /* * Set the default server timezone. Using UTC makes time calculations / conversions easier. * Check http://php.net/manual/en/timezones.php for list of valid timezone strings. */ date_default_timezone_set('UTC'); /* * Configure the mbstring extension to use the |
# |
Jun 23rd 2021, 09:15 |
slackebot |
exit($e->getMessage() . "\n"); } /* * Load an environment local configuration file. * You can use a file like app_local.php to provide local overrides to your * shared configuration. */ //Configure::load('app_local', 'default'); /* * When debug = true the metadata cache should only last * for a short time. */ if (Configure::read('debug')) { Configure::write('Cache._cake_model_.duration', '+1 years'); |
# |
Jun 23rd 2021, 09:15 |
slackebot |
and inject configuration into various * CakePHP classes. * * By default there is only one configuration file. It is often a good * idea to create multiple configuration files, and separate the configuration * that changes from configuration that does not. This makes deployment simpler. */ try { Configure::config('default', new PhpConfig()); Configure::load('app', 'default', false); } catch (\Exception $e) { |
# |
Jun 23rd 2021, 09:15 |
slackebot |
risks * and decreased performance on each request. The purpose of the .env file is to emulate * the presence of the environment variables like they would be present in production. */ // if (!env('APP_NAME') andand file_exists(CONFIG . '.env')) { // $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']); // $dotenv->parse() // ->putenv() // ->toEnv() // ->toServer(); // } /* * Read configuration file |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Cake\Mailer\Email; use Cake\Mailer\TransportFactory; use Cake\Utility\Inflector; use Cake\Utility\Security; use Cake\Event\EventManager; use App\Event\TransactionListener; /** * Uncomment block of code below if you want to use `.env` file during development. * You should copy `config/.env.default to `config/.env` and set/modify the * variables as required. * * It is HIGHLY discouraged to use a .env file in production, due to security |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Registering the CakePHP autoloader. * - Setting the default application paths. */ require CORE_PATH . 'config' . DS . 'bootstrap.php'; use Cake\Cache\Cache; use Cake\Console\ConsoleErrorHandler; use Cake\Core\Configure; use Cake\Core\Configure\Engine\PhpConfig; use Cake\Core\Plugin; use Cake\Database\Type; use Cake\Datasource\ConnectionManager; use Cake\Error\ErrorHandler; use Cake\Http\ServerRequest; use Cake\Log\Log; use |
# |
Jun 23rd 2021, 09:15 |
slackebot |
Foundation, Inc. (https://cakefoundation.org) * @link https://cakephp.org CakePHP(tm) Project * @since 0.10.8 * @license https://opensource.org/licenses/mit-license.php MIT License */ /* * Configure paths required to find CakePHP + general filepath constants */ require __DIR__ . '/paths.php'; /* * Bootstrap CakePHP. * * Does the various bits of setup that CakePHP needs to do. * This includes: * * - |
# |
Jun 23rd 2021, 09:15 |
drashti.b.patel |
Yes, please find that file here: ```<?php /** * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software |