How to trip error manually...

2009-01-16 Thread Johnathan Henderson

Is there a way to activate and set the text of a $form-error outside
a validation rule?  I've got some complicated validation logic in the
controller and I would like the error to show near the offending field
instead of using setFlash.

-John
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Where to load session after Auth-redirect()?

2008-12-16 Thread Johnathan Henderson

I need to load some additional data into the session object after a
user successfully logs in via the Auth component.  I have a login
function, that after some remember me cookie logic  then redirects
to the Auth redirect...

 $this-redirect($this-Auth-redirect());

Where do I then catch that the authentication succeeded and I can then
go lookup the data based on the user id?

-John
--~--~-~--~~~---~--~~
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: Ordering search results by best match

2008-12-07 Thread Johnathan Henderson

I searched for sphinx at the bakery and found nothing  Adam, do
you have a direct link?

THANKS!

-John

On Dec 7, 7:05 am, Adam Royle [EMAIL PROTECTED] wrote:
 Have a look at sphinx, and the SphinxBehaviour on the bakery.

 Cheers,
 Adam

 On Dec 7, 7:22 am, Clay [EMAIL PROTECTED] wrote:

  My app has the following:

  Genus hasMany Species
  Species hasMany CommonName

  and the corresponding belongsTo relationships as well. Each of these
  models has a name field, and Genus and Species have several other
  fields.

  Say for example I have a Species Acer rubrum. This Species belongsTo
  Genus Acer and has a CommonName Red Maple.

  I want my users to be able to search the database for Red Maple and
  get as a result Species Acer rubrum (with the CommonName Red Maple
  highlighted to show that's what it matched. I can do this already.
  Yay.

  However if I have another Species with CommonName Bored Maple, I want
  to display this result too, but lower in the list than Red Maple.
  Since Bored comes before Red alphabetically I can't just order by
  CommonName.name to get the result I want.

  So what I know I could do is a series of finds:
  1) Find exact match: CommonName.name = $searchStr
  2) Find starting match: CommonName.name LIKE = $searchStr . '%'
  3) Find internal match: CommonName.name LIKE = '%' . $searchStr . '%'

  And then merge them into my results array.

  However, this seems very inefficient. Is there a way I can use cake's
  find() function to do this all in one go while ordering them in order
  of best match? I have thought about this for quite some time and done
  some research but I can't seem to find any clever solution.

  I might be able to do a custom query with a bunch of SELECTs as above
  combined with UNION or something, but this would be a pretty complex
  query and not really much more efficient than what I already know how
  to do.

  Thanks in advance any genius here who has a solution!

  -Clay
--~--~-~--~~~---~--~~
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: Agregating multiple databases

2008-11-29 Thread Johnathan Henderson

The DBs are identical, but on different servers.  I'm not an expert at
MySQL (the db we're using) so I'm not sure if it has the capability of
doing cross server queries.

-John

On Nov 26, 12:29 pm, Rafael Bandeira aka rafaelbandeira3
[EMAIL PROTECTED] wrote:
 For sure that's a way to do that.



  Can I create a model that will show me a list of all users in Ohio and
  Kentucky?

 Are both dbs on same host and can they be accessed by same app's db
 client and therefore be used in a same sql query?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Agregating multiple databases

2008-11-26 Thread Johnathan Henderson

If I have more than one database with identical tables, is there a way
for CakePHP to combine them?

Example:

DB1 has information for Ohio
DB2 has information for Kentucky

Both databases have a table that contains a list of Users (let's
assume that the primary key was setup so that there wouldn't be
duplicates of the same key in the seperate databases).

Can I create a model that will show me a list of all users in Ohio and
Kentucky?

Thanks in advance!

-John

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---