Re: What's your opinion: database views VS complex join conditions?
MySQL doesn't cache views, so it's not saving you any performance, and depending on the nature of the view, may be costing you more than doing the raw queries. Personally, the penalty, when there is one, is so vanishingly small that I prefer to use views for certain kinds of complex joins that I will always be reading from constantly in an application. There really is no alternative that can save you performance cycles other than denormalizing the information into reporting tables during updates and reading from the reporting tables. Nowadays, developer time is more valuable than shaving 0.5 -2 milliseconds of a second from a select. If you're at the point where that 0.5-2 milliseconds actually matters, you're probably better off coming up with some good caching schemes. Hopefully MySQL will support view caching soon making this all moot. I name my views v_tablename when I use them as an extension of some standard table. For example, my users table joins with the groups table, the people table, the company table, and a whole bunch of other things. I created a v_user table and for all my user management indexes in Cake, I use the VUser model instead of the User model. My Users controller simply uses both and that's it. Sure, for the cases where all I need is user information, I'll be worse off using the view than the table. But for a lot of index "views" and reports in the application, I need to display all the relevant fields. So there's no performance hit in those cases and the development and maintenance is much improved. On Oct 7, 8:13 pm, Jeremy Burns | Class Outfit wrote: > My quick and dirty response is that if this view is essentially only used for > view operations (in other words you're not updating the data) and you don't > need to do any joins at the model level, then if it works your approach is > the right one. The database is designed to do these complex joins so I'd say > you were leveraging its native power. > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 8 Oct 2010, at 03:36, Michael T wrote: > > > > > Hi all, > > > In attempt to solve a particular problem, I've tried a solution which > > to me, a CakePHP novice, seems a bit un-Cake like. I wanted to ask > > your opinion here on whether a) this matters; and b) if it does > > matter, what's the Cake-friendly way to do it? > > > Here's a summary of my models and their relationships: > > > I have a model for Jobs. I have a model for Employees. Over time, one > > Job has different Employees occupying it. This information is stored > > in a joining table JobOccupations (with a foreign key to the Job, the > > Employee, plus additional details like start date, end date, etc). > > > Job hasMany JobOccupation > > JobOccupation belongsTo Job > > Employee hasMany JobOccupation > > JobOccupation belongsTo Employee > > > To query the database for the "latest" employee (i.e. the last > > employee to occupy each job) I need to do something like this: > > > SELECT JO1.id, JO1.job_id, JO1.employee_id > > FROM job_occupations JO1 > > LEFT JOIN job_occupations JO2 > > ON JO1.job_id = EO2.job_id > > AND JO1.id < JO2.id > > WHERE JO2.id IS NULL > > > This will select the records of the job_occupations table with the > > maximal primary key id for any given job id. (Because records are > > inserted sequentially, this guarantees that the maximal id belongs to > > the most recent record.) > > > So in database world, to execute this query easily and use its > > information with other tables in the database, I created a stored view > > called "job_latest_occupations". Then I can join this view with other > > views or tables to get all the employee or job details for only the > > most recent occupations. > > > Now, I want to report on this information in my Cake application. So I > > created a Model "LatestJobOccupation" based off the database view > > (actually, not the view I showed above, but a more complex one which > > incorporates that view and joins onto another 6 or so tables). This > > model has no relationships to other models. > > > To report on the data, I just run find queries on this model. Because > > the view just pulls in every field from all the joined tables, I get > > convenient access to all the fields in the one result record (and not > > split into different associative arrays based on the table name -- > > although that still happens when I specify conditions on the query > > strangely). I get away with not having to specify hairy join > > conditions. > > > So I guess my question is -- is this wrong? Should I be trying to do > > it the more Cake way (I'm not sure if such a thing exists)? Or should > > I be utilising database features wherever possible? What would you do? > > > Cheers > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > You received this message because you are subscribed to t
Re: What's your opinion: database views VS complex join conditions?
My quick and dirty response is that if this view is essentially only used for view operations (in other words you're not updating the data) and you don't need to do any joins at the model level, then if it works your approach is the right one. The database is designed to do these complex joins so I'd say you were leveraging its native power. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 8 Oct 2010, at 03:36, Michael T wrote: > Hi all, > > In attempt to solve a particular problem, I've tried a solution which > to me, a CakePHP novice, seems a bit un-Cake like. I wanted to ask > your opinion here on whether a) this matters; and b) if it does > matter, what's the Cake-friendly way to do it? > > Here's a summary of my models and their relationships: > > I have a model for Jobs. I have a model for Employees. Over time, one > Job has different Employees occupying it. This information is stored > in a joining table JobOccupations (with a foreign key to the Job, the > Employee, plus additional details like start date, end date, etc). > > Job hasMany JobOccupation > JobOccupation belongsTo Job > Employee hasMany JobOccupation > JobOccupation belongsTo Employee > > To query the database for the "latest" employee (i.e. the last > employee to occupy each job) I need to do something like this: > > SELECT JO1.id, JO1.job_id, JO1.employee_id > FROM job_occupations JO1 > LEFT JOIN job_occupations JO2 > ON JO1.job_id = EO2.job_id > AND JO1.id < JO2.id > WHERE JO2.id IS NULL > > This will select the records of the job_occupations table with the > maximal primary key id for any given job id. (Because records are > inserted sequentially, this guarantees that the maximal id belongs to > the most recent record.) > > So in database world, to execute this query easily and use its > information with other tables in the database, I created a stored view > called "job_latest_occupations". Then I can join this view with other > views or tables to get all the employee or job details for only the > most recent occupations. > > Now, I want to report on this information in my Cake application. So I > created a Model "LatestJobOccupation" based off the database view > (actually, not the view I showed above, but a more complex one which > incorporates that view and joins onto another 6 or so tables). This > model has no relationships to other models. > > To report on the data, I just run find queries on this model. Because > the view just pulls in every field from all the joined tables, I get > convenient access to all the fields in the one result record (and not > split into different associative arrays based on the table name -- > although that still happens when I specify conditions on the query > strangely). I get away with not having to specify hairy join > conditions. > > So I guess my question is -- is this wrong? Should I be trying to do > it the more Cake way (I'm not sure if such a thing exists)? Or should > I be utilising database features wherever possible? What would you do? > > Cheers > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
What's your opinion: database views VS complex join conditions?
Hi all, In attempt to solve a particular problem, I've tried a solution which to me, a CakePHP novice, seems a bit un-Cake like. I wanted to ask your opinion here on whether a) this matters; and b) if it does matter, what's the Cake-friendly way to do it? Here's a summary of my models and their relationships: I have a model for Jobs. I have a model for Employees. Over time, one Job has different Employees occupying it. This information is stored in a joining table JobOccupations (with a foreign key to the Job, the Employee, plus additional details like start date, end date, etc). Job hasMany JobOccupation JobOccupation belongsTo Job Employee hasMany JobOccupation JobOccupation belongsTo Employee To query the database for the "latest" employee (i.e. the last employee to occupy each job) I need to do something like this: SELECT JO1.id, JO1.job_id, JO1.employee_id FROM job_occupations JO1 LEFT JOIN job_occupations JO2 ON JO1.job_id = EO2.job_id AND JO1.id < JO2.id WHERE JO2.id IS NULL This will select the records of the job_occupations table with the maximal primary key id for any given job id. (Because records are inserted sequentially, this guarantees that the maximal id belongs to the most recent record.) So in database world, to execute this query easily and use its information with other tables in the database, I created a stored view called "job_latest_occupations". Then I can join this view with other views or tables to get all the employee or job details for only the most recent occupations. Now, I want to report on this information in my Cake application. So I created a Model "LatestJobOccupation" based off the database view (actually, not the view I showed above, but a more complex one which incorporates that view and joins onto another 6 or so tables). This model has no relationships to other models. To report on the data, I just run find queries on this model. Because the view just pulls in every field from all the joined tables, I get convenient access to all the fields in the one result record (and not split into different associative arrays based on the table name -- although that still happens when I specify conditions on the query strangely). I get away with not having to specify hairy join conditions. So I guess my question is -- is this wrong? Should I be trying to do it the more Cake way (I'm not sure if such a thing exists)? Or should I be utilising database features wherever possible? What would you do? Cheers Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Plug-in Models
I have various controllers such as confirmations, passwords, members that I would like to package as a plugin to keep them in 1 spot. So going thru the cookbook it mentions nothing about using existing models within a plugin. My Member plugin will use the regular User model. How can this be done? Something like that? Any insight would be great. First attempt so bare with me. Thanks, Dave Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: HTML Purifier or Sanitize core library
Personally I use textile, as it has more syntax elements than markdown does. The API however uses markdown, and there is a markdown parser helper in the ApiGenerator plugin if you are looking for one. -Mark On Oct 6, 1:26 pm, Loic Duros wrote: > Thanks for all the answers -- > > Mark, do you use Markdown or textile at mark-story.com to write blog posts? > Just curious since it seems you have lots of HTML in there. > > Thanks again, > > Loic > > > > > > > > > > On Wed, Oct 6, 2010 at 1:16 PM, mark_story wrote: > > HTML purifier is miles better than the Sanitize. I would recommend > > escaping and using a text processor like markdown or textile. > > However, if you need to accept html from the unwashed masses, use > > HTMLPurifier. > > > -Mark > > > On Oct 4, 1:02 pm, Loic Duros wrote: > > > Hello, > > > > I'm currently building a blog with CakePHP, and I would like to > > > sanitize/filter my posts before they are displayed on screen to prevent > > > cross-site scripting. However, I would still like to allow for a great > > deal > > > of HTML markup and attributes in the HTML. I have tried using the > > Sanitize > > > Core Library but, as far as I know, it doesn't allow for filtering some > > tags > > > while keeping others. As a result, I'm looking into HTML Purifier ( > >http://htmlpurifier.org/) to do the job in my controller and/or view > > > template files. I found the following Brita Component in the Bakery: > >http://bakery.cakephp.org/articles/view/brita-component-with-html-pur... > > > > I wonder however if anyone has implemented such a filtering/sanitizing > > > solution for their site and if I'm missing something obvious I should be > > > using to secure my site on that end. > > > > Thank you, > > > > Loic > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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 > om>For more options, visit this group at > >http://groups.google.com/group/cake-php?hl=en > > -- > Loic J. Duros -www.lduros.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Strange behaviour with saveAll referring to hasOnes....
On Thu, Oct 7, 2010 at 4:12 PM, DerBjörn wrote: > Hi, > > i created a data array including 4 models: player, skillpool (hasOne), > strokepool (hasOne) and club (hasAndBelongsToMany): > > Array > ( > [Player] => Array > ( > [name] => John > ) > > [SkillPool] => Array > ( > [stamina] => 9.9878 > ) > > [StrokePool] => Array > ( > [stroke0_00] => 1.0626 > ) > > [Clubs] => Array > ( > [id] => 1 > ) > > ) > > To save now all together i use $this->Player->saveAll($this->data); > and it works perfectly. > > Now i would like to add more players at once and put everything in a > loop, so the data array looks like: > > Array > ( > [0] => Array > ( > [Player] => Array > ( > [name] => John > ) > > [SkillPool] => Array > ( > [stamina] => 9.6516 > ) > > [StrokePool] => Array > ( > [stroke0_00] => 3.9151 > ) > > [Clubs] => Array > ( > [id] => 1 > ) > ) > > [1] => Array( > ... > ) > ) > > Problem: The only datasets which get added now are Player and Club, > SkillPool and StrokePool (both hasOne with Player) get completely > ignored. Normally, when saving records in a loop, one should call $this->model->create(). I'm not sure that the failure of the associations to save is related but it's worth trying a $this->Player->create() before the saveAll(). Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Strange behaviour with saveAll referring to hasOnes....
Hi, i created a data array including 4 models: player, skillpool (hasOne), strokepool (hasOne) and club (hasAndBelongsToMany): Array ( [Player] => Array ( [name] => John ) [SkillPool] => Array ( [stamina] => 9.9878 ) [StrokePool] => Array ( [stroke0_00] => 1.0626 ) [Clubs] => Array ( [id] => 1 ) ) To save now all together i use $this->Player->saveAll($this->data); and it works perfectly. Now i would like to add more players at once and put everything in a loop, so the data array looks like: Array ( [0] => Array ( [Player] => Array ( [name] => John ) [SkillPool] => Array ( [stamina] => 9.6516 ) [StrokePool] => Array ( [stroke0_00] => 3.9151 ) [Clubs] => Array ( [id] => 1 ) ) [1] => Array( ... ) ) Problem: The only datasets which get added now are Player and Club, SkillPool and StrokePool (both hasOne with Player) get completely ignored. Can somebody explain me that? For me it doesn't make sense at all. For an explaination and of course a possible solution i would be very thankful :) THANKS! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Append a value to multiple records
Thanks a lot for your answer. I will do as you suggest: get the original field values, merge with the new ones and then updateAll. Just as a curiousity, right now I have made it work with some kind of SQL injection: Before calling updateAll I modify the form values and add the MySQL statement which will do the work. $fields[$column] = 'concat('.$column.', if('.$column.'=\'\', \'\',\', \') ,'.$value.')'; Shouldn't Cake prevent this from being executed? On Oct 5, 5:16 pm, cricket wrote: > I don't think there's getting around using a loop, aside from using > Set class, perhaps. Upon submission, do another find to get the > original values and concat them with the new data. > > One suggestion I have is to make this action append() rather than > edit() just so things remain clear. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Layout
Jeremy yes thats exactly what im trying to do but the link you send me only shows using the default layout for cakephp Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Validate input select
required=>true is never a solution in my option :) On 7 Okt., 19:57, and wrote: > I would also suggest to put > > 'required' => true > > in your validation, just to be sure! :-) > > On 7 Okt., 09:16, xamako wrote: > > > > > Hi, > > > I'm trying to validate a select field. > > > 'poblacion_id'=>array( > > 'rule' => 'notEmpty', > > 'message'=>"Debe seleccionar un valor."), > > > Is it possible to validate that the user has selected a value? > > > I'm use cake 1.3 > > > Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Authentication component
Thanks a lot. Got it working. Had to fix my login form fields as well to match my Auth->field() specified. On Oct 7, 5:49 pm, cricket wrote: > Auth hashes password fields automatically, so it's being hashed twice here. > > On Thu, Oct 7, 2010 at 12:31 PM, a17s wrote: > > I am trying to register and authenticate users using the Auth > > component in CakePHP but keep getting a failed login attempt even with > > the right credentials. Please see below my register and login function > > > var $components = array('Auth'); > > ... > > function register(){ > > if(!empty($this->data)){ > > $this->data['User']['password'] = > > $this->Auth->password($this- > >>data['User']['password']); > > $this->User->create($this->data); > > if($this->User->save($this->data)){ > > $this->Session->setFlash('Congratulations, > > your account has been > > successfully created. Password: '.$this->data['User'] > > ['password']); > > $this->redirect(array('controller'=>'users', > > 'action'=>'index')); > > } > > else{ > > //unable to save data > > $this->Session->setFlash(__('Unable to > > register user, please try > > again')); > > } > > } > > } > > > function login(){ > > > } > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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 > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: MySQL user privileges for CakePHP
it's enough to grant selects, updates, inserts. in general, read/write permission. but actually it depends on yoour application whether it saves data from outside or not. On 7 Okt., 04:31, rintaro wrote: > Hi CakePHP Groups, > I am planning on adjusting a MySQL user's privilege set to something > less than ALL, for use with CakePHP. What is the maximum set of MySQL > user privileges that CakePHP will ever need? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Validate input select
I would also suggest to put 'required' => true in your validation, just to be sure! :-) On 7 Okt., 09:16, xamako wrote: > Hi, > > I'm trying to validate a select field. > > 'poblacion_id'=>array( > 'rule' => 'notEmpty', > 'message'=>"Debe seleccionar un valor."), > > Is it possible to validate that the user has selected a value? > > I'm use cake 1.3 > > Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Authentication component
Auth hashes password fields automatically, so it's being hashed twice here. On Thu, Oct 7, 2010 at 12:31 PM, a17s wrote: > I am trying to register and authenticate users using the Auth > component in CakePHP but keep getting a failed login attempt even with > the right credentials. Please see below my register and login function > > var $components = array('Auth'); > ... > function register(){ > if(!empty($this->data)){ > $this->data['User']['password'] = > $this->Auth->password($this- >>data['User']['password']); > $this->User->create($this->data); > if($this->User->save($this->data)){ > $this->Session->setFlash('Congratulations, > your account has been > successfully created. Password: '.$this->data['User'] > ['password']); > $this->redirect(array('controller'=>'users', > 'action'=>'index')); > } > else{ > //unable to save data > $this->Session->setFlash(__('Unable to > register user, please try > again')); > } > } > } > > function login(){ > > } > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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 > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: How to keep Cake from trying to save certain form inputs ?
On Thu, Oct 7, 2010 at 1:57 AM, EJ wrote: > Thanks for your help cricket! > Something else might be going on as it seems to break unless I clear > those values out. Could it be that the values don't match the column definition? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
CakePHP Authentication component
I am trying to register and authenticate users using the Auth component in CakePHP but keep getting a failed login attempt even with the right credentials. Please see below my register and login function var $components = array('Auth'); ... function register(){ if(!empty($this->data)){ $this->data['User']['password'] = $this->Auth->password($this- >data['User']['password']); $this->User->create($this->data); if($this->User->save($this->data)){ $this->Session->setFlash('Congratulations, your account has been successfully created. Password: '.$this->data['User'] ['password']); $this->redirect(array('controller'=>'users', 'action'=>'index')); } else{ //unable to save data $this->Session->setFlash(__('Unable to register user, please try again')); } } } function login(){ } Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Validate input select
You also may want to validate the actual values as a user an easily change the values in the select and put any value they want. -Original Message- From: xamako [mailto:xam...@gmail.com] Sent: October-07-10 5:36 AM To: CakePHP Subject: Re: Validate input select Solved! The error was in the name of the field. Thanks! On 7 oct, 09:16, xamako wrote: > Hi, > > I'm trying to validate a select field. > > 'poblacion_id'=>array( > 'rule' => 'notEmpty', > 'message'=>"Debe seleccionar un valor."), > > Is it possible to validate that the user has selected a value? > > I'm use cake 1.3 > > Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: How to Manage Cake as Multilingual Portal? (Its challenge for me!)
http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial If you are going to support right to left languages you need to check for it in the layout and add right to left css that override RTL values when needed Use poedit and po files for different language layouts. For translating data use use L18n http://book.cakephp.org/view/162/Internationalizing-Your-Application http://book.cakephp.org/view/163/Localization-in-CakePHP Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
How to Manage Cake as Multilingual Portal? (Its challenge for me!)
Hi! How to Manage Cake as Multilingual Portal? requirements are as follows: * Configure Multiple Databases respect to languages. * Whole structure is same. * Each language portal will have admin site and front site. * Admin site users privileged to access. * Front site user as a Portal-user can easily visit different languages and stuffs after login. * Whole templates of portal are same but images and css are change respect to language (if necessary b/c images caption and css style rules ). Note: If you need further information please reply me. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
MySQL user privileges for CakePHP
Hi CakePHP Groups, I am planning on adjusting a MySQL user's privilege set to something less than ALL, for use with CakePHP. What is the maximum set of MySQL user privileges that CakePHP will ever need? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Big problems trying to use "medium" as a model name
(Oh, I guess that on CakePHP 1.2 the habtml-join-table didn't need an "id"... that's why it worked before.) On Thu, Oct 7, 2010 at 1:31 PM, Joshua Muheim wrote: > If somebody's interested: I found the problem... > > My authors_media table didn't have an "id" column! What a silly mistake... > > As already mentioned, the application I'm working on was created by > somebody else, and I'm not into CakePHP very deeply yet and didn't > work with PHP for a few years. So I've just taken over everything, and > didn't dig deep enough into the code etc. because I was frightened > already. > Now, a few weeks later now, I started again debugging it, and found > the problem quite fast. > > The warning: > > Undefined index: id [CORE/cake/libs/model/model.php, line > 1391] > > in __saveMulti() says exact that the "id" column in the db-table is > missing! But the problem before was that I upgraded CakePHP from 1.2.0 > to 1.3 where the word "Media" got a new inflection-rule (singular form > is now still Media, not Medium). So after solving this first problem > (by adding an inflection irregularity) I still thought that something > with the word is not OK, but in fact it was a completely different > problem then, as I see now. But I stuck too deep in these > uncertainties to get it a few weeks ago. > > Well, I'm happy and sort of proud that I figured this out now. I > definitely paid my apprentice's due for that... :-) > > Thanks anyway for your help, guys! > > On Mon, Sep 27, 2010 at 7:21 PM, cricket wrote: >> On Mon, Sep 27, 2010 at 3:16 AM, Joshua Muheim wrote: >>> I didn't change anything in the source, and it worked under v1.2.0.x, >>> and now it doesn't anymore. So I presume it's because of the upgrade >>> to v1.3.4, and I also found this: >>> >>> "Adding media as an uninflected word" on >>> https://trac.cakephp.org/changeset/5104 >>> >>> Anyone could try to bake a small application with a Medium/Media model >>> that has a HABTM relationship to an Author/Authors model? As far as I >>> can see this is NOT possible for some reason... And don't forget to >>> add the inflection rule: >>> >>> Inflector::rules('plural', array('rules' => array(), 'irregular' => >>> array('medium' => 'media'), 'uninflected' => array())); >> >> I'm not denying there may be a problem. In fact, I'm suggesting that >> there may be two. In your first message you said that you thought the >> issue with Medium had been resolved. I'm suggesting that the error msg >> about a missing id may have nothing whatsoever to do with the "Medium" >> issue. Have you investigated any further? What's happening at line >> 1391? Are you trying to create, or modify, in this instance? If the >> latter, does your form actually include an id in a hidden element? >> etc. etc. >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> 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 >> > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Big problems trying to use "medium" as a model name
If somebody's interested: I found the problem... My authors_media table didn't have an "id" column! What a silly mistake... As already mentioned, the application I'm working on was created by somebody else, and I'm not into CakePHP very deeply yet and didn't work with PHP for a few years. So I've just taken over everything, and didn't dig deep enough into the code etc. because I was frightened already. Now, a few weeks later now, I started again debugging it, and found the problem quite fast. The warning: Undefined index: id [CORE/cake/libs/model/model.php, line 1391] in __saveMulti() says exact that the "id" column in the db-table is missing! But the problem before was that I upgraded CakePHP from 1.2.0 to 1.3 where the word "Media" got a new inflection-rule (singular form is now still Media, not Medium). So after solving this first problem (by adding an inflection irregularity) I still thought that something with the word is not OK, but in fact it was a completely different problem then, as I see now. But I stuck too deep in these uncertainties to get it a few weeks ago. Well, I'm happy and sort of proud that I figured this out now. I definitely paid my apprentice's due for that... :-) Thanks anyway for your help, guys! On Mon, Sep 27, 2010 at 7:21 PM, cricket wrote: > On Mon, Sep 27, 2010 at 3:16 AM, Joshua Muheim wrote: >> I didn't change anything in the source, and it worked under v1.2.0.x, >> and now it doesn't anymore. So I presume it's because of the upgrade >> to v1.3.4, and I also found this: >> >> "Adding media as an uninflected word" on >> https://trac.cakephp.org/changeset/5104 >> >> Anyone could try to bake a small application with a Medium/Media model >> that has a HABTM relationship to an Author/Authors model? As far as I >> can see this is NOT possible for some reason... And don't forget to >> add the inflection rule: >> >> Inflector::rules('plural', array('rules' => array(), 'irregular' => >> array('medium' => 'media'), 'uninflected' => array())); > > I'm not denying there may be a problem. In fact, I'm suggesting that > there may be two. In your first message you said that you thought the > issue with Medium had been resolved. I'm suggesting that the error msg > about a missing id may have nothing whatsoever to do with the "Medium" > issue. Have you investigated any further? What's happening at line > 1391? Are you trying to create, or modify, in this instance? If the > latter, does your form actually include an id in a hidden element? > etc. etc. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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 > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Auth component variables
did you try 'allowedActions' => '*', 'allow' is the method. Marco On Oct 6, 2:31 am, Jeremy Burns wrote: > Looking at this page in the > guide:http://book.cakephp.org/view/1251/Setting-Auth-Component-Variables, > you'd think you could do this: > > var $components = array( > 'Auth' => array( > /.../ > 'allow' => '*', > /.../ > ) > ); > > ...but it seems this is ignored. You have to specify $this->Auth- > > >allow('*'); in beforeFilter(). > > Is this correct, or is it a bug? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Paypal integration
Dear, Please follow the URL http://arafats.info/archives/385 I think it will help a lot. If there is any problem to understand please let me know. On Thu, Oct 7, 2010 at 11:45 AM, cricket wrote: > google 'cakephp paypal'. There are several plugins, components, etc. > out there that handle PP's non-API IPN method. > > On Wed, Oct 6, 2010 at 5:17 AM, Warrior wrote: > > Hi Guys! > > > > I am integrating my site with paypal, as per requirement I am not > > suppose to use the api credentials for integrating paypal with > > website. > > is there any way to integrate paypal directly without api integration? > > > > Check out the new CakePHP Questions site http://cakeqs.org and help > others with their CakePHP related questions. > > > > 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.comFor > > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Thanks & regards. Yasir Arafat (Hasib) Software Engineer Epsilon Consulting and Development Services (ECDS) Contact Information: Cell : +8801816536901 Web: http://arafats.info Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Validate input select
Solved! The error was in the name of the field. Thanks! On 7 oct, 09:16, xamako wrote: > Hi, > > I'm trying to validate a select field. > > 'poblacion_id'=>array( > 'rule' => 'notEmpty', > 'message'=>"Debe seleccionar un valor."), > > Is it possible to validate that the user has selected a value? > > I'm use cake 1.3 > > Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
How to identify functions causing apache CPU usage
Hi all, I've got a number of apache processes using a lot of CPU on my VPS. I've used lsof -p to see which files are open but I presume because it's CakePHP and therefore uses a dispatcher the only open dir I'm seeing is /home/%sitename%/public_html/app/webroot Any other tips for tracing what is running so slowly? Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: SELECT ... FOR UPDATE
I don't understand why you are using a separated table for the invoices numbers, but anyway 1. Insert a new row to invoicenumbers. 2. get the last autoincrement value by calling $this->getLastInsertID() from the model. The next user will get a different id On Tue, Oct 5, 2010 at 2:40 AM, andres amaya diaz wrote: > Hi, hope you can help me with a SELECT .. FOR UPDATE problem. > > I have a web app that can be accessed by many users at the same time. > I have a table with a field wich has a counter on the next invoice > number. Lets call if invoicenumbers (this field cant be > auto_increment) > And then i have another table where i need to store the invoices data > Lets call it invoices > > So lets see: > A user enters Save Invoice, i need to do a SELECT or FIND to the > invoicenumbers to get the next invoice number and then an UPDATE to > invoicenumbers to set the field counter = counter+1. > But maybe between the select and the update another user Saves another > Invoice wich will do the same (SELECT and the UPDATE) and that is a > remote posibility that they both get the same Invoice Number and then > both UPDATE the table increasing the counter by 2. > > I hope i made myself clear. > > Thanks in advance ... aad > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Validate input select
Hi, I'm trying to validate a select field. 'poblacion_id'=>array( 'rule' => 'notEmpty', 'message'=>"Debe seleccionar un valor."), Is it possible to validate that the user has selected a value? I'm use cake 1.3 Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Fatal error: Out of memory - Even when there is no memory limit
i had faced it and it was more of while parsing large xml files to display our data..faced this same error...so it is something got to do with your controller consuming memory or hitting a roadblock where memory is being consumed.u need to debug to find out whereuse the memory code snippet to know the memory usage too while debugging On Oct 5, 8:28 pm, Fuitad wrote: > Hello, > > I'm in charge of transferring a live CakePHP application from one > server to another. I'm trying to get the new site to work but I'm > hitting a weird error and I just can't figure it out. > > When I try to load the main page, I get this: > > Fatal error: Out of memory (allocated 13631488) (tried to allocate > 8192 bytes) in /home/haakqsm/public_html/app/views/nodes/display.ctp > on line 1 > > The problem is, this error happens no matter what memory_limit is. For > example, it's set to -1 right now. > > php -i | grep memory > memory_limit-1 class="v">-1 > > Does anybody have any clue what could be the issue here? Both servers > (the live one and the new one) have the same php modules installed and > the same php.ini. > > > > Server Info: > > CentOS release 5.5 (Final) > Kernel Information: Linux 2.6.18-194.11.4.el5xen x86_64 > GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) > Copyright (C) 2005 Free Software Foundation, Inc. > > # php -v > PHP 5.2.14 (cgi) (built: Sep 30 2010 11:08:48) > Copyright (c) 1997-2010 The PHP Group > Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies > with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by > ionCube Ltd. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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