debugger.php errors when $persistentModel = true

2009-04-28 Thread gianpaulo
Hi, I tried including $persistentModel = true as suggested here : http://www.pseudocoder.com/archives/2009/03/17/8-ways-to-speed-up-cakephp-apps/comment-page-1/ Well it did increase the speed of my app (about 200%) but I'm receiving this error when debug != 0 Catchable fatal error: Object of

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread Martin Westin
I don't use saveAll much myself but oen thing you can look into is the phrasing that explains what it does. I remember reading that saveAll can save multiple records of a single model OR one record and multiple related Models. I am not sure it ca do both at the same time the way you are trying.

Re: What is considered to high query time?

2009-04-28 Thread Martin Westin
As you say this varies greatly with each application and the hardware setup being measured. Very generally, I'd say that is you can stay under 100ms for most normal data. If you are over 100 and not doing statistical gathering or have a very saturated database or something like that you can

Re: Tips for cutting queries and load time?

2009-04-28 Thread Martin Westin
Thanks for explaining. Looks like something I will need to spend some time with soon :) On Apr 24, 7:01 pm, brian bally.z...@gmail.com wrote: On Fri, Apr 24, 2009 at 11:10 AM, Martin Westin martin.westin...@gmail.com wrote: Views, I haven't got my head into yet but it sounds like I

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-28 Thread Miles J
Well if you add that to AppModel, ALL your models will not have a database table. Only put that in the models that DO NOT have a table. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this

Using several views for same controller function

2009-04-28 Thread Paco Gomez
Good morning, I don't know if I could use two diferent view for the same controller function, for example: class UsersController extends AppController { } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP

Using several views for same controller function

2009-04-28 Thread Paco Gomez
Good morning, I don't know if I could use two diferent view for the same controller function, for example: class UsersController extends AppController { function tes() { if(a==0) //there I use view a.ctp if (b==0) //there I use view b.ctp } } Thank you in adavantage

Re: Using several views for same controller function

2009-04-28 Thread d1ve blu3
Good morning,, What do you mean by two different view? IMHO,One view is for one function in controller.. -- One of the mankind greatest enemy is man itself -Gendo Ikari --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Using several views for same controller function

