# |
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, |
# |
Jun 22nd 2021, 09:26 |
slackebot1 |
```<?php /** * Article Fixture */ class ArticleFixture extends CakeTestFixture { /** * Import * * @var array */ public $import = [ 'model' => 'Article', 'records' => false, 'options' => [ 'conditions' => ['Article.id IN' => [1, 2, 3, 4]] ] ]; public $records = []; public function init() { $recordsImportOptions = null; if (array_key_exists('options', $this->import) andand empty($this->records)) { |
# |
Jun 22nd 2021, 09:26 |
slackebot1 |
null, array_keys($this->fields)), 'table' => $db->fullTableName($model), 'alias' => $model->alias, 'conditions' => array(), 'order' => null, 'limit' => null, 'group' => null ); $records = $db->fetchAll($db->buildStatement($query, $model), false, $model->alias);``` So i create a fixture in a specific folder, and in this fixture i have overwritten the init() method. It's work but i feel it heavy if there are several fixtures involved. |
# |
Jun 22nd 2021, 09:26 |
adrienlambertwac |
[CakePhp2.10][PhpUnit3.7] Import records in Fixture Hi everyone, Do you know the best way to import specific record into fixture ? I want to test specific records with id, and just import this ones. And when i check the *init()* method in *Cake\TestSuite\Fixture\CakeTestFixture.php* the "conditions" option is initialized with empty array. ```$this->records = array(); $query = array( 'fields' => $db->fields($model, |
# |
Jun 22nd 2021, 09:02 |
etibor |
yes that would be the easier solution thank you @steinkel |
# |
Jun 22nd 2021, 08:50 |
steinkel |
`if ($person_name) { $query->where(...) }` you can check if the $person_name is null in your code and decide which condition to apply in the where |
# |
Jun 22nd 2021, 08:46 |
etibor |
```COALESCE``` ? |
# |
Jun 22nd 2021, 08:44 |
etibor |
do you have any suggest? |
# |
Jun 22nd 2021, 08:43 |
etibor |
and search for e-mail address, return the record with exact e-mail and name is null(not the other fields) |
# |
Jun 22nd 2021, 08:42 |
etibor |
just need a solution when name is null but the email is not |
# |
Jun 22nd 2021, 08:42 |
etibor |
yes i checked this in mysql its works exactly like this |
# |
Jun 22nd 2021, 08:35 |
conehead |
So what are you expecting? |
# |
Jun 22nd 2021, 08:16 |
etibor |
but in this case the rest of the filter fields does not work and return all of the records with name NULL |
# |
Jun 22nd 2021, 08:15 |
etibor |
i tried to combine with following: `->Where(['OR'=>[['People.name IS NULL'],['People.name LIKE'=>'%'.($person_name).'%']]])` |
# |
Jun 22nd 2021, 08:14 |
etibor |
sometimes People's name is null in my db |
# |
Jun 22nd 2021, 08:14 |
etibor |
i have tiny issue with using find with LIKE'=>'%'.$name.'%' because it does not work when the value is NULL `->Where(['People.name LIKE'=>'%'.($person_name).'%'])` |
# |
Jun 22nd 2021, 08:12 |
etibor |
hello everyone |
# |
Jun 22nd 2021, 07:41 |
kevin.pfeifer |
hreflang link tags improve your SEO rating https://webmasters.stackexchange.com/questions/105998/what-is-the-difference-between-html-lang-tag-and-html-hreflang-tag the html lang value is usually only there to indicate the current language of the DOM |
# |
Jun 22nd 2021, 06:56 |
slackebot1 |
Just had problems with auto correction when switching languages and was wondering if this could have anything to do with it |
# |
Jun 22nd 2021, 06:56 |
conehead |
@angelxmoreno yeh, thanks I read that already, but it somehow seemed like it does not make too much of a difference if its set to en or any other language. I know it would be a tiny "tool", but I resolved it with the following line now: ```<html lang="<?= substr(Configure::read('App.defaultLocale', 'en_EN'), 0, 2) ?>">``` And I have to admit although my mother language is german, I have never really used the lang tag as well. |
# |
Jun 22nd 2021, 06:20 |
angelxmoreno |
tbh i never set it in the 21 years i’ve been coding even back in the html4 days. my audience and language has always been the US and english..boring i know |
# |
Jun 22nd 2021, 06:18 |
angelxmoreno |
@conehead why it matters --> https://www.w3.org/International/questions/qa-html-language-declarations#langvalues what “tools” ? would you like to see? |
# |
Jun 22nd 2021, 05:32 |
conehead |
Is there actually a need/advantage to change "<html lang="en">" to the correct language? Does ist affect the page in many ways? Was just wondering cause Cake does not seem to have any tools for this? |
# |
Jun 22nd 2021, 05:32 |
conehead |
Good morning everyone! |
# |
Jun 21st 2021, 19:22 |
kevin.pfeifer |
@vinicius.big I would create a global `var MY_I18N` variable an populate it with the translations you need |
# |
Jun 21st 2021, 19:19 |
kevin.pfeifer |
what :point_up: said :) I though you had other variables outside the anonymous function which you need but accessing variables inside the class/object (you are in a Table object space here) can be done via $this without passing the via the `use` |
# |
Jun 21st 2021, 19:19 |
vinicius.big |
hey folks! What is your suggestion to translate JS strings on Cake? There is a lot of JS libraries for this but, I would like to see your experience on it |
# |
Jun 21st 2021, 19:12 |
greg138 |
As for what do do in the function, do everything that needs to be "all or nothing" saved. |
# |
Jun 21st 2021, 19:11 |
greg138 |
You should be able to access `$this` in that function without any issue, so need real need to pass in the model either (you can use `$this->Tags`). |
# |
Jun 21st 2021, 19:09 |
alamnaryab |
yes that was the issue even without return false it worked now next step @kevin.pfeifer Should I pass $this->request->getData() to this anonymous function or make separate function for each model e.g next I have to save record in notification table saying "Logged-in-user has saved new tag at id = newly-saved-Tag->id" |
# |
Jun 21st 2021, 18:59 |
greg138 |
Any chance you're using a database that just doesn't support rollback? The MyISAM engine in MySQL, for example, doesn't. |