# |
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 |
# |
Dec 10th 2017, 14:00 |
jkpatel291289 |
$from_destination_id = $this->Lorryreceipts->FromDestinations->find('list', ['limit' => 200]); $this->set(compact('lorryreceipt', 'companies', 'loadingmemos','from_destination_id')); |
# |
Dec 10th 2017, 13:59 |
jkpatel291289 |
thanks. error is gone but now i want to create dropdown in add from to select destinations |
# |
Dec 10th 2017, 13:57 |
jkpatel291289 |
ohh |
# |
Dec 10th 2017, 13:57 |
admad |
read my example code again |
# |
Dec 10th 2017, 13:56 |
jkpatel291289 |
i renamed it to fromDestination but now it is looking for the table from_destinations |
# |
Dec 10th 2017, 13:54 |
jkpatel291289 |
@admad sorry. i will create gist from next time :D |
# |
Dec 10th 2017, 13:51 |
admad |
you can't have 2 associations with same name. you need to use aliases. ``` $this->belongsTo('FromDestinations', [ 'className' => 'Destinations', 'foreignKey' => 'from_destination_id', 'joinType' => 'INNER' ]); $this->belongsTo('ToDestinations', [ 'className' => 'Destinations', 'foreignKey' => 'to_destination_id', 'joinType' => 'INNER' ]); ``` |
# |
Dec 10th 2017, 13:50 |
admad |
@jkpatel291289 don't post code in the channel, use gist or pastebin |
# |
Dec 10th 2017, 13:41 |
slackebot |
'foreignKey' => 'to_destination_id', 'joinType' => 'INNER' ]); in destinationstable initialize() method public function initialize(array $config) { parent::initialize($config); $this->setTable('destinations'); $this->setDisplayField('id'); $this->setPrimaryKey('id'); $this->addBehavior('Timestamp'); $this->addBehavior('UseCurrentCompanyOnly'); } |
# |
Dec 10th 2017, 13:41 |
jkpatel291289 |
what should be the ideal Association setup for this destinations id city lorryreceipt id from_destination_id to_destination_id blah.. blah.. my current setup is in lorryreceiptstable initialize() method $this->belongsTo('Destinations', [ 'foreignKey' => 'from_destination_id', 'joinType' => 'INNER' ]); $this->belongsTo('Destinations', [ |
# |
Dec 10th 2017, 13:19 |
admad |
There will be an Authorization plugin for too and together they will replace authcomponent |
# |
Dec 10th 2017, 13:12 |
bravo-kernel |
ok, thanks for confirming |