# |
Jan 29th 2014, 20:43 |
ten1 |
it would be compounding error with worse error |
# |
Jan 29th 2014, 20:43 |
feens |
ya...you basically asking a question that can't really be answered..."how do I make my poorly written code do this?"...and expecting a simple answer in return |
# |
Jan 29th 2014, 20:43 |
ten1 |
you could try a requestAction, and may whatever powers govern code have mercy on you |
# |
Jan 29th 2014, 20:43 |
todds |
ten1 the glass is half FULL! |
# |
Jan 29th 2014, 20:42 |
ten1 |
I wish there was some answer that would make things okay here, but you have screwed up very badly |
# |
Jan 29th 2014, 20:42 |
nif |
i know. like i said, this isn't built well. but i don't have the option of rewriting it and so i am desperately trying to find a way to do this |
# |
Jan 29th 2014, 20:42 |
todds |
nif: yeah, what you're describing sounds like a mess. In you're case, I'd recommend a re-write. But if you're not going to do that, then the most direct route (easiest) is to do that curl call instead. |
# |
Jan 29th 2014, 20:42 |
feens |
controllers aren't meant to do work like that...they're just supposed to direct traffic per se |
# |
Jan 29th 2014, 20:41 |
feens |
ya....that's not so good |
# |
Jan 29th 2014, 20:41 |
nif |
it is... but the component uses a different controller to get some work done |
# |
Jan 29th 2014, 20:41 |
feens |
I'm assuming calling a controller via a component opening a whole can of worms |
# |
Jan 29th 2014, 20:41 |
ten1 |
components should indeed not call controllers |
# |
Jan 29th 2014, 20:41 |
feens |
...isn't the purpose of a comment to be used in a controller (not called by one)? |
# |
Jan 29th 2014, 20:40 |
ten1 |
you can think of the shell as being equivalent to the controller in this case. It's theoretically possible to call controller actions from the shell but not pleasant. Curl is possible, but again: rewrite this |
# |
Jan 29th 2014, 20:39 |
todds |
the most direct route would probably be to do as feens suggests and just do a curl callâ?¦though it makes me cringe that you're gonna go through the web stack to execute local code. |
# |
Jan 29th 2014, 20:39 |
todds |
nif: the reason you're getting an error is probably because you're not passing a component colleciton from the shell. |
# |
Jan 29th 2014, 20:38 |
feens |
nif: well, if you're just trying to call the controller, why not just do like a curl call |
# |
Jan 29th 2014, 20:38 |
nif |
ok... i know this hasn't been built in the best way... time and budget constraints and taking up a new framework saw to that. however, i cannot change the way it is built now. i kind of have to make this work and with minimal changes to the app code that exists now. moving stuff to the model could throw the whole thing out. is there no way to make this work as is? and then i promise to build it better next time! :) |
# |
Jan 29th 2014, 20:37 |
todds |
) |
# |
Jan 29th 2014, 20:37 |
ten11 |
ten11 ? oops |
# |
Jan 29th 2014, 20:37 |
todds |
nif: what ten11 said. you'll want to move those methods to the model. |
# |
Jan 29th 2014, 20:36 |
ten11 |
!tell nif about goodcake |
# |
Jan 29th 2014, 20:36 |
ten11 |
the side benefit of this is that you get to do $uses = array('Modelname'); in your shell and have access to it there |
# |
Jan 29th 2014, 20:35 |
ten11 |
almost all of it |
# |
Jan 29th 2014, 20:35 |
ten11 |
your functionality should be part of the model layer |
# |
Jan 29th 2014, 20:35 |
nif |
sorry, to clarify, this is the first time i am creating a shell like this. |
# |
Jan 29th 2014, 20:35 |
nif |
ok... but the method in the controller that the component calls is used in several places in my app... wouldn't that affect it? |
# |
Jan 29th 2014, 20:34 |
nif |
not that i know of? i have functionality in my app that i need to call at intervals. the idea is that i would create a shell and then run a cron on it. as far as i know this is the only way to get that done? |
# |
Jan 29th 2014, 20:33 |
todds |
nif: You'll want to move any code that needs to be referenced by both a component and the shell to your app lib. Components are intended for use by controllers. |
# |
Jan 29th 2014, 20:32 |
feens |
I would think hat semantically a shell probably shouldn't call a controller...doesn't that kind of defeat the purpose of using a shell? |
# |
Jan 29th 2014, 20:27 |
todds |
nif: http://book.cakephp.org/2.0/en/console-and-shells.html#creating-a-shell |
# |
Jan 29th 2014, 20:22 |
nif |
I need a little help with running my app from a shell file... can anyone help? |
# |
Jan 29th 2014, 20:22 |
nif |
Hi there, |
# |
Jan 29th 2014, 20:15 |
feens |
never mind, I see how to do it now |
# |
Jan 29th 2014, 20:11 |
feens |
(I have defaults set on the form object) |
# |
Jan 29th 2014, 20:11 |
feens |
with formhelper/input, is there a way to supply a label text, but not have it change what's set for the label class? |
# |
Jan 29th 2014, 19:00 |
pedrotv |
since im building the checkbox using a $this->find->list and a foreach on the array. |
# |
Jan 29th 2014, 18:59 |
pedrotv |
tigrang: thanks. I guess in my case i can show the info i want without the need to use a HABTM, but since its a multiple choice checkbox, i loose the ability to show to the user what were the "Exams" he already choose before. |
# |
Jan 29th 2014, 18:56 |
tigrang |
pedrotv: http://book.cakephp.org/2.0/en/models/saving-your-data.html#what-to-do-when-habtm-becomes-complicated |
# |
Jan 29th 2014, 18:55 |
pedrotv |
tigrang: Thanks i will check that out, since im pretty much lost for now ! :p |
# |
Jan 29th 2014, 18:54 |
tigrang |
pedrotv: in the book there's a section called When HABTM gets too complicated, you may want to look at that |