# |
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)` |
# |
Dec 10th 2017, 14:38 |
admad |
that's expected, since by default options are merged |
# |
Dec 10th 2017, 14:38 |
saeideng |
I need to override the config |
# |
Dec 10th 2017, 14:37 |
saeideng |
my output ``` [ (int) 0 => 'image', (int) 1 => 'image', (int) 2 => 'img', (int) 3 => 'image1' ] ``` |
# |
Dec 10th 2017, 14:37 |
saeideng |
and ``` protected $_defaultConfig = [ 'fields' => ['image'] ]; ``` |
# |
Dec 10th 2017, 14:36 |
saeideng |
and within behavior ``` public function initialize(array $config) { $this->setConfig(['fields'=>['image1']]); } ``` |
# |
Dec 10th 2017, 14:36 |
saeideng |
`$this->addBehavior('UploadConfig',['fields'=>['image','img']]);` |
# |
Dec 10th 2017, 14:36 |
admad |
you are using `$this` so isn't it obvious whether it's a static call or through instance? |
# |
Dec 10th 2017, 14:36 |
saeideng |
see my example |
# |
Dec 10th 2017, 14:34 |
slackebot |
Action: admad sighs |
# |
Dec 10th 2017, 14:34 |
saeideng |
I dont know |
# |
Dec 10th 2017, 14:34 |
admad |
do you use a behavior statically or through instance? |
# |
Dec 10th 2017, 14:33 |
saeideng |
`$this->setConfig($configs);` |
# |
Dec 10th 2017, 14:33 |
saeideng |
because I set |
# |
Dec 10th 2017, 14:33 |
admad |
no |
# |
Dec 10th 2017, 14:33 |
saeideng |
I think behavior used StaticConfigTrait |
# |
Dec 10th 2017, 14:32 |
saeideng |
I have a problem by behavior and these :slightly_smiling_face: |
# |
Dec 10th 2017, 14:32 |
admad |
"Static" vs "Instance" |
# |
Dec 10th 2017, 14:30 |
saeideng |
? |
# |
Dec 10th 2017, 14:30 |
saeideng |
how different between `StaticConfigTrait` and `InstanceConfigTrait` |
# |
Dec 10th 2017, 14:29 |
jkpatel291289 |
Association property name "from_destination" clashes with field of same name of table "lorryreceipts". You should explicitly specify the "propertyName" option |
# |
Dec 10th 2017, 14:29 |
jkpatel291289 |
i got this error in my view |
# |
Dec 10th 2017, 14:28 |
saeideng |
hi |
# |
Dec 10th 2017, 14:25 |
admad |
it should be the fK field name |
# |
Dec 10th 2017, 14:23 |
jkpatel291289 |
i have this code for generating select in my view file echo $this->Form->control('from_destination'); |
# |
Dec 10th 2017, 14:23 |
jkpatel291289 |
@admad i used $fromDestinations but didnt work |
# |
Dec 10th 2017, 14:16 |
patsuckow |
slackebot: Thank you |
# |
Dec 10th 2017, 14:13 |
admad |
patsuckow: read about "format" option PaginatorHelper::counter() on api.cakephp.org |
# |
Dec 10th 2017, 14:04 |
patsuckow |
In version 2.x, you could specify the page delimiter as follows: echo $this->Paginator->counter(['separator' => 'of']); Somebody knows how can I specify 'separator' in 3.x ? |
# |
Dec 10th 2017, 14:01 |
admad |
name view vars as per conventions, $fromDestinations |
# |
Dec 10th 2017, 14:01 |
jkpatel291289 |
templates are generated with bake |
# |
Dec 10th 2017, 14:01 |
jkpatel291289 |
i have these lin in may add method |