Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Andreas

On 28 Aug., 22:14, trustfundbaby <[EMAIL PROTECTED]> wrote:
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
> the right direction?
As far as i know there is no such thing in CakePHP. The closest thing
I could imagine is to use a afterFind-callback to inject the
"attribute" to the returned array...

Regards
Andreas

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Gonzalo Servat
On Thu, Aug 28, 2008 at 6:55 PM, mattcamuto <[EMAIL PROTECTED]> wrote:

>
> i fully apologize. i started writing the email to somebody else,
> this email came through and i accidently cut-n-paste to the wrong window.
>
> i am totally sorry, did not mean to hijack anything
>

I really don't think you offended anyone unless you got someone in a
"delicate mood". I thought the sudden change of subject was pretty funny!!

- Gonzalo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread mattcamuto

i fully apologize. i started writing the email to somebody else, 
this email came through and i accidently cut-n-paste to the wrong window.

i am totally sorry, did not mean to hijack anything

matt

Gonzalo Servat wrote:
> On Thu, Aug 28, 2008 at 6:39 PM, mattcamuto <[EMAIL PROTECTED] 
> > wrote:
>
>
> hi sam
>
> i think i made things even more confusing in my post.
>
> I am just ttrying to accomplish plain ajax in multiple pages.
>
> Suppose I have 3 pages
>
> a.html
> b.html
> c.html
>
> And they all in some form have an 'Article' model in them.
>
> I want to rate the article (i.e. /Article/rate//)
> for instance on any of these pages and then update a DIV on any of
> those
> pages.
>
>
> [..snip..]
>
> This is like taking thread hijacking to a new level! Matt, didn't you 
> just start a different thread on a totally different subject to what 
> "trustfundbaby" was asking about?
>
> - Gonzalo
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Gonzalo Servat
On Thu, Aug 28, 2008 at 6:39 PM, mattcamuto <[EMAIL PROTECTED]> wrote:

>
> hi sam
>
> i think i made things even more confusing in my post.
>
> I am just ttrying to accomplish plain ajax in multiple pages.
>
> Suppose I have 3 pages
>
> a.html
> b.html
> c.html
>
> And they all in some form have an 'Article' model in them.
>
> I want to rate the article (i.e. /Article/rate//)
> for instance on any of these pages and then update a DIV on any of those
> pages.
>

[..snip..]

This is like taking thread hijacking to a new level! Matt, didn't you just
start a different thread on a totally different subject to what
"trustfundbaby" was asking about?

- Gonzalo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread mattcamuto

hi sam

i think i made things even more confusing in my post.

I am just ttrying to accomplish plain ajax in multiple pages.

Suppose I have 3 pages

a.html
b.html
c.html

And they all in some form have an 'Article' model in them.

I want to rate the article (i.e. /Article/rate//) 
for instance on any of these pages and then update a DIV on any of those 
pages.

HOWEVER suppose in my cake controller

ArticlesController() {

function rate() {
   ///...
   /// 
   $this->set('rating',$rating);
}
}

If i use this using ajax helpers it complains that I have no view file 
rate.ctp. What I want to do is have this method just return so it can be 
used in any ajax/html context it is used. The only examples I have seen 
have something like this:

function rate() {
   ///...
   /// 
   $this->set('rating',$rating);
   $this->render('index'); // To foward back to the page it came from
}

which seems kludgy.. Maybe I should use a component that can be called 
from anywhere instead of the controller?!?!

thanks

m












Sam Sherlock wrote:
> As I understand the example of virtual attributes in rails (that link 
> being the only basis of info)  it concats two fields depending on 
> certain things (eg spaces in the names)
>
> so virtual attributes perform set routines on data under certain 
> circumstances.   without know what you want these *custom properties* 
> to *do* and without knowing the ins and outs of rails its really hard 
> to say.
>
> I believe that whatever your trying to accomplish can be achieved with 
> cake but unless you explain what your trying to achieve any answer may 
> well be misleading.
>
> so what are you trying to accomplish?
>
> 2008/8/28 trustfundbaby <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>
>
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
>
>
>
> On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > models have behaviours
> >
> > controller have components
> >
> > and views have helpers
> >
> > also you can add a function to the appmodel and then all models
> have access
> > to it
> > there is an example that shows this on the link to book you posted.
> >
> > 2008/8/28 trustfundbaby <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
> >
> >
> >
> > > I guess I'm talking more along the lines of virtual attributes in
> > > Rails.
> > >http://railscasts.com/episodes/16
> > > I just called it custom properties because thats what its
> called here
> > > (although there are no examples)
> > >http://manual.cakephp.org/view/72/custom-methods-and-properties
> >
> > > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > > > I don't get what you mean with "custom properties". Maybe
> it's just me
> > > > but, can you elaborate a bit more please?
> >
> > > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> > > wrote:
> >
> > > > > How do you specify custom properties in a CakePHP model?
> > > > > I'm trying to do this, but there is no sample code any
> where that
> > > > > shows how its done, can someone point me in the right
> direction?
>
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Sam Sherlock
As I understand the example of virtual attributes in rails (that link being
the only basis of info)  it concats two fields depending on certain things
(eg spaces in the names)

so virtual attributes perform set routines on data under certain
circumstances.   without know what you want these *custom properties* to
*do* and without knowing the ins and outs of rails its really hard to say.

I believe that whatever your trying to accomplish can be achieved with cake
but unless you explain what your trying to achieve any answer may well be
misleading.

so what are you trying to accomplish?

2008/8/28 trustfundbaby <[EMAIL PROTECTED]>

>
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
>
>
>
> On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> > models have behaviours
> >
> > controller have components
> >
> > and views have helpers
> >
> > also you can add a function to the appmodel and then all models have
> access
> > to it
> > there is an example that shows this on the link to book you posted.
> >
> > 2008/8/28 trustfundbaby <[EMAIL PROTECTED]>
> >
> >
> >
> > > I guess I'm talking more along the lines of virtual attributes in
> > > Rails.
> > >http://railscasts.com/episodes/16
> > > I just called it custom properties because thats what its called here
> > > (although there are no examples)
> > >http://manual.cakephp.org/view/72/custom-methods-and-properties
> >
> > > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > > > I don't get what you mean with "custom properties". Maybe it's just
> me
> > > > but, can you elaborate a bit more please?
> >
> > > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > How do you specify custom properties in a CakePHP model?
> > > > > I'm trying to do this, but there is no sample code any where that
> > > > > shows how its done, can someone point me in the right direction?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

At the risk of repeating myself, I am looking for something that works
the same way as virtual attributes in rails.



On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> models have behaviours
>
> controller have components
>
> and views have helpers
>
> also you can add a function to the appmodel and then all models have access
> to it
> there is an example that shows this on the link to book you posted.
>
> 2008/8/28 trustfundbaby <[EMAIL PROTECTED]>
>
>
>
> > I guess I'm talking more along the lines of virtual attributes in
> > Rails.
> >http://railscasts.com/episodes/16
> > I just called it custom properties because thats what its called here
> > (although there are no examples)
> >http://manual.cakephp.org/view/72/custom-methods-and-properties
>
> > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > > I don't get what you mean with "custom properties". Maybe it's just me
> > > but, can you elaborate a bit more please?
>
> > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> > wrote:
>
> > > > How do you specify custom properties in a CakePHP model?
> > > > I'm trying to do this, but there is no sample code any where that
> > > > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

Thanks for that.
I'll have to look into it further, but I'm hoping it works the same
way as virtual attributes in Rails.


On Aug 28, 9:15 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> A CakePHP Model is just a PHP class. You can still use all of PHP's
> class abilities.
>
> for example:
>
> class MyModel extends AppModel {
>
>    var $myCustomPropery = "w00t!";
>
> }
>
> in controller:
>
> echo $this->MyModel->myCustomProperty;
>
> On Aug 28, 2:19 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > I don't get what you mean with "custom properties". Maybe it's just me
> > but, can you elaborate a bit more please?
>
> > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > > How do you specify custom properties in a CakePHP model?
> > > I'm trying to do this, but there is no sample code any where that
> > > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Sam Sherlock
models have behaviours

controller have components

and views have helpers

also you can add a function to the appmodel and then all models have access
to it
there is an example that shows this on the link to book you posted.

2008/8/28 trustfundbaby <[EMAIL PROTECTED]>

>
> I guess I'm talking more along the lines of virtual attributes in
> Rails.
> http://railscasts.com/episodes/16
> I just called it custom properties because thats what its called here
> (although there are no examples)
> http://manual.cakephp.org/view/72/custom-methods-and-properties
>
> On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > I don't get what you mean with "custom properties". Maybe it's just me
> > but, can you elaborate a bit more please?
> >
> > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> wrote:
> >
> > > How do you specify custom properties in a CakePHP model?
> > > I'm trying to do this, but there is no sample code any where that
> > > shows how its done, can someone point me in the right direction?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

I guess I'm talking more along the lines of virtual attributes in
Rails.
http://railscasts.com/episodes/16
I just called it custom properties because thats what its called here
(although there are no examples)
http://manual.cakephp.org/view/72/custom-methods-and-properties

On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I don't get what you mean with "custom properties". Maybe it's just me
> but, can you elaborate a bit more please?
>
> On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > How do you specify custom properties in a CakePHP model?
> > I'm trying to do this, but there is no sample code any where that
> > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread RichardAtHome

A CakePHP Model is just a PHP class. You can still use all of PHP's
class abilities.

for example:

class MyModel extends AppModel {

   var $myCustomPropery = "w00t!";

}

in controller:

echo $this->MyModel->myCustomProperty;


On Aug 28, 2:19 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I don't get what you mean with "custom properties". Maybe it's just me
> but, can you elaborate a bit more please?
>
> On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > How do you specify custom properties in a CakePHP model?
> > I'm trying to do this, but there is no sample code any where that
> > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Dardo Sordi Bogado

I don't get what you mean with "custom properties". Maybe it's just me
but, can you elaborate a bit more please?

On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> How do you specify custom properties in a CakePHP model?
> I'm trying to do this, but there is no sample code any where that
> shows how its done, can someone point me in the right direction?
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

How do you specify custom properties in a CakePHP model?
I'm trying to do this, but there is no sample code any where that
shows how its done, can someone point me in the right direction?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---