Re: Find conditions for HABTM

2006-07-23 Thread kitten
I would turn DEBUG to 2 and see what the sql queries are. I did, but I didn't post it, sorry. When using the bindModel() method, Cake makes a query for every(!) submission and adds the defined condition in the where clause -- but returns the record (with an empty User array) in any case,

condition in findAll for HasMany relation

2006-07-23 Thread francky06l
Hello, I am trying to use findAll to grab data from 2 tables that are linked by a HasMany and BelongTo association. I wounder if it's possible or if I have to do a query statement. I am writing a B2B application, basically 2 models, 2 tables : An application table and an offer table, an

Re: condition in findAll for HasMany relation

2006-07-23 Thread francky06l
Hello, me again ... I had a look to the bindModel API ..I have tried different combinations, but still not success it seems (looking at the debug select traces) that the findAll does a lot of successive queries, but does not actually make a query on the 2 tables at same time. I am a bit lost in

Re: Routing techniques

2006-07-23 Thread Jon Bennett
I'm currently rebuilding a CMS/store with cake. Most pages are dynamic, though many have their own table in the DB, which I'm trying to hamonise and reduce to 3 tables (plus some associations). so, roughly, I'll have: news posts products news has categories, as does posts and as does

Re: Modularize cakephp little bit different way ...

2006-07-23 Thread Dr. Tarique Sani [EMAIL PROTECTED]
KingChris wrote: Is this a good way or should I drop my imaginations and look on spliceit again ?! Not at all - I would suggest make a solution. I am currently working on the concept of Addons for my cheesecake photoblog - AddOns will be plugins specifically designed for cheesecake but an end

Re: Call to undefined function: mysql_real_escape_string()

2006-07-23 Thread Dr. Tarique Sani [EMAIL PROTECTED]
nate wrote: No. We originally had it using mysql_escape_string or on a related topic shouldn't Sanitize::sql be using mysql_real_escape_string as well? Cheers Tarique --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Load a model in all controllers

2006-07-23 Thread Rayed
Salam, Is there away to automatically load a specific model in all of my controllers without touching $uses value in each controller. I am planing to put the model loading code in app_controller class in the file /app/app_controller.php Best regards, Rayed

Re: Call to undefined function: mysql_real_escape_string()

2006-07-23 Thread nate
Nope. mysql_real_escape_string is MySQL-specifc. Cake supports several database drivers, and Sanatize::sql is designed to be a generalized method. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group.

Re: Load a model in all controllers

2006-07-23 Thread nate
Yes, just put var $uses = array('Model', 'Model', 'Model'); in AppController. --~--~-~--~~~---~--~~ 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

Re: LEFT JOIN missing in SELECT statement

2006-07-23 Thread francky06l
Thanks, The problem is that the condition changes depending of the user role (in my case), so I can't stick it into the model relation. I can do this using the bindModel on the fly, but even so I can;t succeed. Basically I will have to write the SQL query .. I will try to find better way ...

Re: How to use Helpers in Components (?)

2006-07-23 Thread 379 the manifesto
Ok thanks, I did that, now my Component gets my menu links array, and in the View my presentation Helper loops through the array and builds up a string of menu links which I then print out at the end of the Helper Method. Which makes a lot more sense, glad I got that sorted out early on... I

Re: LEFT JOIN missing in SELECT statement

2006-07-23 Thread Samuel DeVore
you should look at the bindModel stuffcake baker as a little bit about it here http://cakebaker.wordpress.com/2006/02/22/new-feature-bindmodelunbindmodel/ Sam DOn 7/23/06, francky06l [EMAIL PROTECTED] wrote: Thanks,The problem is that the condition changes depending of the user role(in my case),

how to set data in custom controller

2006-07-23 Thread bingo
Hello I have created a controller which uses multiple model. But when I try to use $this-set it does not work. Here is my controller class ?php class GeneralController extends AppController { var $name = 'General'; var $uses = array('Article',

Re: how to set data in custom controller

2006-07-23 Thread AD7six
bingo wrote: var $uses = array('Article', 'Keyword'); snip $this-set('data',$this-Post-findAll()); Btw, Post isn't in your uses array, as such if the code posted is exactly the same as you are using it won't work because the Post model isn't avaiable (set Debug to 2 and you'll see the PHP

Re: Load a model in all controllers

2006-07-23 Thread Rayed
Thank you nate, but this will break auto loading for all the controller. --~--~-~--~~~---~--~~ 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

Re: LEFT JOIN missing in SELECT statement

2006-07-23 Thread nate
Okay, I'm like 80% sure I get what you're saying. Besides manually modifying the association manually at runtime (do pr($this-Model-hasMany) and you'll see what I'm talking about), you could do: $this-Model1-Model2-findCount('user_id != ' . $current_user_id);

Re: how to set data in custom controller

2006-07-23 Thread bingo
Hi, Actually I am using $this-Article-findAll(); I thought exactly same as you said that $this-set sets a variable that will be available in view. But I am experiencing exactly the opposite. If I use $this-set then the variable $data does not get any value from $this-Article-findAll() and in

Re: how to set data in custom controller

2006-07-23 Thread AD7six
Hi bingo, when something fundamental doesn't appear to work, the discussion usually ends with a whoops I ... ;) How are you trying to access $data in your view? Can you confirm that with Debug set to 2 (or 3) and with this in your controller method: $result = $this-Article-findAll(); e (brmy

Re: LEFT JOIN missing in SELECT statement

2006-07-23 Thread francky06l
Thanks a lot nate, will keep investigating .. Anyway actually I am not trying to do something simple ..I can of course filter everything using php code and so on ..but I'd like the beauty of cake doing the job :-) Maybe I will create a fake HABTM table, but not this evening of course.. Actually

Re: FCK eventually sorted out - For AD7Six (and those interested)

2006-07-23 Thread Langdon Stevenson
Thought it worth mentioning that I have just implemented this WYSIWYG editor. It is simple and light weight, but has one issue with Cake (that I know of) and one other general issue with Firefox (1.5.0.4) and one with IE (6.0.2900) both on XP. - It doesn't handle the Cake naming conventions

Re: POSTDATA problem

2006-07-23 Thread ryanb006
Here's an example for an add function that returns to the add page for a products table: -- /app/controllers/products_controller.php -- function add() { if (!empty($this-data)) { $this-Model-save($this-data); $this-redirect('/products/add/'); } else {

Re: FCK eventually sorted out - For AD7Six (and those interested)

2006-07-23 Thread Langdon Stevenson
Hi Nate Even if you don't use Cake conventions for the textarea field, the data will still show up in $this-params['form'] in the controller. Sorry, I wasn't clear. The data doesn't even show up in $this-params, hence it is a serious issue. Also, (and this is just my personal

Re: how to set data in custom controller

2006-07-23 Thread bingo
Hi AD7six, Thanks for identifying the mistake...I got everything working.. But I am not sure how $this-data = $this-Article-findAll() is different from set method But n'ways for helping me our Cheers :) --~--~-~--~~~---~--~~ You received this message because

Re: condition in findAll for HasMany relation

2006-07-23 Thread bingo
One thing you can try is to use recursive option. Set recursive variable to 1 in you Application model. So your model will look like this. class Application extends AppModel { var $name = 'Application'; // required for php4 installs /* use recursive to find all offers related to