# |
May 30th 2016, 19:55 |
bakerman |
I'm getting sick of writing "TableRegister::get(<whatever>)" a bunch. I can assign it once per controller at the top, but I was thinking of maybe creating a list of all the tables in an array and somehow using a foreach to assign it in the ApplicationController... Problem is I prefer using an object vs an array and not sure how to do that |
# |
May 30th 2016, 19:07 |
rubyan |
I'm unit testing and a bit suprised that when saving my model, my own defined events are not fired. Is that on purpose? |
# |
May 30th 2016, 19:06 |
rubyan |
hi there |
# |
May 30th 2016, 18:51 |
unholyknight |
ended up checking against model id as it exists in the database at that point and is later deleted if validation fails during relational insert, |
# |
May 30th 2016, 18:43 |
unholyknight |
in buildRules functions is there a way to access the data of a related entity during the insert? when data is inserted into the relational table i need to check it against data throughout a model table, but need values form the model insert to run the check. |
# |
May 30th 2016, 18:17 |
tzvika |
hi! |
# |
May 30th 2016, 18:16 |
AmitMerchant |
Hi All |
# |
May 30th 2016, 17:44 |
tzvika |
it doesn't work . it says: Error: Unknown option prefix |
# |
May 30th 2016, 17:44 |
tzvika |
bin/cake bake test Controller --prefix admin CustomersController |
# |
May 30th 2016, 17:44 |
tzvika |
like this: |
# |
May 30th 2016, 17:44 |
tzvika |
and another question. i tried generating a test for a controller which uses a prefix (admin). |
# |
May 30th 2016, 17:42 |
graziel |
no problem |
# |
May 30th 2016, 17:41 |
huhwatnou |
slackebot, thank you! |
# |
May 30th 2016, 17:41 |
graziel |
huhwatnou security [at] http://cakephp.org|cakephp.org |
# |
May 30th 2016, 17:41 |
huhwatnou |
seems a good idea not to post it to a publicly accessible spot |
# |
May 30th 2016, 17:40 |
huhwatnou |
slackebot, do you know the email address for security issues or where i can find it? |
# |
May 30th 2016, 17:40 |
tzvika |
hmic, thanks , beforerender did the job! |
# |
May 30th 2016, 17:39 |
hmic |
the request is available on purpose. if the data is in there, you might use it. if not, appcontroller beforerender or bevorerender eventlistener |
# |
May 30th 2016, 17:38 |
tzvika |
yes , but if is set it in the controller it would look cleaner in layout, right? |
# |
May 30th 2016, 17:37 |
hmic |
pro tip: the request is available from the view as from the controller, so $this->request works from the view too, which lets you access the session and auth directly |
# |
May 30th 2016, 17:36 |
hmic |
use appcontroller beforeRender callback, or set an eventlistener for the beforeRender event |
# |
May 30th 2016, 17:36 |
tzvika |
hmic - you are right :) |
# |
May 30th 2016, 17:36 |
hmic |
so: how can i set a variable to be available to any view/layout? |
# |
May 30th 2016, 17:35 |
hmic |
and your question is not about a specific view or layout in this case. |
# |
May 30th 2016, 17:35 |
hmic |
tzvika, you could use the appcontroller |
# |
May 30th 2016, 17:34 |
tzvika |
hmic, but thats specific to one controller, i need it in all of them |
# |
May 30th 2016, 17:33 |
hmic |
tzvika, all vars you set are available to the view. Controller->set('username', $user->username); |
# |
May 30th 2016, 17:33 |
unholyknight |
Is there a better way, short of combining data in the controller, to combine form fields which handle the same type relational data before saving? |
# |
May 30th 2016, 17:32 |
tzvika |
how do i set a variable which will be avaliable to all views? for example i need to display the username in the layout |
# |
May 30th 2016, 17:30 |
graziel |
huhwatnou if its security issue there is special mail for that kind |
# |
May 30th 2016, 17:28 |
huhwatnou |
@hmic, forget my last remark, it does occur in 2.8.4. I will file an issue. |
# |
May 30th 2016, 17:26 |
hmic |
Diego__, sounds good! |
# |
May 30th 2016, 17:26 |
Diego__ |
something like: $this->User->association('Contacts')->saveStrategy('replace'); |
# |
May 30th 2016, 17:25 |
huhwatnou |
@hmic, it does not seem to be fixed, but the issue does not occur in 2.x's current version. probably because of refactoring. |
# |
May 30th 2016, 17:25 |
Diego__ |
hmm, i think i found something: http://api.cakephp.org/3.2/class-Cake.ORM.Association.html show the method strategy() as setter for select strategy option, there is no mention for saveStrategy() but aparently it exist and work |
# |
May 30th 2016, 17:23 |
hmic |
huhwatnou, check if its fixed in 2.x current, if not - open an issue *PLEASE* |
# |
May 30th 2016, 17:23 |
hmic |
it gets only executed once you iterate it... |
# |
May 30th 2016, 17:23 |
huhwatnou |
@hmic, thank you. I will not submit the issue then, to save us all some time. |
# |
May 30th 2016, 17:22 |
hmic |
because your sql query is invalid |
# |
May 30th 2016, 17:22 |
LckyBy517 |
i meant i couldn't figure out why that line would cause it not to serialize |
# |
May 30th 2016, 17:22 |
hmic |
if there is a security flaw, 2.8 is still supported and - if not already - will fix it in the next release |