Re: Help! How to order by created desc with findAllByName( ) method

2009-03-29 Thread Dr. Loboto

findBy(string $value, $fields=null, $order=null,
$recursive=null)
finAlldBy(string $value, $fields=null, $order=null,
$limit=null, $page=null, $recursive=null)

By some unknown reason manual keeps this as secret.

Also these magic methods can take more the one param with AND or OR
condition:

findAllByNameAndGroup($nameValue, $groupValue)
findByNameOrUsername($nameValue, $usernameValue)

On Mar 28, 3:00 am, cpeele  wrote:
> Hey guys,
>
> I am trying to just get a list of Products ordered by created desc but
> I can't seem to get it.
>
> Products have a "name" field so I am using findAllByName($name). I
> have tried various things but can't seem to get it.
>
> Any help would be greatly appreciated. Thanks!
> 
>         function view($name)
>         {
>                 $projects = $this->Project->findAllByName($name);
>                 $this->set('projects', $projects);
>                 $this->set('projectName', $name);
>         }
> -
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help! How to order by created desc with findAllByName( ) method

2009-03-28 Thread JamesF

when i first started cakephp i used the findby methods because they
seemed intuitive. find 'all' seems to be much more flexible and i use
that instead on most queries.

On Mar 27, 4:00 pm, cpeele  wrote:
> Hey guys,
>
> I am trying to just get a list of Products ordered by created desc but
> I can't seem to get it.
>
> Products have a "name" field so I am using findAllByName($name). I
> have tried various things but can't seem to get it.
>
> Any help would be greatly appreciated. Thanks!
> 
>         function view($name)
>         {
>                 $projects = $this->Project->findAllByName($name);
>                 $this->set('projects', $projects);
>                 $this->set('projectName', $name);
>         }
> -
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help! How to order by created desc with findAllByName( ) method

2009-03-27 Thread cpeele

That Worked! Thanks very much!

On Mar 27, 3:53 pm, mscdex  wrote:
> On Mar 27, 4:00 pm,cpeele wrote:
>
> > Hey guys,
>
> > I am trying to just get a list of Products ordered by created desc but
> > I can't seem to get it.
>
> > Products have a "name" field so I am using findAllByName($name). I
> > have tried various things but can't seem to get it.
>
> The findAllBy function by itself does not permit any ordering. You may
> have to use a normal find statement like: $this->Project->find('all',
> array('conditions' => array('Project.name' => $name), 'order' =>
> 'Project.created DESC'));
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help! How to order by created desc with findAllByName( ) method

2009-03-27 Thread mscdex

On Mar 27, 4:00 pm, cpeele  wrote:
> Hey guys,
>
> I am trying to just get a list of Products ordered by created desc but
> I can't seem to get it.
>
> Products have a "name" field so I am using findAllByName($name). I
> have tried various things but can't seem to get it.

The findAllBy function by itself does not permit any ordering. You may
have to use a normal find statement like: $this->Project->find('all',
array('conditions' => array('Project.name' => $name), 'order' =>
'Project.created DESC'));
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help! How to order by created desc with findAllByName( ) method

2009-03-27 Thread cpeele


Hey guys,

I am trying to just get a list of Products ordered by created desc but
I can't seem to get it.

Products have a "name" field so I am using findAllByName($name). I
have tried various things but can't seem to get it.

Any help would be greatly appreciated. Thanks!

function view($name)
{
$projects = $this->Project->findAllByName($name);
$this->set('projects', $projects);
$this->set('projectName', $name);
}
-
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---