# |
May 26th 2021, 21:34 |
etibor |
when the db field class is external(in Reviews) its means Secreters |
# |
May 26th 2021, 21:33 |
etibor |
thank you @kevin.pfeifer your hint |
# |
May 26th 2021, 21:32 |
etibor |
its a polymorphic association and point to 2 different models(Secreters and Clerks) |
# |
May 26th 2021, 21:31 |
ndm |
So, a polymorphic self-association? |
# |
May 26th 2021, 21:30 |
etibor |
thank you @ndm i am not sure, because it was from the ReviewsTable.php file |
# |
May 26th 2021, 21:28 |
ndm |
In any case, use debug kit to inspect the generated queries, that might give some clue. |
# |
May 26th 2021, 21:26 |
ndm |
Shouldn't the class name for both associations be `Reviews`? |
# |
May 26th 2021, 21:26 |
etibor |
probably i have to add a matching but not sure |
# |
May 26th 2021, 21:24 |
etibor |
but this is not a complete solution, i dont want to make 2 queries for this |
# |
May 26th 2021, 21:24 |
etibor |
when i try to $this->Reviews->find('all')->contain(['Clerks','Secreters']) it does not return the Clerks or the Secreters However separetly its working well $this->Reviews->find('all')->contain(['Clerks']) or $this->Reviews->find('all')->contain(['Secreters']) |
# |
May 26th 2021, 21:22 |
kevin.pfeifer |
just FYI: use three ` to create a multiline code block |
# |
May 26th 2021, 21:21 |
etibor |
`$this->belongsTo('Clerks', [` 'className'=>'Clerks', 'foreignKey' => 'clerk_id', //'joinType' => 'LEFT', 'conditions'=>['Reviews.class'=>'internal'] ]); $this->belongsTo('Secreters', [ 'className'=>'Secreters', //'joinType' => 'LEFT', 'foreignKey' => 'secr_id', 'conditions'=>['Reviews.class'=>'external'] ]); |
# |
May 26th 2021, 21:20 |
etibor |
well i almost implemented the whole, i added the 'class' and 'foreign_key' fields into the db table the issue is came when i tried to contain booth Models THe Model looks like this |
# |
May 26th 2021, 21:18 |
etibor |
hello Kevin |
# |
May 26th 2021, 21:17 |
kevin.pfeifer |
so you need table inheritance or what? |
# |
May 26th 2021, 21:07 |
etibor |
is anyone who have ever worked with polymorphic associations |
# |
May 26th 2021, 21:07 |
etibor |
hello everyone |
# |
May 26th 2021, 16:11 |
erwane |
Sorry but i miss something about this plugin logic :( |
# |
May 26th 2021, 16:10 |
hanchenglin101 |
Hello, everyone! I am looking for a CakePHP3 developer. Location: ANY, Welcome: Vietnam Period: 3 week ~ 5 weeks Hourly: 20 Please DM |
# |
May 26th 2021, 14:32 |
tomrwaller |
Perfect - thank you. Nabbed an example from another baked view that I hadn't updated and the postLink works just fine. I think I changed it when trying to turn it into a button :face_with_rolling_eyes: |
# |
May 26th 2021, 14:30 |
greg138 |
Yep. And the link you're generating is a GET link. So, either change it to a POST (which baking the view would do), or allow GET in your `allowMethod` call. |
# |
May 26th 2021, 14:26 |
tomrwaller |
`$this->request->allowMethod(['post', 'delete']);` |
# |
May 26th 2021, 14:25 |
tomrwaller |
Ah well this was baked so it's likely not been changed. I'll check. |
# |
May 26th 2021, 14:21 |
greg138 |
Does your `delete` method allow `GET`, or just `POST`? I think the baked versions use post links for deletions. |
# |
May 26th 2021, 14:19 |
slackebot |
a 'Method not allowed' error: `return true;` `}` `}` `$allowed = strtoupper(implode(', ', $methods));` `$e = new MethodNotAllowedException();` `$e->setHeader('Allow', $allowed);` `throw $e;` `}` |
# |
May 26th 2021, 14:19 |
tomrwaller |
Is anyone able to tell me why this doesn't work: `<?= $this->Html->link("<i class='fas fa-fw fa-trash'></i>", ['action' => 'delete', $assessment->id], array('class' => 'btn btn-sm btn-primary', 'escape' => false, 'confirm' => __('Are you sure you want to delete # {0}?', $assessment->id))) ?>` When I press the button on the assessments index page, I get the confirmation which I accept and I get |
# |
May 26th 2021, 14:15 |
greg138 |
If the only thing your controller's `beforeFilter` function does is calls the parent version, then you may as well not have it at all; the parent version will just be used directly in that case. |
# |
May 26th 2021, 13:48 |
erwane |
We can't define 'Model/Endpoint' directory ? I have multiple API Datasource and it's a little bit confusing to put everything in same folder |
# |
May 26th 2021, 12:32 |
michal_kotus |
Hi, I am learning to work with mailer. I created `src/Mailer/UserMailer.php` with: ```namespace App\Mailer; use Cake\Mailer\Mailer; class UserMailer extends Mailer``` Why I can not put `$mailer = new Mailer();` inside? I get 10 errors immediately. What is wrong? |
# |
May 26th 2021, 12:08 |
erwane |
README sounds good. |
# |
May 26th 2021, 12:06 |
admad |
There aren't any docs so you'll have to see the existing implementations for reference :) |
# |
May 26th 2021, 12:05 |
erwane |
will try with typesense |
# |
May 26th 2021, 12:04 |
erwane |
Very nice, thanks |
# |
May 26th 2021, 12:02 |
admad |
@erwane https://github.com/usemuffin/webservice |
# |
May 26th 2021, 11:55 |
erwane |
maybe it's hard to do something "generic" |
# |
May 26th 2021, 11:53 |
erwane |
Hi, there is no Core "Http Api" Datasource ? |
# |
May 26th 2021, 11:11 |
neon1024 |
Is there an easier way to ensure all redirects are https? Or do I have to add `'_ssl' => true` to all my url arrays? Is that what the HttpsEnforcerMiddleware is for? |
# |
May 26th 2021, 10:38 |
tomrwaller |
Awesome! Thanks - that does the trick! Quick question - It works using the 'templateVars' array key just fine - My only thought is it makes the code look a little untidy - is there a way to combine this into my helper template so I can get away with just using the 'help' keyword? |
# |
May 26th 2021, 10:29 |
kevin.pfeifer |
you need to set custom template variables inside the `templateVars` array key when outputting the form See https://book.cakephp.org/3/en/views/helpers/form.html#adding-additional-template-variables-to-templates |
# |
May 26th 2021, 10:26 |
tomrwaller |
Thought this might help: ```echo $this->Form->input('field_name', array( 'after'=>'<span class="help-block">This text appears underneath the input.</span></div>'));``` But it produces: ```<input class="form-control" type="text" name="name" after="<span class=andquot;help-blockandquot;>This text appears underneath the input.</span></div>"``` |
# |
May 26th 2021, 10:03 |
tomrwaller |
The help text is what I'm trying to get to display. |