# |
Aug 9th 2008, 04:37 |
ichsan |
Is there any specific technique in CakePHP in handling Class method and an instance of a Class method? Like here in basic PHP |
# |
Aug 9th 2008, 04:36 |
ddeerrrick |
I bet this gets asked a lot, but I'm having a bit of a time trying to get cake functioning as my document root on my mediatemple gs server. I've tried to find a solution online but nothing has worked yet. If anyone has some insight it'd be appreciated |
# |
Aug 9th 2008, 04:35 |
kalileo |
ichsan: yeah, lol, I think I still don't know hwat you're after |
# |
Aug 9th 2008, 04:35 |
ichsan |
No no no, you don't get what I mean |
# |
Aug 9th 2008, 04:34 |
ichsan |
that's how CakePHP handles concept of Class |
# |
Aug 9th 2008, 04:34 |
kalileo |
if you wanna write code specific for just one medicine, you could always create a Xobile Model, and have that extend the medicine model |
# |
Aug 9th 2008, 04:33 |
ichsan |
it resembles class of Medicine |
# |
Aug 9th 2008, 04:33 |
ichsan |
kalileo: I know $this->Medicine is actually an instance. But it is in PHP not as programming concept |
# |
Aug 9th 2008, 04:32 |
kalileo |
but not in this case |
# |
Aug 9th 2008, 04:32 |
kalileo |
there are class methods used in cake too, such as App::import |
# |
Aug 9th 2008, 04:31 |
kalileo |
ichsan: it is an instance already, and you access it using $this->Medicine |
# |
Aug 9th 2008, 04:31 |
ichsan |
kalileo: I know. |
# |
Aug 9th 2008, 04:30 |
kalileo |
you wouldn't have Medicine::get_stock(4) in cake |
# |
Aug 9th 2008, 04:30 |
ichsan |
We are on xobile medicine. |
# |
Aug 9th 2008, 04:30 |
ichsan |
because, I've already working on an instance. |
# |
Aug 9th 2008, 04:30 |
ichsan |
I don't need to remember the id all the times |
# |
Aug 9th 2008, 04:29 |
ichsan |
kalileo: But calling method on an instance is simpler than on a class. Medicine::get_stock_of(4) vs medicine->get_stock(); |
# |
Aug 9th 2008, 04:26 |
kalileo |
ichsan: which is what I would prefer becasue i can use one piece of code for whatever medicine |
# |
Aug 9th 2008, 04:26 |
kalileo |
ichsan: yes, correct |
# |
Aug 9th 2008, 04:26 |
ichsan |
$this->Medicine->current_stock(4); |
# |
Aug 9th 2008, 04:25 |
ichsan |
kalileo: That is static in my opinion. Because I have to supply xobile's id to get current_stock |
# |
Aug 9th 2008, 04:24 |
kalileo |
ichsan: what's static with $this->Medicine->method? |
# |
Aug 9th 2008, 04:24 |
ichsan |
kalileo: My medicine has many behaviours |
# |
Aug 9th 2008, 04:24 |
kalileo |
ichsan: if you need specific subclasses for different kinds of medicine, then you can always extend the medicine call |
# |
Aug 9th 2008, 04:24 |
ichsan |
kalileo: As, I just don't like static method too much. So, may be I can find instance method to handle this medicine problem |
# |
Aug 9th 2008, 04:21 |
kalileo |
ichsan: yeah, remember. you could do all which php class support allows, but why would you want to? |
# |
Aug 9th 2008, 04:20 |
ichsan |
? |
# |
Aug 9th 2008, 04:20 |
ichsan |
Is there any similiar technique to do this in CakePHP |
# |
Aug 9th 2008, 04:20 |
ichsan |
that's instance method. But Medicine.findAllOutOfStock() is a class method. |
# |
Aug 9th 2008, 04:19 |
ichsan |
xobile.getCurrentStock(); |
# |
Aug 9th 2008, 04:19 |
ichsan |
sorry |
# |
Aug 9th 2008, 04:19 |
ichsan |
xobile.save(); |
# |
Aug 9th 2008, 04:19 |
Theaxiom |
skua thanks :) |
# |
Aug 9th 2008, 04:19 |
ichsan |
kalileo: in java: Medicine xobile = new Medicine('xobile'); |
# |
Aug 9th 2008, 04:18 |
skua |
i don't know how facebook add the content after url so i can't help you a lot |
# |
Aug 9th 2008, 04:18 |
kalileo |
ACTION hasn't touched Java for years anymore |
# |
Aug 9th 2008, 04:18 |
skua |
if you do $this->redirect('controller/action'. DS ), that doesn't work ? |
# |
Aug 9th 2008, 04:18 |
ichsan |
kalileo: Mmm, I use Java too. To make it clear, it is easy for me to describe the problem in Java language |
# |
Aug 9th 2008, 04:16 |
Theaxiom |
skua but what about redirects? |
# |
Aug 9th 2008, 04:16 |
kalileo |
ichsan: I wouldn't call it a model instance if you think about Xobile. It is an instance of the Model class called medicine though |
# |
Aug 9th 2008, 04:16 |
Theaxiom |
skua Thank you |