# |
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') {``` |
# |
Jun 3rd 2021, 22:59 |
slackebot |
https://stackoverflow.com/questions/67829501/how-do-i-manage-read-and-write-aws-aurora-host-endpoints-in-cakephp |
# |
Jun 3rd 2021, 22:59 |
jadelbe418 |
Been writing out an implementation in the Cake ORM to support separate read vs cluster endpoints when querying against AWS Aurora. Was wondering if Cake had any tricks for applying the different endpoints to the host value in the data source config, depending on if the query is a read or a write. Here is is a more detailed version of my question with code samples: |
# |
Jun 3rd 2021, 19:07 |
richard |
ugh |
# |
Jun 3rd 2021, 19:07 |
richard |
@dereuromark was just me not realizing some of the files on the drive were owned by another user, was able to solve it |
# |
Jun 3rd 2021, 17:40 |
dereuromark |
maybe you use the wrong user for crontab, if you are using that to spawn. make sure to -u here for it to edit |
# |
Jun 3rd 2021, 17:25 |
kevin.pfeifer |
if you get an error and have xdebug running you can try to add a `xdebug_break()` at that line and trace back where it comes from and probably have a better understanding of why your process changes user |
# |
Jun 3rd 2021, 17:19 |
richard |
I’m running into an error where a worker is running as something other than www-data but when i grep for the workers the only ones i see are running as www-data |
# |
Jun 3rd 2021, 17:12 |
jpramirez |
@richard `su -s /bin/bash -c "bin/cake" www-data` maybe? |
# |
Jun 3rd 2021, 17:06 |
dereuromark |
that works for me, yes |
# |
Jun 3rd 2021, 16:55 |
richard |
i tried sudo -u www-data bin/cake queue runworker |
# |
Jun 3rd 2021, 16:55 |
jpramirez |
@v.plancher I highly recommend you to use fixture factories to insert test fixtures. You will not have to care about your schema, as it is handled with migrations, your tests will be independent, they will run faster and they will be more readable. And faster to write too. https://github.com/vierge-noire/cakephp-fixture-factories https://book.cakephp.org/4/en/development/testing.html#fixture-factories |
# |
Jun 3rd 2021, 16:55 |
richard |
stupid question but how do i run bin/cake as www-data? |
# |
Jun 3rd 2021, 14:14 |
dereuromark |
For keeping them in sync I use https://www.dereuromark.de/2020/02/25/cakephp-tips-winter-2020/#keep-fixtures-in-sync-with-tables which helps a lot to find the fields someone added but didnt adjust the fixtures with. That can lead to tests being green while in reality the (required) fields can cause errors. So best to check this once in a while. |
# |
Jun 3rd 2021, 12:00 |
slackebot |
every test run. Make sure to keep these updated with your schema. |
# |
Jun 3rd 2021, 12:00 |
jamison508 |
You can certainly test both models and controllers, though you'd be testing the table classes and not the entities so much. My advice is when testing validation, write tests for successful (happy path) validation too and not just unsuccessful (sad path) validation. You should be using fixtures pretty much always IMO. These require a test connection configured in your config. The tables will be dropped and recreated/seeded |
# |
Jun 3rd 2021, 11:48 |
slackebot |
advices on that? A second question. Many features rely on data from the database with many associations (like: Orders > OrderLines > Articles / Discounts > ...). It means I'd need to create many fixtures lines. When is it better to use fixtures? To use a test database? |
# |
Jun 3rd 2021, 11:48 |
v.plancher |
Hello there. This is not a question about unit testing CakePHP itself, but about unit testint MVC frameworks. I'm new at unit testing, and I wonder if I should write tests on : • controllers : because this is where it "begins" and it could be a way to test models too. • models (tables/entities) : because this is where most of code is written, and because it is easier to write tests on very specific methods Do you have |
# |
Jun 3rd 2021, 10:24 |
kevin.pfeifer |
as ndm already mentioned with that link https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group/30270675#30270675 |
# |
Jun 3rd 2021, 10:24 |
kevin.pfeifer |
the reason behind that question is, that mysql 5.6 doesn't allow your problem to be solved, because it is quite a difficult one |
# |
Jun 3rd 2021, 10:23 |
kevin.pfeifer |
do you use MySQL 5.6 as a database server or something different? |
# |
Jun 3rd 2021, 10:21 |
etibor |
Kevin thank you |
# |
Jun 3rd 2021, 09:41 |
kevin.pfeifer |
i would have to test that myself |
# |
Jun 3rd 2021, 09:37 |
etibor |
and probably becuase as you wrote limiting associated data is not possible right now |
# |
Jun 3rd 2021, 09:37 |
etibor |
```return $->last()``` brings: Call to undefined method App\Model\Entity\UrlFile::aliasFields() |