2009-04-28 Thread Fran Iglesias
Hi, MVC complaints aside, if you want to use a no convention view, simply perform a $this-render('the_view'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email

Re: Using several views for same controller function

2009-04-28 Thread John Andersen
Don't let the controller know how to present information, let the view itselt decide which information to present using elements! So in the controller, provide the information to the view: $this-set( decsion, array(a = $a, b = $b) ); And in the view: if ( $decision[a] == 0 ) { $this-element(

Perfomance in CakePHP

2009-04-28 Thread keyurvaghani
Hello folks, Can anybody please let me know what should be taken care for better perfomance for site becuase it seems for developing large application there might perfomance issue arise with cake 1.2. As i m going to develop big application in and i m really wanted to know more regarding

Re: cakephp auth component password field always empty why ??

2009-04-28 Thread Malcolm Krugger
Brian Good work indeed We have made good progress DESCRIBE `members` INSERT INTO `members` (`username`, `password`, `firstname`, `lastname`, `emailid`) VALUES ('zfa', 'ssadf', 'd', 'ADa', 'AdsaD') SELECT LAST_INSERT_ID() AS insertID Now the first SELECT statement is gone as you have

Re: cakephp auth component password field always empty why ??

2009-04-28 Thread Malcolm Krugger
$this-Auth-userModel = 'Member'; did the trick and of course Hats off to Brian --~--~-~--~~~---~--~~ 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

Cakephp does same SQL query multiple times (foreign key)

2009-04-28 Thread qwanta
I have a simple database set-up and have optimized the query using cakephp's containable behavior to where I get only the fields I need (I check this with a debug command to see the array). However when I set the debug level to 2 in core.php, I notice many repeat SQL calls on foreign keys. For

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-28 Thread Pixelastic
Well, AppModel and SpecialModel are the only two models that do not use a table .I think I may not have been clear enough and you misunderstood what I was trying to do. Here is the context : I had to apply a regexp to every text field of every item saved in my database. So I list every model of

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-28 Thread Pixelastic
Sorry, hit 'Send' too early... The code I'm using is : $appModelList = Configure::listObjects('model'); foreach($appModelList as $modelName) { // I have to manually exclude those two model or loadModel will fail if (in_array($modelName, array('SpecialModal', 'AppModel'))) {

Re: Getting a specific URL out of a string

2009-04-28 Thread starkey
You can use substr and strpos to get it. $ii = 0; $jj = 0; if (FALSE !== ($ii = strpos($url, 'twitpic.com'))) { $jj = strpos($url, '', $ii); $twitpicUrl = substr($url, $ii, ($jj-$ii)); } Or something like that. Shawn On Apr 28, 7:54 am, Kyle Decot kdec...@gmail.com wrote: I know this

Re: Using several views for same controller function

2009-04-28 Thread Paco Gomez
Thank you every body, Yes, I didn't explain very well what I want to do but with $this- render('the_view'); solution I've resolved my question. Bye On 28 abr, 11:00, John Andersen j.andersen...@gmail.com wrote: Don't let the controller know how to present information, let the view itselt

Re: Perfomance in CakePHP

2009-04-28 Thread starkey
Keyur, If you are writing a big application then I would suggest you invest the time to read the book @ book.cakephp.org and blogs from lemoncake, debuggable, etc which are all wonderful resources. Shawn On Apr 28, 7:06 am, keyurvaghani keyurvagh...@gmail.com wrote: Hello folks, Can anybody

Getting a specific URL out of a string

2009-04-28 Thread Kyle Decot
I know this isn't specifically a CakePHP question but I thought I would see any any of you could help me out anyways. I am getting a feed of Twitter updates and I want to check each one to see if it has a http://twitpic.com URL in it. How would I go about getting the TwitPic URL out of it? I

Re: debugger.php errors when $persistentModel = true

2009-04-28 Thread Alexandru Ciobanu
On 04/28/2009 09:11 AM, gianpaulo wrote: Hi, I tried including $persistentModel = true as suggested here : http://www.pseudocoder.com/archives/2009/03/17/8-ways-to-speed-up-cakephp-apps/comment-page-1/ Well it did increase the speed of my app (about 200%) but I'm receiving this error when

SUBQUERY Question

2009-04-28 Thread Fabian
Hey, I'm so happy I've found this group. Maybe someone can help me with my problems here (I'm a beginner in Cakephp). Sorry for my bad english by the way. Ok I've got two Models in HABTM relation: verses and users. in my controller action i want to get some specific verses (for example: the

Database Connection Pool

2009-04-28 Thread Helton Alponti
Hello Guys, I'm new person of group and I started my studies with cakephp now. Do somebody know if exists some database connection poll at CakePhp? I was looking for documentation but I didn't find any. :( Could somebody help me? Please. =) Thanks, eltu

Required form field NOT marked with required CSS class

2009-04-28 Thread Jonathan
In a model, I have a validation like the following: var $validate = array( 'name' = array('notempty'), 'number' = array( 'notempty'=array('rule'='notempty', 'message'='Number must be specified'), 'isUnique'=array('rule'='isUnique', 'message'='Number is already used') )); - and in

find vs. read

2009-04-28 Thread Dave Maharaj :: WidePixels.com
I am trying to replace a read() with my own find statement. I am running them both to see the results they produce. The $model_name is dynamicaly added so i can contain the specific model needed for this specic function depending on the action) $this-data = $this-User-read(null, $id);

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-28 Thread brian
Is this just a one-time thing? Wouldn't it be simpler just to list the models you need to access? You have a typo, also: SpecialModal. What's SpecialModel for, anyway? On Tue, Apr 28, 2009 at 8:23 AM, Pixelastic timcc.pe...@gmail.com wrote: Sorry, hit 'Send' too early... The code I'm using

Re: Required form field NOT marked with required CSS class

2009-04-28 Thread brian
Add 'allowEmpty' = true for number. On Tue, Apr 28, 2009 at 9:31 AM, Jonathan jst...@image.dk wrote: In a model, I have a validation like the following: var $validate = array(  'name' = array('notempty'),  'number' = array(    'notempty'=array('rule'='notempty', 'message'='Number must be

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-28 Thread Pixelastic
Hopefully this will be a one time thing :) I was just wondering if my approach for handling errors could have been improved. I guess it's simpler to know which model to include/exclude. Thanks for pointing out the typo. SpecialModel is a wrapper model (like AppModel) that I have to use accross

CakePHP beginner with some starter questions

2009-04-28 Thread samweis
Hi, I am new in cakePHP (for about two days now). I think I got a pretty good understanding about the MVC concept. I saw the blog tutorial and followed every step and also followed the same recipe expample. Now I wanted to create my own application and before building all pieces of it, I wanted

Re: Getting a specific URL out of a string

2009-04-28 Thread brian
This should match the URL followed by anything other than whitespace or double quote. $pattern = '/(http:\/\/twitpic\.com[^\s\]+)/'; preg_match($pattern, $str, $matches, PREG_SET_ORDER); debug($matches); On Tue, Apr 28, 2009 at 7:54 AM, Kyle Decot kdec...@gmail.com wrote: I know this isn't

Re: CakePHP beginner with some starter questions

2009-04-28 Thread Aivaras
Hey, your $content_for_layout is filled by your view, which is called via controller/action. If you want your domain.tld/ to go to specific controller/action instead of /pages/display/home you need to create a routing rule (see book for this). The file is here: APP/core/routes.php If you want

Help finding where queries are coming from

2009-04-28 Thread Dave Maharaj :: WidePixels.com
I been using debug(); all over my controller action to see where these queries are coming from. I have an element that gets loaded into a div on the page (7 queries) ,that element has edit Ajax update link that loads a Ajax form in its place ... (15 queries) click 'save' and presto 94 queries.

Re: Getting a specific URL out of a string

2009-04-28 Thread Kyle Decot
What does PREG_SET_ORDER do exactly? When I use it I get a Invalid flags specified error. Thank Ideas? On Apr 28, 12:11 pm, brian bally.z...@gmail.com wrote: This should match the URL followed by anything other than whitespace or double quote. $pattern = '/(http:\/\/twitpic\.com[^\s\]+)/';

Re: Getting a specific URL out of a string

2009-04-28 Thread brian
Sorry, make that preg_match_all(). From the manual: PREG_SET_ORDER Orders results so that $matches[0] is an array of first set of matches, $matches[1] is an array of second set of matches, and so on. http://www.php.net/manual/en/function.preg-match-all.php On Tue, Apr 28, 2009 at 1:06 PM,

Check array for duplicate

2009-04-28 Thread Dave Maharaj :: WidePixels.com
I have modified my form value using Firebug and I get this array (which should never happen unless someone has edited the form and tried submitting the altered values) How could I create a quick 'check the values' function for duplicates to see if someone was trying to mess with the site?

Re: Check array for duplicate

2009-04-28 Thread brian
$this-data['System']['System'] = array_unique($this-data['System']['System']); On Tue, Apr 28, 2009 at 1:33 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have modified my form value using Firebug and I get this array (which should never happen unless someone has edited the

RE: Check array for duplicate

2009-04-28 Thread Dave Maharaj :: WidePixels.com
Ok right onseems to get me started. I have this in my controller but if there is a duplicate its not saving which is what I want) but skipping past the }else{ Ideas what i am missing? if (!empty($this-data)) { $san = new Sanitize();

RE: Check array for duplicate

2009-04-28 Thread Dave Maharaj :: WidePixels.com
Ok I see now array_unique($this-data[$model_name][$model_name] removes duplicate values. My question now expands as I keep testing edited values with FireBug Example my checkbox values range from 1 - 15. I can edit the value to 999 which there is nothing for and check the table and sure enough

Re: Check array for duplicate

2009-04-28 Thread brian
I don't know why the save isn't happening but you shouldn't have the array_unique() in the if test because that just returns the modified array. If you're more interested in testing whether the array has dupes, rather than simply removing them, I think you'd have to do something like: if

Re: Check array for duplicate

2009-04-28 Thread brian
Just create a validation rule pointing to a method in the System model. Fetch the values from the table and compare to whatever was submitted. On Tue, Apr 28, 2009 at 2:48 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Ok I see now

RE: Check array for duplicate

2009-04-28 Thread Dave Maharaj :: WidePixels.com
Basically I am trying to do 2 things with it now. Check for duplicates (would only happen if someone changes the values in the form with Firebug or something) And Check the submitted values against the values in the database. I added a query to get the values that are possible $test =

Re: Perfomance in CakePHP

2009-04-28 Thread GreyCells
Hi Keyur You need to define define 'big application' - Number of tables, rows, users, connections (bandwidth) or all of the above? For large numbers of tables, Containable is your friend. For the others, Cake is unlikely to be your primary cause of concern. Good database design and a

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread rartavia
Hello, thanks Martin. I reviewed saveAll() docs and it explicitly tells it wont work for not directly associated models. (http://book.cakephp.org/view/75/Saving-Your-Data) It would be nice for a future version of cake to have it though. Where does one submits this kind of petitions to cake

how to order by hasmany-count (without query())

2009-04-28 Thread CheshirePuss
I have tables: users, sounds, votes. - users hasmany votes - sounds hasmany votes - votes has fields: id, user_id, sound_id This setup gives me the ability to have users vote for sounds, and to keep the info about who voted for what (though maybe this is not a good way to do it, if so, please

Plugin model with no table

2009-04-28 Thread hydra12
I'm creating a plugin with a model that doesn't use a table. My model looks like this: pre ?php App::import('vendor', 'adldap'); class AdauthUser extends AdauthAppModel { var $name = AdauthUser; var $useTable = false; /pre In spite of having $useTable = false, I get a missing

dependent has no effect with delete()

2009-04-28 Thread brian
I'm using $this-Item-del($id, true) in ItemsController. I expect that its ItemFiles would also be deleted but they are not. I've compared my models with the examples in the book several times and plodded through the source and I've no idea what the problem is. Anyone else think of something?

Rookie questions

2009-04-28 Thread Dave Maharaj :: WidePixels.com
I am doing something and want to know if I am going about it the right way. I baked an application, and for Users which has a few HABTM tables but did not bake HABTM model or controllers. (the users_systems controller or model for example) Now in the Users edit function i turned all the select

Re: dependent has no effect with delete()

2009-04-28 Thread brian
Solved. I just noticed that ItemFile::beforeDelete() did not return true; On Tue, Apr 28, 2009 at 5:01 PM, brian bally.z...@gmail.com wrote: I'm using $this-Item-del($id, true) in ItemsController. I expect that its ItemFiles would also be deleted but they are not. I've compared my models with

Re: Plugin for MySQL Workbench: Who to contact?

2009-04-28 Thread Karsten Wutzke
On Apr 25, 9:52 am, rich...@home richardath...@gmail.com wrote: I downloaded the 5.1 Beta OSS and installed the plugin. Created a schema no problems, but only for copying to the clipboard (no biggy tbh)  :-) Are you using Windows XP? I only get garbage characters on *any* plugin that uses

Cleaner display of related data in baked views? displayField?

2009-04-28 Thread geste
I started a project with a bunch of preliminary scaffolded views and those were find for helping us through data structures and relationships. They also all included some nice defaults -- would show name by default for a foreign key id in index and view views. But it was clear I had to move on

Re: Cleaner display of related data in baked views? displayField?

2009-04-28 Thread brian
On Tue, Apr 28, 2009 at 6:41 PM, geste jim.ho...@gmail.com wrote: I started a project with a bunch of preliminary scaffolded views and those were find for helping us through data structures and relationships.  They also all included some nice defaults -- would show name by default for a

Re: Cleaner display of related data in baked views? displayField?

2009-04-28 Thread geste
On Apr 28, 4:00 pm, brian bally.z...@gmail.com wrote: On Tue, Apr 28, 2009 at 6:41 PM, geste jim.ho...@gmail.com wrote: I started a project with a bunch of preliminary scaffolded views and those were find for helping us through data structures and relationships.  They also all included

Validate in Controller

2009-04-28 Thread Dave Maharaj :: WidePixels.com
Trying to validate in controller before saving with this: $this-User-$model_name-set($this-data); debug($this-data); if ($this-User-$model_name-validates()) { debug($model_name); $test = 'Validated';

Re: Cleaner display of related data in baked views? displayField?

2009-04-28 Thread brian
On Tue, Apr 28, 2009 at 7:35 PM, geste jim.ho...@gmail.com wrote: Brian, Personally, I'll take your response to mean I'm not out of my mind. I'm not sure what you mean but I don't think either of us are out of their mind. :-) Yes, time to leave scaffolding behind, but there were some

Re: Validate in Controller

2009-04-28 Thread brian
Have a look at this post from Teknoid: http://teknoid.wordpress.com/2008/10/16/how-to-validate-habtm-data/ On Tue, Apr 28, 2009 at 7:46 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Trying to validate in controller before saving with this:

Re: /app/plugins/content/vendors/js/tiny_mce doesn't work properly

2009-04-28 Thread Evert
Plassseee --~--~-~--~~~---~--~~ 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

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread rartavia
This is how I worked out saving not directly related data using saveAll in one single Ajax call: I send the data exactly the same, as in this discussion's first message, with the non directly related model INSIDE the directly related model (SectionParts INSIDE data[Section])

I am tryinging to customize the translate() function in cake\libs\i18n.php

2009-04-28 Thread Anibigi
I'm completely new to cakePHP and OOPs I am tryinging to customize the translate() function in cake\libs \i18n.php How can I override the method translate() in my own model. need urgent pointer on this.Please help if you have any ideas --~--~-~--~~~---~--~~ You

call javascript from the action form

2009-04-28 Thread Nic
Hi there! I having some problems trying to call a java script from the action's forms. - What I need is something like this: form action=javascript:parent.doForm(); what I got is this: form id=UserJavascript:parent.doForm();Form method=post action=/ users/javascript:parent.doForm(); - my php

Re: /app/plugins/content/vendors/js/tiny_mce doesn't work properly

2009-04-28 Thread Evert
Ok, finally fixed it. Like I said before: And btw, I did find a way to give the browsers the css-files it needed from tinyMCE, but then there were the images that're used in the css- files which still didn't work. So I disabled that fix to search for another one. This morning I just enabled the