# |
Sep 3rd 2019, 06:24 |
Nitrogen |
not sure if expected behavior or inconsistency/bug. please advise. |
# |
Sep 3rd 2019, 06:23 |
Nitrogen |
same goes for condition at line 585 earlier. |
# |
Sep 3rd 2019, 06:23 |
Nitrogen |
guys, this block isn't executed with unmodified baked model https://api.cakephp.org/3.8/source-class-Cake.Validation.Validation.html#598 which prevents iso8601 datetime value from being validated. reason being $dateFormat is an array by default as can be seen at https://api.cakephp.org/3.8/source-class-Cake.Validation.Validator.html#1669 |
# |
Sep 3rd 2019, 04:38 |
conehead |
Couldn't you just write `Configure::write('Error.errorLevel', E_ALL and ~E_USER_DEPRECATED)` before executing your tests? |
# |
Sep 3rd 2019, 02:28 |
admad |
you don't have to stick with just the folder cake provides by default |
# |
Sep 3rd 2019, 02:26 |
admad |
FrostCandy: you can add extra folder you want as per your need. For e.g. extra folder under Model or new "Service" folder under src for service classes |
# |
Sep 3rd 2019, 02:13 |
FrostCandy |
I'l use it thanks |
# |
Sep 3rd 2019, 02:13 |
FrostCandy |
ok good enough for me, as they don't know cake either, if they ask me why I did it I'll be able to explain controllers don't usually hold that type of code. |
# |
Sep 3rd 2019, 02:12 |
challgren |
In the Entity |
# |
Sep 3rd 2019, 02:12 |
challgren |
https://book.cakephp.org/3.0/en/orm/entities.html#exposing-virtual-fields |
# |
Sep 3rd 2019, 02:11 |
challgren |
You could put that in virtual fields |
# |
Sep 3rd 2019, 02:11 |
FrostCandy |
It's just a mathematical equation, but if I was doing this right I'd normally put it in a model. I could put it in a helper I guess. Behavior / Entity / Table all appear to deal with database structure. Maybe I just make a new folder and file under Model. :) It's not very clear so far, but maybe the link you sent will help. |
# |
Sep 3rd 2019, 02:09 |
challgren |
@frostCandy its really depends what your BL is. There was a discussion about this last night. You can view it with Slack https://cakesf.herokuapp.com/ |
# |
Sep 3rd 2019, 01:52 |
FrostCandy |
Just curious in my normal MVC frameworks there is a place to put your model files for business logic. Is that not a thing in CakePHP? I'm not sure where I put my model and how to access it. |
# |
Sep 3rd 2019, 01:11 |
FrostCandy |
thanks for the help that should get it done for me |
# |
Sep 3rd 2019, 01:11 |
cnizzardini |
gl |
# |
Sep 3rd 2019, 01:11 |
FrostCandy |
Woohoo saving a new entity worked. |
# |
Sep 3rd 2019, 01:07 |
FrostCandy |
testing new entity, and save / updating now and then i should be finally done. |
# |
Sep 3rd 2019, 01:07 |
cnizzardini |
I think you can do $resourcelog->find()->get('1c') or something, check the docs |
# |
Sep 3rd 2019, 01:07 |
FrostCandy |
That seems like it would work as well, but the ById worked too |
# |
Sep 3rd 2019, 01:07 |
cnizzardini |
I usually write stuff like that, forgoing the magic stuff |
# |
Sep 3rd 2019, 01:07 |
cnizzardini |
$resourcelog->find()->where(['id' => '1c'])->first(); |
# |
Sep 3rd 2019, 01:05 |
FrostCandy |
$query = $resourcelog->findById('1-1-1'); seems to have worked |
# |
Sep 3rd 2019, 01:04 |
FrostCandy |
but that blows up |
# |
Sep 3rd 2019, 01:04 |
FrostCandy |
find pulls everythign though right? I want to pull by ID which is a charcter string - $query = $resourcelog->find('1c'); |
# |
Sep 3rd 2019, 01:03 |
FrostCandy |
i suspect things will be good now thanks , newEntity and save hopefully fine too |
# |
Sep 3rd 2019, 01:02 |
FrostCandy |
at least the query part |
# |
Sep 3rd 2019, 01:02 |
FrostCandy |
yay it worked :D |
# |
Sep 3rd 2019, 01:02 |
cnizzardini |
If I interviewed someone and I saw them using any framework far away from how it was designed, that would be a red flag to me |
# |
Sep 3rd 2019, 01:02 |
cnizzardini |
If that doesn't work post your code or error |
# |
Sep 3rd 2019, 01:01 |
cnizzardini |
save() works the same |
# |
Sep 3rd 2019, 01:01 |
cnizzardini |
newEntity() and patchEntity work the same |
# |
Sep 3rd 2019, 01:00 |
cnizzardini |
use TableRegistry |
# |
Sep 3rd 2019, 01:00 |
cnizzardini |
yes |
# |
Sep 3rd 2019, 01:00 |
FrostCandy |
^^ That ? |
# |
Sep 3rd 2019, 01:00 |
cnizzardini |
TableRegistry::getTableLocator()->get('TableName'); |
# |
Sep 3rd 2019, 00:59 |
FrostCandy |
use Cake\ORM\TableRegistry; |
# |
Sep 3rd 2019, 00:59 |
FrostCandy |
what use do you use for the 3.7 ? |
# |
Sep 3rd 2019, 00:58 |
cnizzardini |
works for me in 3.7 |
# |
Sep 3rd 2019, 00:58 |
cnizzardini |
should work fine on 3.8 |
# |
Sep 3rd 2019, 00:58 |
cnizzardini |
$articlesTable = TableRegistry::getTableLocator()->get('Articles'); |