# |
Jun 4th 2021, 10:16 |
kevin.pfeifer |
there you go, now you have your reason :) Cakephp has many ways how you can deal with this, it just depends on how you want to deal with it |
# |
Jun 4th 2021, 10:13 |
paolo.bragagni |
now it works without the 'options' => $lingue |
# |
Jun 4th 2021, 10:13 |
paolo.bragagni |
Inflector::rules('irregular', ['lingua' => 'lingue']); |
# |
Jun 4th 2021, 10:11 |
kevin.pfeifer |
in your src/Table/MyTable.php in the initialize function there you can set ```$this->setDisplayField( 'name' );``` |
# |
Jun 4th 2021, 10:09 |
paolo.bragagni |
no i mean the default field 'title' of the model |
# |
Jun 4th 2021, 10:08 |
kevin.pfeifer |
your "title" of your form can be changed via the `label` key ```$this->Form->control('lingua_id', [ 'options' => $lingue 'label' => 'My Label' ] )``` |
# |
Jun 4th 2021, 10:08 |
slackebot |
<paolo.bragagni> |
# |
Jun 4th 2021, 10:08 |
paolo.bragagni |
Yes but in list I see the languages |
# |
Jun 4th 2021, 10:06 |
slackebot |
rules. See the documentation about Inflector for more information.``` |
# |
Jun 4th 2021, 10:06 |
kevin.pfeifer |
i think it has to do with the way cakephp expects your tables, variables etc. to english based https://book.cakephp.org/3/en/intro/conventions.html#view-conventions ```By default CakePHP uses English inflections. If you have database tables/columns that use another language, you will need to add inflection rules (from singular to plural and vice-versa). You can use Cake\Utility\Inflector to define your custom inflection |
# |
Jun 4th 2021, 10:04 |
paolo.bragagni |
(how to change the name of the 'title.. I dont remember..) |
# |
Jun 4th 2021, 10:04 |
slackebot |
<paolo.bragagni> |
# |
Jun 4th 2021, 10:03 |
paolo.bragagni |
autore is filled |
# |
Jun 4th 2021, 10:03 |
paolo.bragagni |
<td> <?= $this->Form->control('lingua_id', ['options' => $lingue] )?> </td> <td> <?= $this->Form->control('autore_id') ?> </td> |
# |
Jun 4th 2021, 10:03 |
paolo.bragagni |
but why |
# |
Jun 4th 2021, 10:02 |
paolo.bragagni |
it works |
# |
Jun 4th 2021, 09:59 |
philo.hamel |
*lingue ;) |
# |
Jun 4th 2021, 09:58 |
philo.hamel |
```$this->Form->control('lingua_id', ['options' => $libri]),``` |
# |
Jun 4th 2021, 09:54 |
paolo.bragagni |
but lingue remain emty.. :S |
# |
Jun 4th 2021, 09:53 |
paolo.bragagni |
autori is filled (with id , but probably I didnt define the title of the table) |
# |
Jun 4th 2021, 09:52 |
paolo.bragagni |
$lingue = $this->Libri->Lingue->find('list', ['limit' => 200]); $autori = $this->Libri->Autori->find('list', ['limit' => 200]); $this->set(compact('libri','lingue','autori')); |
# |
Jun 4th 2021, 09:50 |
kevin.pfeifer |
I haven't dealt with the friendsofcake search plugin myself because i built my own search logic before I found that plugin But i guess this is what you need to do ^^ |
# |
Jun 4th 2021, 09:47 |
kevin.pfeifer |
so yes, you need to get the entries in your controller, set them to have them in your view and then use that array as an `options` key for your field |
# |
Jun 4th 2021, 09:46 |
kevin.pfeifer |
```// You'll need to populate $authors in the template from your controller echo $this->Form->control('author_id');``` |
# |
Jun 4th 2021, 09:46 |
kevin.pfeifer |
based on the doc https://github.com/FriendsOfCake/search/tree/master/docs#creating-your-form |
# |
Jun 4th 2021, 09:46 |
paolo.bragagni |
$query = $this->Libri ->find('search', ['search' => $this->request->getQueryParams()]); $this->paginate = [ 'contain' => ['Lingue', 'Autori'], ]; $libri = $this->paginate($query); $this->set(compact('libri')); |
# |
Jun 4th 2021, 09:46 |
paolo.bragagni |
in controller: |
# |
Jun 4th 2021, 09:44 |
paolo.bragagni |
in my view I have only <?= $this->Form->control('lingua_id') ?> |
# |
Jun 4th 2021, 09:44 |
paolo.bragagni |
I have to fill in controller? |
# |
Jun 4th 2021, 09:43 |
paolo.bragagni |
yes |
# |
Jun 4th 2021, 09:39 |
kevin.pfeifer |
so your dropdown is empty? |
# |
Jun 4th 2021, 09:33 |
paolo.bragagni |
'Lingua' (language) related to 'Libri' (book) is a combobox but is empty |
# |
Jun 4th 2021, 09:31 |
slackebot |
<paolo.bragagni> |
# |
Jun 4th 2021, 09:28 |
kevin.pfeifer |
what do you mean by combobox? |
# |
Jun 4th 2021, 09:19 |
paolo.bragagni |
how to insert combobox in friendsofcake search (for related table) |
# |
Jun 4th 2021, 08:41 |
erwane |
It's the Break at first line option. Thanks |
# |
Jun 4th 2021, 08:06 |
kevin.pfeifer |
or do you have a `xdebug_break()` at the end of your config/requirements.php? |
# |
Jun 4th 2021, 07:58 |
kevin.pfeifer |
which i guess you have enabled |
# |
Jun 4th 2021, 07:57 |
kevin.pfeifer |
There is a “Break at first line” Option in the “Run” menu |
# |
Jun 4th 2021, 07:42 |
erwane |
Do you have any configuration clues for CakePHP+Phpstorm+xdebug please ? |
# |
Jun 4th 2021, 07:42 |
erwane |
Hi. I'm trying to configure xdebug in phpstorm with cakephp 4. The debugger always step on the webtoor/index.php at this line : ```// For built-in server if (php_sapi_name() === 'cli-server') {``` |