Log message #4102324

# At Username Text
# Dec 10th 2017, 18:06 Guest24244 its centos
# Dec 10th 2017, 18:03 saeideng `sudo apt-get install all-required-package --package=cakephp-app`
# Dec 10th 2017, 18:00 dereuromark also curl and sqlite is recommended.
# Dec 10th 2017, 18:00 dereuromark same thing on ubuntu and co: php7.1-mbstring
# Dec 10th 2017, 17:58 admad it is
# Dec 10th 2017, 17:57 Guest24244 also command to install php mbstring .. or its not required ?
# Dec 10th 2017, 17:57 Guest24244 :d you guys rock
# Dec 10th 2017, 17:56 admad and if you have a choice switch to debian/ubuntu :slightly_smiling_face:
# Dec 10th 2017, 17:56 dereuromark Google is your friend. I for example only know debian and linux: `sudo apt-get install php7.1-intl` ;)
# Dec 10th 2017, 17:56 admad most likely it's: yum install php-intl
# Dec 10th 2017, 17:55 Guest24244 admad you dont know the command . ?
# Dec 10th 2017, 17:55 admad *install
# Dec 10th 2017, 17:55 admad google how to intall php-intl package on centos
# Dec 10th 2017, 17:54 Guest24244 how to solve it ?
# Dec 10th 2017, 17:54 Guest24244 but it is showing me php ext intl missing..
# Dec 10th 2017, 17:54 Guest24244 i was installing cakephp3 on centos
# Dec 10th 2017, 17:54 Guest24244 hi
# Dec 10th 2017, 14:55 saeideng configShallow is good thing :)
# Dec 10th 2017, 14:55 saeideng by configShallow I able now to use both ``` $this->addBehavior('UploadConfig',['fields'=>['image','img']]); $this->addBehavior('UploadConfig'); ```
# Dec 10th 2017, 14:50 admad well earlier you never mentioned you can skip using the `fields` key when adding the behavior
# Dec 10th 2017, 14:49 saeideng ``` public function initialize(array $config) { $configs = []; foreach ($config as $field => $settings) { if (is_int($field)) { $configs[$settings] = []; } else { $configs[$field] = $settings; } } $this->setConfig($configs); } ```
# Dec 10th 2017, 14:49 saeideng for example
# Dec 10th 2017, 14:48 saeideng I know
# Dec 10th 2017, 14:48 admad my code will give you exact same result
# Dec 10th 2017, 14:48 saeideng $this->setconfig(['fields'=>['image1']]);
# Dec 10th 2017, 14:48 saeideng `$this->configShallow(['fields'=>['image1']]);`
# Dec 10th 2017, 14:48 saeideng but i my case I have array as first arg
# Dec 10th 2017, 14:47 saeideng @admad in above your code you used a key/value
# Dec 10th 2017, 14:47 admad nothing confusing, it uses Hash::merge() internally :slightly_smiling_face:
# Dec 10th 2017, 14:46 dereuromark part of that ticket is to think about if we can use shallow by default, and use non shallow = deep manually
# Dec 10th 2017, 14:46 saeideng setConfig have a bit confusing about arrays and merge/unmerge
# Dec 10th 2017, 14:44 saeideng thanks @admad, @dereuromark for your points
# Dec 10th 2017, 14:43 saeideng :slightly_smiling_face:
# Dec 10th 2017, 14:43 saeideng configShallow solved my problem
# Dec 10th 2017, 14:43 dereuromark the non assoc array inside assoc config array always has been a painpoint for configuration and merging :slightly_smiling_face: See https://github.com/cakephp/cakephp/issues/7267
# Dec 10th 2017, 14:42 admad personally i just wouldn't have `'fields' => ['image']` as default.
# Dec 10th 2017, 14:41 dereuromark there should be a shallow*
# Dec 10th 2017, 14:41 admad ``` public function initialize($config) { if (!empty($config['fields])) { $this->setConfig('fields', $config['fields], false); } } ```
# Dec 10th 2017, 14:39 saeideng without merging
# Dec 10th 2017, 14:39 saeideng so how can put array into this method ?
# Dec 10th 2017, 14:38 saeideng `public function setConfig($key, $value = null, $merge = true)`