# |
Jun 17th 2019, 16:11 |
phpraven |
I used cake bake all and the className was wrong User.Profiles should be Profile.Profiles just like you said @admad now it works :slightly_smiling_face: thanks guys |
# |
Jun 17th 2019, 16:09 |
ricksaccous |
oh he put the class on it, it's probably already just plopping out as a text field, i wonder if his db typing is correct, but yeah |
# |
Jun 17th 2019, 16:08 |
ricksaccous |
maybe he over-rode the date type with his own widget XD |
# |
Jun 17th 2019, 16:04 |
admad |
since you don't have have it seems formhelper isnt aware of your profile table schema and thus your table class isnt being used |
# |
Jun 17th 2019, 16:03 |
admad |
since you are using a JS datetime picker you would generally need `'type' => 'text'` in options to get Form->control() to generate a text field, cause by default cake would give you 3 dropdowns for datefields |
# |
Jun 17th 2019, 16:03 |
ricksaccous |
or just validate default |
# |
Jun 17th 2019, 16:03 |
ricksaccous |
not sure if you want a custom validation method |
# |
Jun 17th 2019, 16:03 |
ricksaccous |
in patchEntity and Form Helper |
# |
Jun 17th 2019, 16:03 |
ricksaccous |
@phpraven it's also about settng it up correctly |
# |
Jun 17th 2019, 16:00 |
phpraven |
ok I will check, thanks |
# |
Jun 17th 2019, 15:59 |
admad |
check debukit and ensure you table class are being used and not `Table` for the 2 models |
# |
Jun 17th 2019, 15:58 |
admad |
i see className is set like that |
# |
Jun 17th 2019, 15:58 |
admad |
err sorry |
# |
Jun 17th 2019, 15:58 |
admad |
then you need to use `User.Users` and `Profile.Profiles` when setting up associations |
# |
Jun 17th 2019, 15:57 |
phpraven |
@admad I have two plugins User and Profile |
# |
Jun 17th 2019, 15:57 |
admad |
only if they are in separate plugins should they be under separate namespaces |
# |
Jun 17th 2019, 15:56 |
admad |
both should be under `App\Model\Table` |
# |
Jun 17th 2019, 15:56 |
admad |
@phpraven why are you User and Profile models in their own namepsaces? |
# |
Jun 17th 2019, 15:29 |
phpraven |
Hi, how can I validate associated model in cakephp 3.7 ? I have User with hasOne Profile, in registration form I want to validate profile.birthday But I don`t see any validation errors, I have no idea what I'm doing wrong UsersController (register) https://pastebin.com/6PS9czZk UserTable https://pastebin.com/gahYirDA ProfilesTable https://pastebin.com/guhyvuSR register.ctp https://pastebin.com/FZsiw4jp |
# |
Jun 17th 2019, 14:28 |
scriptstupid |
actually just realized I'm probably dumb and it's supposed to do that |
# |
Jun 17th 2019, 14:28 |
scriptstupid |
Having a problem where Auth->idenfity() is returning an array instead of an entity. Please see https://pastebin.com/6VET1pbr |
# |
Jun 17th 2019, 14:03 |
swimboy |
I’m trying to change the default date display format to show 4 digit years instead of 2 digit. I’ve set my defaultLocale in app.php, and tried putting `\Cake\I18n\Time::setToStringFormat('MM/dd/YYYY HH:mm:ss');` in my AppController.php in the beforeRender function, but it’s not working. I also tried putting it in my bootstrap.php with the other date and time settings, to no avail. |
# |
Jun 17th 2019, 13:31 |
slackebot1 |
use some middleware here probably, depending on your status of codebase. Deprecation warnings will slowly help you fix all upcoming issues. |
# |
Jun 17th 2019, 13:31 |
dereuromark |
Pro-tip: Leverage the shim behavior to add early reporting on this in your 2.x or 3.x app This way you can fix things before they become a real BC break in 4.x. E.g. https://github.com/dereuromark/cakephp-shim/blob/master/src/Controller/Component/Component.php#L33 as to check certain incoming URL pieces against the expected values etc You can do that for all kind of elements, like controller or plugin name as well in 3.x you can also |
# |
Jun 17th 2019, 13:21 |
neothermic |
breaking in 4.0: "Controller method name matching when invoking actions is now case sensitive. For example if your controller method is forgetPassword() then using string forgotpassword in URL will not match as action name." I might need to make a mental note to ensure we're not doing any of that in our 2.x branch for the day we end up in 4.x :) |
# |
Jun 17th 2019, 12:14 |
dereuromark |
the newEntity() is on the logs table right? and there it saves it, this is quite clear then. It shouldnt auto trigger stuff on other entities or tables IMO. |
# |
Jun 17th 2019, 12:09 |
mehov |
Here's where this comes from: https://stackoverflow.com/questions/6575194/php-good-practices-methods-with-too-many-parameters/6575535#6575535 |
# |
Jun 17th 2019, 12:08 |
mehov |
I normally have the feeling it should be the other way around too, but I came up with `$logTable->initiateLog()->setStoreId(1)->setPrice(9.99)->save()`. In my understanding, `initiateLog` would return a `newEntity()`, and the rest of the chain would be called on it, and the last `save()` being also called on the entity will have to figure out the corresponding table to actually save itself |
# |
Jun 17th 2019, 12:04 |
dereuromark |
because it is a convention, but not a requirement to find the right one by inflection. |
# |
Jun 17th 2019, 12:03 |
dereuromark |
you shouldnt need to IMO, it is usually the other way around. |
# |
Jun 17th 2019, 11:59 |
mehov |
Hey guys, quick question is there an easy way to get a corresponding table class from an entity? I know there's [`getSource()`](https://api.cakephp.org/3.7/class-Cake.ORM.Entity.html#_getSource), but it gets me a string, which is good and, but I was hoping I'd avoid doing the tablelocator stuff |
# |
Jun 17th 2019, 09:39 |
conehead |
@office You could still create your own controller with public access that redirects to the files you want (even out of the webroot folder) |
# |
Jun 17th 2019, 09:36 |
eax |
Hey Folks. Cake3: I have a Nested Resource Route, that looks like: https://gist.github.com/eaxexe/eeb3b61e58a99885ad9a13805e5d18ce - The issue is that I can’t seem to do a /vehicles/:uuid/vehicle-properties/:uuid - I simply get a 404 on: Action VehiclesController::8c6ca9dcFd1744279c38Ed53cf2a85aa() could not be found, or is not accessible. Any ideas what could be wrong? |
# |
Jun 17th 2019, 09:29 |
neon1024 |
Morning all :wave: |
# |
Jun 17th 2019, 09:27 |
hmic |
office: the webroot is just that - the webroot. if you put a file there, it will be /file.ext in the url?! |
# |
Jun 17th 2019, 09:19 |
office |
Webroort works fine, but i want to have public folder in cake root as url is very long if folder in webroot |
# |
Jun 17th 2019, 09:17 |
hmic |
office: if you setup your webroot correctly, you can't/don't. just move your public folder to webroot instead! |
# |
Jun 17th 2019, 09:17 |
kgb.acct.personal |
Nice try FBI |
# |
Jun 17th 2019, 09:16 |
office |
HI, how can i give public acces to a folder located in root? |
# |
Jun 17th 2019, 06:32 |
ra7bi |
Now i understand , thanks |
# |
Jun 17th 2019, 06:26 |
ra7bi |
there is no validation for save function ? |