# |
Jan 22nd 2019, 16:57 |
neon1024 |
Or setup global config in one go and consume it from app.php |
# |
Jan 22nd 2019, 16:55 |
devito |
I was also thinking of a table const aswell but im trying not to load in the table if I dont have to. |
# |
Jan 22nd 2019, 16:55 |
devito |
ill try it both ways and see which is better. |
# |
Jan 22nd 2019, 16:53 |
neon1024 |
Just like the Registry class does |
# |
Jan 22nd 2019, 16:53 |
neon1024 |
You could still write to global config, and key using the table class alias |
# |
Jan 22nd 2019, 16:52 |
ricksaccous |
cool |
# |
Jan 22nd 2019, 16:52 |
devito |
im making a trait that handels all the functionality on the entity level for the behaviro so I can try it out in there. |
# |
Jan 22nd 2019, 16:51 |
neon1024 |
But I would probably wrap that somewhere for nice syntactic sugar in the entity |
# |
Jan 22nd 2019, 16:50 |
neon1024 |
`$entity->getSource()->behaviors()->get('devito')->getConfig()` |
# |
Jan 22nd 2019, 16:50 |
devito |
yeah |
# |
Jan 22nd 2019, 16:49 |
neon1024 |
`$entity->getSource()` |
# |
Jan 22nd 2019, 16:49 |
ricksaccous |
even then i don't know how you'd infer the correct field |
# |
Jan 22nd 2019, 16:49 |
ricksaccous |
i wonder if the entity has a method to get all the columns |
# |
Jan 22nd 2019, 16:48 |
neon1024 |
Then you might have no choice but to access the table |
# |
Jan 22nd 2019, 16:48 |
devito |
table a can call the column foo and table b can call it bar which would be specified in the overlaoded behavior configs |
# |
Jan 22nd 2019, 16:48 |
neon1024 |
Then write it into your behvaiour config `$this->setConfig('userField', \Cake\Core\Configure::read('devito.userField'))` |
# |
Jan 22nd 2019, 16:48 |
devito |
but not ever table would have the same implementation so that really wouldnt work out |
# |
Jan 22nd 2019, 16:47 |
devito |
I was thinking that |
# |
Jan 22nd 2019, 16:47 |
neon1024 |
`Configure::write('devito.userField', 'example');` |
# |
Jan 22nd 2019, 16:47 |
neon1024 |
Probably need to move it up to a global config value then |
# |
Jan 22nd 2019, 16:45 |
devito |
and since its specified in the behavior configs id like to just access it and pass it down to the entity |
# |
Jan 22nd 2019, 16:45 |
devito |
yeah |
# |
Jan 22nd 2019, 16:45 |
ricksaccous |
are you trying to make a getter for the entity that involves the arbitrary field? |
# |
Jan 22nd 2019, 16:43 |
devito |
in my behavior config I am specifying the field to store the data so it can be changed by a user. I wanted to carry that field over to my entity / trait so I alwasy reference the correct attribute |
# |
Jan 22nd 2019, 16:41 |
neon1024 |
@devito What is it you’re trying to do? Sounds like an X Y problem |
# |
Jan 22nd 2019, 16:05 |
devito |
aww |
# |
Jan 22nd 2019, 16:04 |
jeremyharris |
it does not |
# |
Jan 22nd 2019, 16:04 |
devito |
hello everyone.Maybe an odd question but here it goes. Does a Entity have access to the Table behavior configurations array? |
# |
Jan 22nd 2019, 15:08 |
gareth.ellis |
and i've had to copy paste most of the super method :,) |
# |
Jan 22nd 2019, 15:07 |
gareth.ellis |
This seems to work... but it's gross |
# |
Jan 22nd 2019, 15:07 |
slackebot1 |
<gareth.ellis> |
# |
Jan 22nd 2019, 15:00 |
gareth.ellis |
cake 2 has "scopes" |
# |
Jan 22nd 2019, 14:59 |
neon1024 |
Isn’t that what the logging groups were for? Perhaps that was a cake 3 feature |
# |
Jan 22nd 2019, 14:56 |
gareth.ellis |
also things like 403 errors, I'd like to log them but not have them in the main error log |
# |
Jan 22nd 2019, 14:55 |
gareth.ellis |
and if a third party service goes down, this creates a lot of noise in the main error.log file |
# |
Jan 22nd 2019, 14:55 |
gareth.ellis |
e.g. HTTP calls |
# |
Jan 22nd 2019, 14:55 |
gareth.ellis |
in various places in the app we log caught errors |
# |
Jan 22nd 2019, 14:55 |
gareth.ellis |
added a public method `logException(Throwable $e)` |
# |
Jan 22nd 2019, 14:54 |
neon1024 |
You’d want to make sure they were configured to be logged and not turned off in the php settings then I guess |
# |
Jan 22nd 2019, 14:54 |
gareth.ellis |
i've got an extended version of the default exception handler `AppErrorHandler` |
# |
Jan 22nd 2019, 14:54 |
neon1024 |
Not quite sure where you’d hook the exception handler in cake 2 though, it’s been a while |