# |
Mar 6th 2018, 18:27 |
meder |
and it'd be far easier doing table.* if there's a way |
# |
Mar 6th 2018, 18:26 |
meder |
i have a couple tables and for some of them, i want all rows but not others |
# |
Mar 6th 2018, 18:26 |
meder |
with select(), can i do table.* or do i have to explicitly do columns? |
# |
Mar 6th 2018, 17:06 |
phantomwatson |
Hereyago: https://github.com/cakephp/cakephp/issues/11794 |
# |
Mar 6th 2018, 17:05 |
savant |
thats so unnecessary lol |
# |
Mar 6th 2018, 17:04 |
admad |
please open a ticket |
# |
Mar 6th 2018, 17:04 |
admad |
might be for BC with 2.x, it had even wackier magic for generating form urls |
# |
Mar 6th 2018, 17:04 |
savant |
wow |
# |
Mar 6th 2018, 17:04 |
savant |
lmao |
# |
Mar 6th 2018, 17:03 |
phantomwatson |
Huh. :S |
# |
Mar 6th 2018, 17:01 |
admad |
@phantomwatson there are tests for this wacky behavior :( https://github.com/cakephp/cakephp/blob/master/tests/TestCase/View/Helper/FormHelperTest.php#L805 |
# |
Mar 6th 2018, 16:43 |
phantomwatson |
I'm confused why I've never run into this before either. It doesn't seem like that rare of a condition to run into. |
# |
Mar 6th 2018, 16:42 |
admad |
though pretty sure i have used urls without id for editing records and don't remember the id being auto appended ever. |
# |
Mar 6th 2018, 16:41 |
phantomwatson |
On it. Issue forthcoming. |
# |
Mar 6th 2018, 16:40 |
admad |
@phantomwatson indeed, that really is strange. Please open and issue with examples should the difference in behavior. |
# |
Mar 6th 2018, 16:40 |
slackebot |
‘Degrees’“. This works. Is this the normal way of doing this, or can i add for example in the $fixtures array something like ‘app.min_degree_levels’ => ‘Degrees’ ? |
# |
Mar 6th 2018, 16:40 |
willem |
I have a databasetable that references another table in the database. For example, field ‘min_degree_level_id’ uses ‘Degrees’. Cake baked the model as “$this->belongsTo(‘MinDegreeLevels’)“. When baking fixtures there now is a ‘app.min_degree_levels’ entry. This is a non-existent table, as it is a reference to Degrees. Running PhpUnit this will fail. So i copied the DegreesFixture to a new fixture ‘MinDegreeLevels’ and a |
# |
Mar 6th 2018, 16:39 |
dereuromark |
Seems like a rare use case, but looks like a bug/issue indeed. |
# |
Mar 6th 2018, 16:38 |
phantomwatson |
Check out `FormHelper::_formUrl()`: https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L481 From what I can tell, specifying a URL as an array (but without a route `_name` or any extra passed parameters) for a form results in the record ID being appended (if it exists) to the URL. |
# |
Mar 6th 2018, 16:35 |
admad |
if would be really surprised if what you claim is true |
# |
Mar 6th 2018, 16:34 |
phantomwatson |
I know there are a bunch of easy workarounds too, but specifying a URL as an array just doesn't seem to work the way the documentation suggests it does. If there's no code change, then this might call for a note in the documentation at the least. |
# |
Mar 6th 2018, 16:34 |
savant |
i would file an issue. |
# |
Mar 6th 2018, 16:34 |
savant |
that seems strange behavior |
# |
Mar 6th 2018, 16:33 |
phantomwatson |
Any core developer around to weigh in on the form URL weirdness? I can submit a ticket, but I don't know what to recommend because I don't totally get the logic behind what conditions result in an ID being appended to the URL. And I suppose that altering that might constitute a breaking change. :S |
# |
Mar 6th 2018, 16:29 |
neon1024 |
Issue submitted :slightly_smiling_face: |
# |
Mar 6th 2018, 16:11 |
neon1024 |
You can do some really clever stuff with them |
# |
Mar 6th 2018, 16:11 |
neon1024 |
@flavius Yeah, they’re super handy and really powerful |
# |
Mar 6th 2018, 16:11 |
flavius |
@neon1024 huh, so Today I Learned about mutators -> https://book.cakephp.org/3.0/en/orm/entities.html#Cake\ORM\Entity::get cool :slightly_smiling_face: |
# |
Mar 6th 2018, 16:10 |
phantomwatson |
TL;DR: The form helper adds IDs to URLs if there isn't a route name, and that seems weird to me. |
# |
Mar 6th 2018, 16:09 |
slackebot |
`$this->Form->create()`. Yes, I know that specifying the URL is redundant if the form is submitting to its own URL. Using CakePHP 3.5.8, but it appears to also be the case in the latest version too. |
# |
Mar 6th 2018, 16:09 |
phantomwatson |
`FormHelper::_formUrl()` appears to only return the unmodified value of `$options['url']` if `$options['url']['_name']` is also specified, and it automatically appends the current record's ID to the URL otherwise. Is this intentional? In an application I'm reviewing, this has the effect of the form on `/users/my-account` submitting to `/users/my-account/$userId`, despite explicitly setting the URL _without_ an ID in |
# |
Mar 6th 2018, 16:09 |
dereuromark |
neon1024 give it a spin, sounds like a legit improvement. Just have to dicuss the pros and cons of the solutions available |
# |
Mar 6th 2018, 16:09 |
neon1024 |
Oh yeah, good point! |
# |
Mar 6th 2018, 16:08 |
popperz0r |
using ->having |
# |
Mar 6th 2018, 16:08 |
popperz0r |
ok i got it |
# |
Mar 6th 2018, 16:07 |
neon1024 |
I’d like to propose your idea, I think it’s a good one |
# |
Mar 6th 2018, 16:06 |
neon1024 |
At least an RFC I guess right? |
# |
Mar 6th 2018, 16:06 |
neon1024 |
@dereuromark Do you think it’s worth a ticket? The issue of entity access in templates? |
# |
Mar 6th 2018, 16:06 |
neon1024 |
Well, without a syntax error :P |
# |
Mar 6th 2018, 16:05 |
neon1024 |
For example |
# |
Mar 6th 2018, 16:05 |
neon1024 |
`$this->set('catalog', $this->Catalogs->find()->first()` |