Caching + Component Logic
Hi all! I'm trying to implement view caching for the first time and having a bit of trouble. My sites use DarkAuth (http://bit.ly/eTBXXV), a handy little authentication component. The problem is that in my cached layout, cake:nocache has no effect when wrapped around DarkAuth variables because the component logic is being skipped. Can I get access to a component while using cacheAction? If not, what is the best way for me to implement caching? Any advice appreciated! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Recursive find()
That worked! The only problem is that it creates a ton of queries... instead of just LEFT JOIN ing the Shift table into the select query, CakePHP is issuing a separate query for each related Shift record. In addition to being inefficient, this means that I can't use Shift fields in my condition, fields, or order values :( I guess I should just write a custom query and skip bypass Cake's database abstraction. Thanks for all your help! - Scott On Oct 13, 6:11 am, francky06l [EMAIL PROTECTED] wrote: I faced the same problem. It seems there is a (recent bug) bug in containable (I use the SVN branch). It does not adjust the recursive properly. Try you query adding 'recursive' = 3 and that should do it.. hth On Oct 13, 7:58 am, francky06l [EMAIL PROTECTED] wrote: Did you check the generated query ? Does it contain the shifts table? On Oct 13, 4:43 am, squidliberty [EMAIL PROTECTED] wrote: As an experiment, I downloaded a fresh copy of Cake 1.2 and added only the scripts above. I wanted to confirm that this was not a problem caused by my existing site's configuration. The new installation produced identical results, so there must be something wrong with the approach. Maybe I'm just overlooking something obvious... - Scott On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote: After reading again the post $this-find('all', array( 'contain' = array( 'Department', 'Sale' = 'Shift(closed)'), 'fields' = array('Log.cost') ), ); Hope this works, I did not catch all relations at first glance, you might also use the containable behaviors in the Sale / Departement model .. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Recursive find()
I have three models: Shift, Sale and Log that are related using CakePHP associations (see model definitions below). I want to find logs and return their associated sale and the sale's associated shift. But I'm having a hard time with this... $this-find('all', array( 'contain' = array( 'Department', 'Sale', 'Sale' = array('Shift') ), 'fields' = array('Shift.closed', 'Log.cost'), )); Any idea why this produces SQL Error: 1054: Unknown column 'Shift.closed' in 'field list'? Where am I going wring? Any advice would be appreciated! I've also tried using recursive instead of contain, but had similar results. Models: class Log extends AppModel { var $name = 'Log'; var $belongsTo = array('Department', 'Sale'); var $actsAs = array('Containable'); } ... class Sale extends AppModel { var $name = 'Sale'; var $belongsTo = array('Shift'); var $hasMany = array('Log'); } ... class Shift extends AppModel { var $name = 'Shift'; var $hasMany = array('Sale'); } --~--~-~--~~~---~--~~ 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: Recursive find()
Thanks for the speedy response! Unfortunately, that doesn't return any data from the Shift model. I guess 'fields' overrides 'contain'? - Scott On Oct 12, 4:20 pm, francky06l [EMAIL PROTECTED] wrote: Probably: $this-find('all', array( 'contain' = array( 'Department', 'Sale', 'Sale' = array('Shift(closed)') ), 'fields' = array('Log.cost'), )); hth On Oct 12, 9:50 pm, squidliberty [EMAIL PROTECTED] wrote: I have three models: Shift, Sale and Log that are related using CakePHP associations (see model definitions below). I want to find logs and return their associated sale and the sale's associated shift. But I'm having a hard time with this... $this-find('all', array( 'contain' = array( 'Department', 'Sale', 'Sale' = array('Shift') ), 'fields' = array('Shift.closed', 'Log.cost'), )); Any idea why this produces SQL Error: 1054: Unknown column 'Shift.closed' in 'field list'? Where am I going wring? Any advice would be appreciated! I've also tried using recursive instead of contain, but had similar results. Models: class Log extends AppModel { var $name = 'Log'; var $belongsTo = array('Department', 'Sale'); var $actsAs = array('Containable');} ... class Sale extends AppModel { var $name = 'Sale'; var $belongsTo = array('Shift'); var $hasMany = array('Log');} ... class Shift extends AppModel { var $name = 'Shift'; var $hasMany = array('Sale'); } --~--~-~--~~~---~--~~ 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: Recursive find()
Hmmm... that seems to yield the same results (no Shift data). Also I tried adding containable to the Sale and Shift models but that didn't seem to make any difference. Any other ideas? Is there some other method to achieve the desired result? Thanks again! Scott On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote: After reading again the post $this-find('all', array( 'contain' = array( 'Department', 'Sale' = 'Shift(closed)'), 'fields' = array('Log.cost') ), ); Hope this works, I did not catch all relations at first glance, you might also use the containable behaviors in the Sale / Departement model .. --~--~-~--~~~---~--~~ 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: Recursive find()
As an experiment, I downloaded a fresh copy of Cake 1.2 and added only the scripts above. I wanted to confirm that this was not a problem caused by my existing site's configuration. The new installation produced identical results, so there must be something wrong with the approach. Maybe I'm just overlooking something obvious... - Scott On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote: After reading again the post $this-find('all', array( 'contain' = array( 'Department', 'Sale' = 'Shift(closed)'), 'fields' = array('Log.cost') ), ); Hope this works, I did not catch all relations at first glance, you might also use the containable behaviors in the Sale / Departement model .. --~--~-~--~~~---~--~~ 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: Stopping Contact Form Injection?
Well, I can't move to 1.2 on production sites, but I did take a look at its API and got some ideas. Here is what I added to my PHPMailer component, in case anyone else needs something similar. function cleanArray($toClean) { $sanitize = new Sanitize(); $header_bits = array('/%0a/i', '/%0d/i', '/Content-Type\:/i', '/ Content\-Transfer\-Encoding\:/i', '/charset\=/i', '/mime-version\:/i', '/multipart\/mixed/i', '/bcc\:.*/i','/to\:.*/i','/cc\:.*/i', '/from\:/ i', '/\\r/i', '/\\n/i'); if (is_array($toClean)) { while (list($k, $v) = each($toClean)) { if (is_array($toClean[$k])) $this-cleanArray($toClean[$k]); else { $v = $sanitize-cleanValue($v); $toClean[$k] = preg_replace($header_bits, '', $v); } } } else return null; } Now, I can just use $this-Email-cleanArray() instead of $sanitize- cleanArray(). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Stopping Contact Form Injection?
I have reason to believe that my contact form is being used to send bulk spam via an injection exploit. I'm using the PHPMailer component outlined at http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer. Can anyone tell me whether or not a simple cleanArray() is sufficient sanitization for posted data? My headers are all hard-coded, so everything submitted is going into the email body. Any advice would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Creating a Site down error page?
Yep, adding a redirect to AppController was my inclination as well. However, the tricky part is testing for a database connection. Anyone have any idea how best to do this? Seems like it shouldn't be very difficult - I just don't have a grasp on the esoteric inner-workings of the framework. Thanks! On Dec 17, 12:29 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It may not be the best place but I would probably put that check in my AppController, in the constructor or a before filter. THat way you have access to all of Cake and can check the connection. I don't know the best way to do this either but two possibilities would be either something like loadInfo() in a model or directly calling ConnectionManager::getDataSource(). You could probably make use of ConnectionManager from bootstrap too. I'd love to hear some other ideas that may be better suited. (my vauge answers can in part be attributed to not having any cake-app in front of me at the moment) On Dec 17, 6:12 pm, RichardAtHome [EMAIL PROTECTED] wrote: It's called 'write code that actually checks for errors'. This is an issue for any application, and I cannot think of any framework that automatically gives you that kind of functionality. What you call 'automatic' is the result of a forward-thinking developer who made a commitment to proper error handling. Yup, true. But, how *would* you configure cake to redirect to a site down page if the database connection failed? Some code in bootstrap.php that checks for a connection and then redirect to pages/site_down for example? On Dec 17, 3:41 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Dec 17, 2007 10:28 AM, squidliberty [EMAIL PROTECTED] wrote: I have on occasion had problems with my hosting during which MySQL is not accessible. The result is that CakePHP renders a malformed page and (if Debug is in use) throws a number of errors (such as Too many connections). In this sort of situation, some CMS (eg. Joomla!) will automatically throw up a This site is down page. Can anyone tell me how this might be done with CakePHP? I assume that there is some way to check for a proper database connection and generate an error message if one cannot be established. Any advice appreciated! It's called 'write code that actually checks for errors'. This is an issue for any application, and I cannot think of any framework that automatically gives you that kind of functionality. What you call 'automatic' is the result of a forward-thinking developer who made a commitment to proper error handling. -- Chris Hartjes My motto for 2007: Just build it, damnit! @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Creating a Site down error page?
I have on occasion had problems with my hosting during which MySQL is not accessible. The result is that CakePHP renders a malformed page and (if Debug is in use) throws a number of errors (such as Too many connections). In this sort of situation, some CMS (eg. Joomla!) will automatically throw up a This site is down page. Can anyone tell me how this might be done with CakePHP? I assume that there is some way to check for a proper database connection and generate an error message if one cannot be established. Any advice appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Simple Question - Return only entries for which associated data exists
I am using hasMany to associate posts with members. How can I craft my findAll query so that it returns only members for which posts exist (ie. members who have made one or more posts)? It seems inefficient to return every member and then throw out a large amount of the data. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
I believe that is how I am currently structuring my $conditions. The following code doesn't work for me... $conditions['NOT'] = array(blah); $conditions[0]['OR'] = array(blah, blah); $conditions[1]['OR'] = array(blah, blah); Is it just me? On May 28, 6:46 pm, Grant Cox [EMAIL PROTECTED] wrote: I'm not sure if this was an intended change, so we'll see what happens to your ticket. But to get the query you want just put the 'or' keys inside another array. $conditions = array( 'NOT' = array(..expiration...), array( 'OR' = array(...like $term...) ), array( 'OR' = array(...like $term2...) ) ); To me this makes sense, as in the query you want each of these three conditions joined by AND, but the latter two conditions to have OR inside brackets. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
Ok, I tried the latest nightly build and it has the same issue, so I've created a new ticket (#2663) addressing the problem. Hopefully this isn't just some quirk on my machine... Thanks for all your help! I will utilize a SQL formatter in the future :) On May 28, 3:10 am, AD7six [EMAIL PROTECTED] wrote: On 27 mayo, 23:32, squidliberty [EMAIL PROTECTED] wrote: Sorry, I didn't understand what you wanted me to do with those links. I see that I can post public code at CakeBin, but what are the Google results? Who knows, maybe they are links to format your sql online. Perhaps it's just me but for anything above and beyond playschool sql the below (example) format is a lot easier to read: SELECT * FROM atable WHERE (NOT (`listing`.`expiration` BETWEEN '1' AND '1180320723')) AND (((`listing`.`title` LIKE '%cat%') OR (`listing`.`description` LIKE '%cat%'))) AND (((`listing`.`title` LIKE '%dog%') OR (`listing`.`description` LIKE '%dog%'))) It makes it a lot easier to see what is inside what bracket - I just used the first google result to format the above. So is this a bug in 1.1.15 or is something wrong with my installation? Try the latest nightly, if you are missing brackets create a ticket. Make it easy to read :)! AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
Sorry, I didn't understand what you wanted me to do with those links. I see that I can post public code at CakeBin, but what are the Google results? I am using 1.1.15.5144 under PHP 4. The problem may have started after I upgraded from 1.1.14.4797, but I don't see anything listed under bugs at trac.cakephp.org... Should I roll back to 1.1.14 and see if the problems go away? (groan...) Thanks! On May 27, 6:50 am, AD7six [EMAIL PROTECTED] wrote: On May 27, 4:21 am, squidliberty [EMAIL PROTECTED] wrote: The $conditions I specify above create the following sql bit: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND (`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat %') AND (`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%') I believe that what I need would be this: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND ((`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat%')) AND ((`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%')) Note the extra parenthesis, creating the logic X and (A or B) and (M or N). How do I create groups like this? It should do that anyway, since thats pretty much the point of an OR. What revision are you using and If you use the latest code, does that still happen? I guess you didn´t like this bit: http://www.google.com/search?q=online+sql+format+http://bin.cakephp.org= readable output. Cheers, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
Err... actually, I was previously on v 1.1.13.4450 and I just did a rollback and everything works properly now. The same $conditions produces: WHERE (NOT (`Listing`.`expiration` BETWEEN '1' AND '1180320723')) AND (((`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat%'))) AND (((`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%'))) So is this a bug in 1.1.15 or is something wrong with my installation? I am even more baffled now! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
The $conditions I specify above create the following sql bit: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND (`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat %') AND (`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%') I believe that what I need would be this: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND ((`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat%')) AND ((`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%')) Note the extra parenthesis, creating the logic X and (A or B) and (M or N). How do I create groups like this? Thanks again for your expertise! On May 25, 4:02 am, AD7six [EMAIL PROTECTED] wrote: On May 24, 10:21 pm, squidliberty [EMAIL PROTECTED] wrote: Fabulous! That works perfectly for most of my queries. But why won't it work in the following? $conditions['NOT'] = array('Listing.expiration' = BETWEEN 1 AND .mktime()); $conditions[0]['OR'] = array(Listing.title = LIKE %.$term.%, Listing.description = LIKE %.$term.%); $conditions[1]['OR'] = array(Listing.title = LIKE %.$term_2.%, Listing.description = LIKE %.$term_2.%); Based on the examples given in other discussions, I'd expect this to return all listings between the timestamps given that include both term 1 and term 2 in either the title or description. But instead, the expiration requirement is ignored entirely. What sql is that generating, and what sql do you need to get it to work as you want. http://www.google.com/search?q=online+sql+format+http://bin.cakephp.org = readable output. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
Fabulous! That works perfectly for most of my queries. But why won't it work in the following? $conditions['NOT'] = array('Listing.expiration' = BETWEEN 1 AND .mktime()); $conditions[0]['OR'] = array(Listing.title = LIKE %.$term.%, Listing.description = LIKE %.$term.%); $conditions[1]['OR'] = array(Listing.title = LIKE %.$term_2.%, Listing.description = LIKE %.$term_2.%); Based on the examples given in other discussions, I'd expect this to return all listings between the timestamps given that include both term 1 and term 2 in either the title or description. But instead, the expiration requirement is ignored entirely. My apologies if these questions are answered elsewhere. I have searched both the CakePHP site and this group. A robust conditions tutorial would be an excellent endeavor! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Complex SQL Conditions (multiple ORs)
I need to query database entries that are (A OR B) AND (X OR Y). My $conditions currently looks like this: $conditions[0]['OR'] = array('Listing.expiration' = 0, 'Listing.expiration' = .mktime()); $conditions[1]['OR'] = array(Listing.title = LIKE %.$term.%, Listing.description = LIKE %.$term.%); The problem, of course, is that I am overriding 'Listing.expiration' = 0 with 'Listing.expiration' = .mktime(). How can I restructure this? Thanks for any suggestions! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Complex SQL Conditions (multiple ORs)
Looking it over, I think my question may boil down to this: how can I set conditions that specify X is not between A and B? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Eclipse PDT
I am migrating from Dreamweaver on WinXP and I'd like to build CakePHP sites in Eclipse PDT. I understand that there is FTP support built into Eclipse, but I cannot find it. I've looked in both the Server and Synchronize views. Can anyone assist me? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Sanitize and hyphens
I have several areas of my site where it is necessary to sanitize large amounts of user form data. cleanArray() makes this process a breeze - however, I have found that it replaces hyphens ('-') with the htmlentity equivalent ('#45;'). This is a big problem for email addresses, which may contain hyphens. How should I be handling this? My best solution was to create a fixSafeChar() function to convert the hyphens back. But this seems pretty crude. Any suggestions? Is cleanArray() not the right function for the task? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Case insensitive findAll?
I need to execute a complex findAll query that that is case insensitive. I have tried using lower() and ILIKE (note sure if this exists in MySQL) in my conditions, but neither seem to work for me. $conditions['OR'][] = array(lower(Listing.title) = LIKE %. $term.%); $conditions['OR'][] = array(Listing.title = ILIKE %.$term.%); What can I do? Any advice appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Case insensitive findAll?
I found a workaround. I was using BLOB columns in my database, but I converted them to TEXT columns. TEXT columns appear to be case- insensitive by default. Still curious about how one would properly write lower() into a findAll though... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Setting variables with beforeFilter()
Excellent! Thank you, that worked perfectly. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Setting variables with beforeFilter()
I need to set a variable using beforeFilter() and then access it from the controller (not the view). What technique should I use? Simply declaring '$x = true' does not seem to transfer into controller functions when my pages load. set() transfers variables to the view but not controller functions. Please advise! Thanks. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Multiple hasMany / belongsTo
Oh, those are specific to my application. The transaction table in my database has from and to fields to help keep track of which user is the receiver and which user is the sender. Barton wrote: Interesting, but what I don't get are the classNames From' and 'To'. What do you do with it? Did you create for 'From' and 'To' a model? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Multiple hasMany / belongsTo
A-ha! I have no idea what I was thinking :) Thanks! It seems to be working properly now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Multiple hasMany / belongsTo
Hi, I am still pretty new to CakePHP and I am having trouble doing something relatively simple... I have a database of members and I need to record transactions between members. At its most simple, each transaction entry needs an amount, a sender id and a receiver id. So my database looks something like this: Table 'members' - id Table 'transactions' - id - member_to - member_from - amount It is important to differentiate between the sending member and the receiving member. I am new to hasMany, but I surmise that my controllers should look something like this: class MembersController extends AppController { var $name = 'Members'; var $hasMany = array('Credit' = array('className' = 'Transaction', 'conditions' = '', 'order' = '', 'limit' = '', 'foreignKey' = 'member_to', 'dependent' = false, 'exclusive' = false, 'finderQuery' = ''), 'Debit' = array('className' = 'Transaction', 'conditions' = '', 'order' = '', 'limit' = '', 'foreignKey' = 'member_from', 'dependent' = false, 'exclusive' = false, 'finderQuery' = '')); } class TransactionsController extends AppController { var $name = 'Transactions'; var $scaffold; var $belongsTo = array('From' = array('className' = 'Member', 'conditions' = '', 'order' = '', 'foreignKey' = 'member_from'), 'To' = array('className' = 'Member', 'conditions' = '', 'order' = '', 'foreignKey' = 'member_to')); } So, although this makes sense to me, when I load a member (using $this-Member-findById) and print out the array (using print_r()), I only see the 'Member' array... no 'Debit' or 'Credit' arrays... What am I doing wrong? Are my hasMany/belongsTo statements wrong? I get no errors. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---