1.2: isUnique - beforeValidate only on add, not on edit?
I found the cool new model::isUnique. It works great with beforeValidate (as the example gave) but I can't get it to do anything when I update a record. Setting it to beforeSave doesn't help either. What I sort of patched is: if ( ! $this->Person->isUnique(array('name'=>$this->data['Person'] ['name']))) { etc. etc. That works good in that I can trap the duplicate error ... but Cake doesn't seem to know about that so no error message is set in the form. Now I've been trying to walk the whole trree of model and helpers to ($this->Person->validationErrors..., $this->Form->error... etc.) but for the life of it, that error message stays hidden, lol. Where does my logic go wrong?! :( --~--~-~--~~~---~--~~ 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: generateList for unused items only?
Yes! That works! Sometimes I'm trying to think in a cake way and think there is a function or method somewhere, lol On Feb 24, 5:52 pm, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > If you have Number -> belongsTo -> Person, have you tried: > > $this->Number->generateList(array('Number.person_id'=>null)); > > Can you set your DEBUG to 2 and dump the SQL generated by the above query? > > -MI > > --- > > Remember, smart coders answer ten questions for every question they ask. > So be smart, be cool, and share your knowledge. > > BAKE ON! > > blog:http://www.MarianoIglesias.com.ar > > -Mensaje original- > De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre > deCynthia > Enviado el: Sábado, 24 de Febrero de 2007 07:44 p.m. > Para: Cake PHP > Asunto: generateList for unused items only? > > Now I get *all* telephone numbers of course. I only want to list the > ones which aren't assigned yet. Feeding it additional conditions > doesn't work because it only looks inside the Numbers table... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
generateList for unused items only?
*sight* this framework is great but makes me feel very blonde :) I have: numbers BELONGS TO persons In the Add Person I have $this->Person->Number->generateList(); Now I get *all* telephone numbers of course. I only want to list the ones which aren't assigned yet. Feeding it additional conditions doesn't work because it only looks inside the Numbers table... Is there a way to get this done or do I have to go with HABTM to get this? --~--~-~--~~~---~--~~ 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: $html->link : add a class or style?
Argh... strike that guys... NEVER change code at place A and do a view source of place B. Never. On Feb 23, 11:24 pm, "Cynthia" <[EMAIL PROTECTED]> wrote: > (Using 1.2) > > >From digging around in the API and looking over the function link and > > the function _parseAttributes there seems to be no way to add a class > or an inline style to a link? > > Any other way to accomplish this the Cake way? --~--~-~--~~~---~--~~ 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: 1.2 Pagination forgetting conditions?
I like using the session to carry over some parameters paginate would otherwise forget about :) On Feb 23, 7:27 pm, "NOSLOW" <[EMAIL PROTECTED]> wrote: > I found that if you have other params set (field sort, direction, > order), then you need to also unset those as well: > > unset($this->params['pass']['page']); > unset($this->params['pass']['sort']); > unset($this->params['pass']['direction']); > unset($this->params['pass']['order']); > > Other wise you can't page and retain the same sort order. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$html->link : add a class or style?
(Using 1.2) >From digging around in the API and looking over the function link and the function _parseAttributes there seems to be no way to add a class or an inline style to a link? Any other way to accomplish this the Cake way? --~--~-~--~~~---~--~~ 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: pagination issue in 1.2
Have you tried another nightly build? Try getting this to work in a completely clean view. There has go to be something else intefering. On Feb 22, 12:54 pm, "isk" <[EMAIL PROTECTED]> wrote: > CAN ANYBODY HELP? --~--~-~--~~~---~--~~ 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: 1.2: Can I use new validation class in a component?
Looking at the new test file I think I have it. On top: uses('Validation'); then before use: $Validation = new Validation(); Then it works :-) On Feb 21, 6:07 pm, "Cynthia" <[EMAIL PROTECTED]> wrote: > Hi Nate :-) > > After just having learned about using the Inflector statically I hoped > that this would do the trick ... but when I call Validation from my > component this way I get: > > "Fatal error: Call to undefined function: __reset()" > > :( > > On Feb 21, 3:43 pm, "nate" <[EMAIL PROTECTED]> wrote: > > > For the most part, the methods of the Validation class can be accessed > > statically, i.e. to validate a date, you can just do > > Validation::date($date). There's also an optional $format parameter > > which defaults to 'ymd'. > > > On Feb 21, 2:09 pm, "Cynthia" <[EMAIL PROTECTED]> wrote: > > > > I'm writing a component which a bunch of controllers can use to always > > > do the same job: take some dates or date range information and return > > > some conditions. > > > > I thought it would be cute to have the component also check if those > > > entered dates are in the right format and are valid. But for the life > > > of me, I can't seem to get to the validation thing. > > > > I tried $uses, $helper, $component. Most of the time there is no > > > error ... but then maybe I don't know the "path" to get to it? > > > > $this->MyComponent->Validation->validate ... or > > > > $this->MyComponent->OriginalController->Validation > > > > For the moment I'll just C&P the date checking method ... but would be > > > nice to learn how to do this the right way :) --~--~-~--~~~---~--~~ 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: pagination issue in 1.2
Try it with: var $paginate = array( 'limit' => 2); I don't set any page value and it works *great* for me :) On Feb 21, 3:34 pm, "isk" <[EMAIL PROTECTED]> wrote: > thanks Preloader, I saw your trick in the groups - but it does not > work for me (I use > 1.2.0.4451alpha), parameters stay repeated even I do unset($this- > > >params['pass']['page']) in the view before all paginator calls. > > when I add filtering parameters by array('url' => $this->params['pass']) my > links does not work at all - they repeat all > > parameters twice (like page:1page:1.. and so on), so links become > twice longer :) > > but when I do your trick in the view - it makes links working (though > they are ugly) > > 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: 1.2: Can I use new validation class in a component?
Hi Nate :-) After just having learned about using the Inflector statically I hoped that this would do the trick ... but when I call Validation from my component this way I get: "Fatal error: Call to undefined function: __reset()" :( On Feb 21, 3:43 pm, "nate" <[EMAIL PROTECTED]> wrote: > For the most part, the methods of the Validation class can be accessed > statically, i.e. to validate a date, you can just do > Validation::date($date). There's also an optional $format parameter > which defaults to 'ymd'. > > On Feb 21, 2:09 pm, "Cynthia" <[EMAIL PROTECTED]> wrote: > > > I'm writing a component which a bunch of controllers can use to always > > do the same job: take some dates or date range information and return > > some conditions. > > > I thought it would be cute to have the component also check if those > > entered dates are in the right format and are valid. But for the life > > of me, I can't seem to get to the validation thing. > > > I tried $uses, $helper, $component. Most of the time there is no > > error ... but then maybe I don't know the "path" to get to it? > > > $this->MyComponent->Validation->validate ... or > > > $this->MyComponent->OriginalController->Validation > > > For the moment I'll just C&P the date checking method ... but would be > > nice to learn how to do this the right way :) --~--~-~--~~~---~--~~ 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: Populate select field from a db?
If those tables and your models are properly related you can do something like this: $one = $this->Whatever->Oneofyourtable->generateList(); $two = $this->Whatever->Othertable->generateList(); $this->set(compact('one', 'two')); On Feb 21, 4:38 pm, "MickeU" <[EMAIL PROTECTED]> wrote: > Hi there, my first post here, and also new to cakephp, so bear with > me. > > In my app that i´m trying to build i´m using two separate tables for > populating two select fields in a register form. Is there a simple way > using form helpers to accomplish this? --~--~-~--~~~---~--~~ 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: 1.2: pagination related data in scaffolding-type baked views
Thanks for the reply! 1. I have a Topics table with its own unique ID. There is a Bugs table with its own ID and the associative topic_id in it. (The bugs table will have children later on but until I get my head around Cake I'm trying to work with just these two tables). 2. In the Topics model I have $hasMany = array('Bugs') and in the Bugs model I have $belongsTo = array('Topics'); Every topic ("Admission Form", "Word Export", etc.) can have many Bugs/ issues... this is why I've set it up like this. 3. I thought bake basically does the CRUD screens, nothing much more. I'll try to do what you suggest. I had modified the View Topic code to read: $data = $this->Topic->find($conditions); $this->set('topic', $data ); I guess what I can try to do is something like: $this->set('topic', $this->paginate( $conditions )); Still that puzzles me. If I would have 2 other related tables, how can I make sure each table shows no more than 10 rows and each table can paginate by itself... Back to coding :-) On Feb 18, 7:41 am, "mindcharger" <[EMAIL PROTECTED]> wrote: > Hello, > > I see many possible problem sources here: > > 1) Database structure: how are you associating the topics and issues o > the DB? > 2) Cake Model Association: how are you telling Cake to fetch the > results? Does each issue "belongsTo" one topic? > 3) Bake.php: while bake.php is an amazing tool, you should always look > critical to it...here's a fine example, you used bake.php and the > results doesn't match what you were expecting...this is recurrent in > code generation tools...remember: Bake.php is not the cure of all > evil!! :-) > > You should definitely try to code that topic/issue by hand (don't use > bake.php) if you are unable to solve the problem by changing DB > structure and Cake Association Model. > > Try to work these points, if nothing exchanges post here the DB > structure and the Model code and we will try to figure it out! > > Good luck > > On Feb 17, 6:41 pm, "Cynthia" <[EMAIL PROTECTED]> wrote: > > > I have a list of topics and each topics hasMany issues. After > > scaffolding I have used bake.php to create the MVC's. > > > When I view the issues they paginate. > > When I view the topics they paginate. > > > But when I view a single issue, I get this *huge* list of issues on > > the page. > > > I've found one mention herehttp://tinyurl.com/2kxzmain"Pagination > > for hasMany association" but adding var $paginate = array('limit' => > > 10) to both the topics and issues controllers only makes them paginate > > correctly in their own individual view. The related info still comes > > up as just one huge list. > > > I looked athttp://bakery.cakephp.org/articles/view/65andthe more > > extendedhttp://www.noswad.me.uk/Paginationbutboth seem to deal with > > two sets of data displayed in one and the same view (i.e.: on each > > line you have a product, category, etc.). > > > Any help, link or a push in the right direct would be so helpful. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
1.2: pagination related data in scaffolding-type baked views
I have a list of topics and each topics hasMany issues. After scaffolding I have used bake.php to create the MVC's. When I view the issues they paginate. When I view the topics they paginate. But when I view a single issue, I get this *huge* list of issues on the page. I've found one mention here http://tinyurl.com/2kxzma in "Pagination for hasMany association" but adding var $paginate = array('limit' => 10) to both the topics and issues controllers only makes them paginate correctly in their own individual view. The related info still comes up as just one huge list. I looked at http://bakery.cakephp.org/articles/view/65 and the more extended http://www.noswad.me.uk/Pagination but both seem to deal with two sets of data displayed in one and the same view (i.e.: on each line you have a product, category, etc.). Any help, link or a push in the right direct would be so helpful. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---