Thanks Dave an Dardo.
Just that was such a simple feature, that i was looking to find it
through scaffold, maybe in future releases???
But both of you are correct, i will follow your advise.

Once Again,
Thank You

On Jul 14, 2:19 pm, DaveMahon <[EMAIL PROTECTED]> wrote:
> I think you want to look in the manual under Developing with CakePHP >
> Models > Retrieving your Data > find.
>
> http://manual.cakephp.org/view/449/find
>
> Then look at Developing with CakePHP > Controllers > Controller
> Methods > Interacting with Views > set
>
> http://manual.cakephp.org/view/427/set
>
> You should never edit the actual Cake libraries unless you are
> developing CakePHP itself.
>
> On Jul 13, 6:51 pm, PaulMan <[EMAIL PROTECTED]> wrote:
>
> > Done.. where's how:
> > New version of: class Event extends AppModel
> > {
> >     var $name = 'Event';
> >         var $displayField= 'description';
> >         var $belongsTo=array('Pool','Result' => array(
> >             'className'    => 'Result',
> >                         'conditions' => 'Result.is_final=1'
> >         ));
>
> >  }
>
> > New Version of scaffold.php on line 311
> >         foreach ($this->ScaffoldModel->belongsTo as $assocName => 
> > $assocData)
> > {
> >                                 $varName = 
> > Inflector::variable(Inflector::pluralize(preg_replace('/
> > _id$/', '', $assocData['foreignKey'])));
> >                                 $this->controller->set($varName, 
> > $this->ScaffoldModel->{$assocName}->find('list',$assocData));
>
> >                         }
> >                         foreach ($this->ScaffoldModel->hasAndBelongsToMany 
> > as $assocName =>
> > $assocData) {
> >                                 $varName = 
> > Inflector::variable(Inflector::pluralize($assocName));
> >                                 $this->controller->set($varName, 
> > $this->ScaffoldModel->{$assocName}->find('list',$assocData));
>
> >                         }
>
> > this way i can use params defined on var $belongsTo or
> > hasAndBelongsToMany ...
>
> > now the problem is... is this going to "f***" all the rest or is a
> > good hack?
>
> > On 13 Jul, 17:28, PaulMan <[EMAIL PROTECTED]> wrr ote:
>
> > > thank's for the quick reply,
> > > i already had read that articles, but i did no found the solution, the
> > > problem is on the "Edit" action for events, that's where i want to
> > > filter results, so that the final user can select a restrict options
> > > of results.
> > > Or maybe the solution is there and i'm too "newbie" blind to see, ???
> > > if this is true  please , sorry.
>
> > > lets put in another way:
> > > take a look at the debug query bellow , at Nr 8 i would like to have
> > > 8       SELECT `Result`.`id`, `Result`.`description` FROM `results` AS
> > > `Result` WHERE Result.is_active = 1             7       7       0
>
> > > so this way on the edit action , Results select box will be only
> > > populated with Results that are active, not all of them.
>
> > > since i'm with scaffold , is this possible?
>
> > > Nr      Query   Error   Affected        Num. rows       Took (ms)
> > > 1       DESCRIBE `events`               8       8       2
> > > 2       DESCRIBE `pools`                10      10      2
> > > 3       DESCRIBE `results`              6       6       2
> > > 4       DESCRIBE `bets`         6       6       2
> > > 5       DESCRIBE `users`                10      10      2
> > > 6       SELECT COUNT(*) AS `count` FROM `events` AS `Event` WHERE
> > > `Event`.`id` = 1                1       1       1
> > > 7       SELECT `Event`.`id`, `Event`.`pool_id`, `Event`.`result_id`,
> > > `Event`.`description`, `Event`.`comment`, `Event`.`date`,
> > > `Event`.`created`, `Event`.`modified`, `Result`.`id`,
> > > `Result`.`is_final`, `Result`.`description`, `Result`.`value`,
> > > `Result`.`created`, `Result`.`modified`, `Pool`.`id`,
> > > `Pool`.`description`, `Pool`.`comment`, `Pool`.`number`, `Pool`.`open
> > > date`, `Pool`.`close date`, `Pool`.`active`, `Pool`.`season`,
> > > `Pool`.`created`, `Pool`.`modified` FROM `events` AS `Event` LEFT JOIN
> > > `results` AS `Result` ON (`Result`.`is_final`=1 AND
> > > `Event`.`result_id` = `Result`.`id`) LEFT JOIN `pools` AS `Pool` ON
> > > (`Event`.`pool_id` = `Pool`.`id`) WHERE `Event`.`id` = 1 LIMIT 1          
> > >       1       1
> > > 1
> > > 8       SELECT `Result`.`id`, `Result`.`description` FROM `results` AS
> > > `Result` WHERE 1 = 1            7       7       0
> > > 9       SELECT `Pool`.`id`, `Pool`.`description` FROM `pools` AS `Pool`
> > > WHERE 1 = 1
>
> > > On 13 Jul, 16:36, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > > > Perhaps you should start reading 
> > > > here:http://book.cakephp.org/view/78/associations-linking-models-toandget
> > > > a grasp of models relations and how to specify conditions. Then you
> > > > can use bakehttp://book.cakephp.org/view/113/code-generation-with-bake
> > > > to materialize the scaffold code and start coding the application
> > > > logic
>
> > > > On Sun, Jul 13, 2008 at 12:18 PM, PaulMan <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello Everyone,
> > > > > Using Scaffold,
> > > > > I Have a Model "Event" that belongsTo Result.
> > > > > The Problem is when i edit an Event How can i filter Results so that
> > > > > only rows ( Records ) with a especific condition, like
> > > > > Result.is_final=1, are available for select.
>
> > > > > class EventsController extends AppController {
> > > > > var $name = 'Events';
> > > > > var $components=array("auth");
> > > > >  var $scaffold;
> > > > > }
>
> > > > > class Event extends AppModel
> > > > > {
> > > > >    var $name = 'Event';
> > > > >        var $displayField= 'description';
> > > > >        var $belongsTo=array('Pool','Result' => array(
> > > > >            'className'    => 'Result',
> > > > >            'foreignKey'    => 'result_id'
> > > > >        ));
>
> > > > >  }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to