Re: Working with INNER JOIN tables

2008-02-23 Thread nate

See this thread:

http://groups.google.com/group/cake-php/browse_thread/thread/e9ca8f1e6fafb2af/f5233316033bc8b8

On Feb 23, 10:00 pm, takabanana <[EMAIL PROTECTED]> wrote:
> Bueller?  :-)  Can anyone help, or point me in the right direction?
> Thanks!
>
> -taka
>
> On Feb 22, 1:06 am, takabanana <[EMAIL PROTECTED]> wrote:
>
> > How does CakePHP handle (or "With CakePHP, how do you do...") INSERT,
> > UPDATE, and DELETE across multiple tables with an INNER JOIN query?
>
> > sorry - still very very new to CakePHP.  Looking for books/tutorials
> > in working with INNER JOIN table queries since my projects use those a
> > TON.
>
> > Thanks for any help/pointers!
>
> > -taka
--~--~-~--~~~---~--~~
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: Two things I have not seen support for in Cake (group by and inner join)

2008-02-23 Thread nate

Gimmie a couple days, I'll fix it.

A test case or something would be nice though. ;-)

On Feb 22, 6:47 pm, rtconner <[EMAIL PROTECTED]> wrote:
> ya, but if that type option is supposed to work
>
> .. blah ... should continue this in trac?https://trac.cakephp.org/ticket/4085
>
> On Feb 22, 3:51 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > Didn't I just post an alternative?
>
> > On Fri, Feb 22, 2008 at 2:33 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > I can't get array('type' => 'INNER') to work wither.
>
> > > On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > > Maybe the core developers can reveal this mystery about type => 'INNER'
>
> > > > I haven't seen this documented any where.
>
> > > > And as you can see in the first link sent, I didn't work for me...and
> > > > there's no response. What did work, is a pseudoINNERjoin, which get's
> > > the
> > > > job done:
>
> > > >http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> > > > (funny, there are like 6 more responses to this that I can see in my
> > > email,
> > > > but not in the group)
>
> > > > Basically, you do a dummy hasOne bind and in your find do a condition:
> > > > "Where Dummy.id IS NOT NULL"...
>
> > > > On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > Re: GROUP BY,
> > > > > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > > > > primary key to prevent duplicates. I can try to find a query example
> > > > > if you really have never come across this. It's pretty common. I have
> > > > > some hacks to do this, but if cake really supported grouping, I would
> > > > > not be hacking anything.
>
> > > > > Also,
> > > > > I saw thatINNERJOINin the translation behavior. I tried to play
> > > > > with that, but never got anything to work. That code is not a
> > > > > relationship definition (as nate revealed will work in that posting)
> > > > > but it is a query in array format. Normal cake usage does not have any
> > > > > place where you build things like that.
>
> > > > > Anyways...
> > > > > Really thanks for the links. Very helpful to know.
>
> > > > > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Re:INNER
>
> > >JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
>
> > > > > > I believe the TranslateBehavior uses anINNERJOINif you're looking
> > > > > > for an example on how to dynamically change the binding although I
> > > > > > haven't actually used this myself yet
> > > > > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
>
> > > > > > For GROUP BY I believe the norm is to use the conditions to pass in
> > > > > > your group by clause
>
> > > .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
>
> > > > > > When has this not proved sufficient? Do you have a specific example?
>
> > > > > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I have no found a good way to do GROUP BY queries orINNERJOIN's
> > > in
> > > > > > > cake.
> > > > > > > Was wondering if any of you have come across these and how you
> > > handled
> > > > > > > them. I have not been able to do either of them in conjunction
> > > with
> > > > > > > the find() method in any normal way.Perhaps I am missing
> > > something?
> > > > > > > I'd love to find out if I am. Are these some sort of database
> > > specific
> > > > > > > constructs?
>
> > > > > > > With Group by, sometimes I can get away with appending
> > > $conditions[] =
> > > > > > > 'GROUP BY field'; annd the in addition to that, manually passing
> > > in
> > > > > > > the fields to find() and prepending DISTINCT to the id column.
>
> > > > > > >InnerJoinI have seen zero support from in Cake. Any time I've
> > > wanted
> > > > > > > toInnerjoinI've had to write the query manually. You know,
> > > > > > > sometimes you just need to filter your queries based on two
> > > tables,
> > > > > > > not just your primary table.
>
> > > > > > > Any help on these issues would be greatly appreaciated. I know I
> > > am
> > > > > > > not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
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: General HABTM question

2008-02-23 Thread jim starboard

thanks guv'ner

On Feb 23, 10:48 pm, rtconner <[EMAIL PROTECTED]> wrote:
> You got it right.
--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread Corie

I built a quick test with HABTM and got it to work.

groups_controller.php

class GroupsController extends AppController {

var $name = 'Groups';
var $helpers = array('Html', 'Form');

function index() {
$this->Group->recursive = 1;
pr($this->Group->findAll());
}

}

users_controller.php

class UsersController extends AppController {

var $name = 'Users';
var $helpers = array('Html', 'Form');

function index() {
$this->User->recursive = 1;
pr($this->User->findAll());
}

}

Model: group.php

class Group extends AppModel {
var $name = 'Group';
var $useTable = 'groups';

var $hasAndBelongsToMany = array(
'User' => array(
'className' => 'User'
)
);
}

Model: user.php

class User extends AppModel {
var $name = 'User';
var $useTable = 'users';

var $hasAndBelongsToMany = array(
'Group' => array(
'className' => 'Group'
)
);
}

Here's the print out from the users controller with associated groups
data.

Array
(
[0] => Array
(
[User] => Array
(
[id] => 1
[name] => bob
)

[Group] => Array
(
[0] => Array
(
[id] => 1
[name] => admins
)
)
)

[1] => Array
(
[User] => Array
(
[id] => 3
[name] => hank
)

[Group] => Array
(
[0] => Array
(
[id] => 3
[name] => janitors
)
)
)

[2] => Array
(
[User] => Array
(
[id] => 2
[name] => john
)

[Group] => Array
(
[0] => Array
(
[id] => 2
[name] => editors
)

[1] => Array
(
[id] => 3
[name] => janitors
)
)
)
)


On Feb 23, 9:13 pm, villas <[EMAIL PROTECTED]> wrote:
> Thanks b logica.  I already tried recursive = 1,2,3 etc,  but that
> didn't work.
>
> Thanks also for the bindable-behaviour example and I will try it in
> the morning.
> However,  I'm already using work-around solutions.
> My point is that Cake's own HABTM model just doesn't seem to work for
> the simplest of cases.
>
> If anyone has a true HABTM model working,  I would still be happy to
> hear it.
>
> On Feb 23, 10:36 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > On Sat, Feb 23, 2008 at 4:46 PM, villas <[EMAIL PROTECTED]> wrote:
>
> > >  Thanks for the idea.  My set up is so simple that I can try anything
> > >  in seconds :)
>
> > Try:
> > $recursive = 2;
> > $this->User->find('[all|first|list]', $conditions, $fields, $recursive);
>
> > >  I commented out the key lines as you suggested and it just worked as
> > >  before,  it returned the [user] data but not the [group].  In other
> > >  words, no change.
>
> > >  I've been playing with this on and off since November and it has not
> > >  worked yet!  If someone could post here the simplest working example,
> > >  I would be grateful.  Until then,  I'm sceptical that anyone actually
> > >  uses HABTM.  I can just imagine that everyone has given it a try and
> > >  then just found ways to work around the problem!
>
> > Try using the Bindable behavior. Comment out the binding params in
> > your models, leaving:
>
> > var $hasAndBelongsToMany = 'Group';
> > var $hasAndBelongsToMany = 'User';
>
> > class AppModel extends Model{
> > var $actsAs = array('Bindable' => array('notices' => true));
> > ...
>
> > }
>
> > UsersController:
>
> > $criteria = array(
> > 'conditions' => array('User.name' => 'foo'),
> > 'restrict' => array(
> > 'Group(id,name)'
> > )
> > );
> > $this->set('users', $this->User->find('all', $criteria, null, null));
>
> > Here's a working example. This controller action is for a member
> > directory. An alphabetical list of links is provided, each passing its
> > letter. A list of members, with associated data, is returned.
>
> > function findByLetter()
> > {
> > $letter = $this->params['letter'];
> > $conditions = array(
> > 'conditions' => "LOWER(SUBSTRING(last_name, 1, 1)) = 
> > '${letter}'",
> > 'restrict' => array(
> >   

Re: CakePHP v1.2 stable enough for production?

2008-02-23 Thread rtconner

I am a long time user of 1.2... let me say.. It changes so often, and
there are so many bugs that sometimes 1.2 is a real pain. The bugs
don't cause things not to be secure though.. they are just things that
flat out don't work that you think are supposed to work.

But on the other side...
The bugs are starting to slow down, and 1.2 is just head and shoulders
and chest and waist above 1.1 in terms of features. 1.1 does not even
look like a framework almost when compared.

So ... yeah..
--~--~-~--~~~---~--~~
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: General HABTM question

2008-02-23 Thread rtconner

You got it right.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



General HABTM question

2008-02-23 Thread jim starboard


Despite the naming convention, isn't the HABTM association really just
modeling the shared foreign key table relationship? For example, you
have a 'users' table and an 'items' table, and they are tied together
with the items_users table. Not considering cake, you would use this
because several users could have the same item, or no items, or
multiple items.

Am I missing something?
--~--~-~--~~~---~--~~
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: Problems creating records Cake 1.2 on postgres

2008-02-23 Thread Bruce

Since the last message, I have created a new table, model, controller
and views from scratch with new names and the same structure - the
problem still exists.

Table name is job_actions, with a serial field called 'id' (was called
'job_histories' last time).
Sequence name (created by postgres) is 'job_actions_id_seq'.
Model is just the bare bones and is called 'job_action.php'.
Controller and views were built with bake. Controller name is
'job_actions.php'.

All DB ownership seems to be in order with the user defined in cake
owning the table and the sequence.

As you say, it looks like it is not reading the names of the sequence
correctly somewhere along the line.

--~--~-~--~~~---~--~~
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: Working with INNER JOIN tables

2008-02-23 Thread takabanana

Bueller?  :-)  Can anyone help, or point me in the right direction?
Thanks!

-taka

On Feb 22, 1:06 am, takabanana <[EMAIL PROTECTED]> wrote:
> How does CakePHP handle (or "With CakePHP, how do you do...") INSERT,
> UPDATE, and DELETE across multiple tables with an INNER JOIN query?
>
> sorry - still very very new to CakePHP.  Looking for books/tutorials
> in working with INNER JOIN table queries since my projects use those a
> TON.
>
> Thanks for any help/pointers!
>
> -taka
--~--~-~--~~~---~--~~
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: where is data from AJAX POST?

2008-02-23 Thread Dardo Sordi Bogado

Didn't try it, but I think it's in $this->params['form'], anyway they
also should be in $_POST.

On 2/23/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  I'd like to be able to POST some data periodically using jQuery ajax
>  calls. The URL contains an ID that is parsed out in the route, so the
>  controller should receive a value for $this->params['id'].
>
>  But how do I grab the values for the data I've POSTed? I thought it
>  would be in $this->data or might be in $this->RequestHandler->params[]
>  but that seems not to be the case. Because this is ALAX i'm finding it
>  difficult to debug this.
>
>  Note that I'm not using Cake's AJAX form creation or anything like
>  that. I don't see how that would fit with what I'm trying to do. This
>  isn't for submitting the entire form or saving the model, but for
>  making incremental saves of data in a textarea (TinyMCE). Think CMS.
>  >
>

--~--~-~--~~~---~--~~
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: CakePHP v1.2 stable enough for production?

2008-02-23 Thread Dardo Sordi Bogado

Yes, 1.2 really rocks!

On 2/23/08, Pablo Viojo <[EMAIL PROTECTED]> wrote:
> I think this has been asked, and answered, too many times ;) [1]...Just use
> it!
>
> Regards,
>
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]
> http://pviojo.net
>
>
> [1]
> http://groups.google.com/group/cake-php/search?group=cake-php&q=1.2+production&qt_g=Search+this+group
>
>
> On Sat, Feb 23, 2008 at 5:42 PM, Greg Baker <[EMAIL PROTECTED]>
> wrote:
> >
> > I know its beta..  But I'm wondering if people are using 1.2 in
> > production environments?
> >
> >
>
>
>
>
>  >
>

--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread villas

Thanks b logica.  I already tried recursive = 1,2,3 etc,  but that
didn't work.

Thanks also for the bindable-behaviour example and I will try it in
the morning.
However,  I'm already using work-around solutions.
My point is that Cake's own HABTM model just doesn't seem to work for
the simplest of cases.

If anyone has a true HABTM model working,  I would still be happy to
hear it.


On Feb 23, 10:36 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> On Sat, Feb 23, 2008 at 4:46 PM, villas <[EMAIL PROTECTED]> wrote:
>
> >  Thanks for the idea.  My set up is so simple that I can try anything
> >  in seconds :)
>
> Try:
> $recursive = 2;
> $this->User->find('[all|first|list]', $conditions, $fields, $recursive);
>
> >  I commented out the key lines as you suggested and it just worked as
> >  before,  it returned the [user] data but not the [group].  In other
> >  words, no change.
>
> >  I've been playing with this on and off since November and it has not
> >  worked yet!  If someone could post here the simplest working example,
> >  I would be grateful.  Until then,  I'm sceptical that anyone actually
> >  uses HABTM.  I can just imagine that everyone has given it a try and
> >  then just found ways to work around the problem!
>
> Try using the Bindable behavior. Comment out the binding params in
> your models, leaving:
>
> var $hasAndBelongsToMany = 'Group';
> var $hasAndBelongsToMany = 'User';
>
> class AppModel extends Model{
> var $actsAs = array('Bindable' => array('notices' => true));
> ...
>
> }
>
> UsersController:
>
> $criteria = array(
> 'conditions' => array('User.name' => 'foo'),
> 'restrict' => array(
> 'Group(id,name)'
> )
> );
> $this->set('users', $this->User->find('all', $criteria, null, null));
>
> Here's a working example. This controller action is for a member
> directory. An alphabetical list of links is provided, each passing its
> letter. A list of members, with associated data, is returned.
>
> function findByLetter()
> {
> $letter = $this->params['letter'];
> $conditions = array(
> 'conditions' => "LOWER(SUBSTRING(last_name, 1, 1)) = 
> '${letter}'",
> 'restrict' => array(
> 'MemberProfile(organisation)',
> 'Discipline(id,name_en,slug_en)'
> )
> );
>
> $this->Member->order = 'Member.last_name ASC';
>
> $this->set('letter', $letter);
> $this->set('members', $this->Member->find('all', $conditions, null, 
> null));
>
> $this->Session->write('directory_search_url', "/members/${letter}");
> $this->render('list');
>
> }
>
> Array
> (
> [Member] => Array
> (
> [id] => 802
> [created] => 2006-08-29 13:40:32
> [modified] => 2008-01-21 18:38:54
> [enabled] => t
> [member_type_id] => 3
> [first_name] => 
> [last_name] => 
> [slug] => _
> [full_name] =>  
> )
>
> [MemberProfile] => Array
> (
> [organisation] => 
> [id] => 528
> )
>
> [Discipline] => Array
> (
> [0] => Array
> (
> [id] => 1
> [name_en] => Writing
> [slug_en] => Writing
> )
>
> [1] => Array
> (
> [id] => 2
> [name_en] => Visual Arts
> [slug_name_en] => Visual_Arts
> )
> )
> )
--~--~-~--~~~---~--~~
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: Data Validation with Multiple Rules Doesn't Display Multiple Errors

2008-02-23 Thread Siebren Bakker
As far as I know, since CakePHP runs through the validation rules in
sequence, it has a catchall, where validation will fail if *ANY* of the
rules for a specific field fails, and immediately stops trying to validate
that field. What this means, is that only the first failed rule for a field
will display it's message. Now, if anyone knows a way around this, I'd love
to hear about it.

On Sat, Feb 23, 2008 at 4:23 PM, BlenderStyle <[EMAIL PROTECTED]>
wrote:

>
> I'm using CakePHP 1.2.0.6311. I'm having an issue when using multiple
> validation rules per field (thanks to http://book.cakephp.org for the
> help) where only the first failed rule is displayed in the view.
> Example:
>
> CustomModel:
> var $validate = array(
>  'my_field' => array(
>'minlength' => array(
>  'rule' => array('minLength', 4),
>  'message' => 'Must Be at Least 4 Characters Long'
>),
>'alphanumeric' => array(
>  'rule' => 'alphaNumeric',
>  'message' => 'Must Only Contain Alphanumeric Characters'
>  );
>
> CustomsController:
> function testValidate() {
>  if(!empty($this->data)) {
>$this->User->set($this->data);
>$this->User->validates();
>  }
> }
>
> test_validate.ctp:
> echo $form->create('Custom', array('controller' => 'customs', 'action'
> => 'testValidate'));
> echo $form->input('my_field');
> echo $form->create('submit');
>
> If both the minlength and alphanumeric rules fail, only the
> minlength's message is displayed. However, the validation works with
> one or the other.
>
> So, my first question is, am I doing something wrong or is this not a
> feature of CakePHP 1.2.0.6311? Last question is - and this may be
> stupid - but how does the model pass the message to the view?
> >
>


-- 
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

--~--~-~--~~~---~--~~
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: filling an array for a selectbox (v1.2)

2008-02-23 Thread b logica

Anyway ...

Say you have a table, 'regions', with columns 'id' & 'name':

$this->set('regions', $this->Region->find('list'));

Or, if this is an associated model:

$this->set('regions', $this->Country->Region->find('list'));

View:

select('Country.region', $regions, null, array(), true) ?>

Use different column name:

$this->Country->Region->displayField = 'name_en';
$this->set('regions', $this->Country->Region->find('list'));

On Sat, Feb 23, 2008 at 6:52 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> On Sat, Feb 23, 2008 at 2:59 PM, Ronald <[EMAIL PROTECTED]> wrote:
>  >
>  >  It's probably something simple, but I'm trying to figure this out for
>  >  a few hours now and I just can't get it right.
>  >
>  >  I'm building a component and one function needs to return an array I
>  >  can use to fill a selectbox.
>  >  This return array needs to be filled from an array of objects,.
>  >
>  >  This is my loop to walk trough the array of objects.
>  >  ---
>  >  for($i = 0; $i < count($issuerArray); $i++)
>  >  {
>  > //$issuerArray[$i]->issuerID   <- this needs to be the id 
> of
>  >  every option
>  > //$issuerArray[$i]->issuerName; <- this needs to be the value 
> of
>  >  every option
>  >  }
>  >  ---
>  >  My question is how to get these values into a array (the return array)
>  >  in such a way that I can use it to fill an selectbox.
>  >  I tried several things but I allways end up with a selectbox with all
>  >  kind of strange values in it.
>  >
>  >  >  >
>  >
>

--~--~-~--~~~---~--~~
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: filling an array for a selectbox (v1.2)

2008-02-23 Thread b logica

On Sat, Feb 23, 2008 at 2:59 PM, Ronald <[EMAIL PROTECTED]> wrote:
>
>  It's probably something simple, but I'm trying to figure this out for
>  a few hours now and I just can't get it right.
>
>  I'm building a component and one function needs to return an array I
>  can use to fill a selectbox.
>  This return array needs to be filled from an array of objects,.
>
>  This is my loop to walk trough the array of objects.
>  ---
>  for($i = 0; $i < count($issuerArray); $i++)
>  {
> //$issuerArray[$i]->issuerID   <- this needs to be the id of
>  every option
> //$issuerArray[$i]->issuerName; <- this needs to be the value of
>  every option
>  }
>  ---
>  My question is how to get these values into a array (the return array)
>  in such a way that I can use it to fill an selectbox.
>  I tried several things but I allways end up with a selectbox with all
>  kind of strange values in it.
>
>  >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Discussion on help-me-to-run-cakephp-under-xampp

2008-02-23 Thread AD7six

Vivek please don't create pages like this: send a message to the group.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Form processing

2008-02-23 Thread Novice Programmer
Can some one point me to a good tutorial on using cakephp to process form
elements and making sql injection safe database operations?
Thanks in advance.

-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread b logica

On Sat, Feb 23, 2008 at 4:46 PM, villas <[EMAIL PROTECTED]> wrote:
>
>  Thanks for the idea.  My set up is so simple that I can try anything
>  in seconds :)

Try:
$recursive = 2;
$this->User->find('[all|first|list]', $conditions, $fields, $recursive);


>  I commented out the key lines as you suggested and it just worked as
>  before,  it returned the [user] data but not the [group].  In other
>  words, no change.
>
>  I've been playing with this on and off since November and it has
>  worked yet!  If someone could post here the simplest working example,
>  I would be grateful.  Until then,  I'm sceptical that anyone actually
>  uses HABTM.  I can just imagine that everyone has given it a try and
>  then just found ways to work around the problem!
>

Try using the Bindable behavior. Comment out the binding params in
your models, leaving:

var $hasAndBelongsToMany = 'Group';
var $hasAndBelongsToMany = 'User';

class AppModel extends Model{
var $actsAs = array('Bindable' => array('notices' => true));
...
}

UsersController:

$criteria = array(
'conditions' => array('User.name' => 'foo'),
'restrict' => array(
'Group(id,name)'
)
);
$this->set('users', $this->User->find('all', $criteria, null, null));


Here's a working example. This controller action is for a member
directory. An alphabetical list of links is provided, each passing its
letter. A list of members, with associated data, is returned.

function findByLetter()
{
$letter = $this->params['letter'];
$conditions = array(
'conditions' => "LOWER(SUBSTRING(last_name, 1, 1)) = 
'${letter}'",
'restrict' => array(
'MemberProfile(organisation)',
'Discipline(id,name_en,slug_en)'
)
);

$this->Member->order = 'Member.last_name ASC';

$this->set('letter', $letter);
$this->set('members', $this->Member->find('all', $conditions, null, 
null));

$this->Session->write('directory_search_url', "/members/${letter}");
$this->render('list');
}


Array
(
[Member] => Array
(
[id] => 802
[created] => 2006-08-29 13:40:32
[modified] => 2008-01-21 18:38:54
[enabled] => t
[member_type_id] => 3
[first_name] => 
[last_name] => 
[slug] => _
[full_name] =>  
)

[MemberProfile] => Array
(
[organisation] => 
[id] => 528
)

[Discipline] => Array
(
[0] => Array
(
[id] => 1
[name_en] => Writing
[slug_en] => Writing
)

[1] => Array
(
[id] => 2
[name_en] => Visual Arts
[slug_name_en] => Visual_Arts
)
)
)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Data Validation with Multiple Rules Doesn't Display Multiple Errors

2008-02-23 Thread BlenderStyle

I'm using CakePHP 1.2.0.6311. I'm having an issue when using multiple
validation rules per field (thanks to http://book.cakephp.org for the
help) where only the first failed rule is displayed in the view.
Example:

CustomModel:
var $validate = array(
  'my_field' => array(
'minlength' => array(
  'rule' => array('minLength', 4),
  'message' => 'Must Be at Least 4 Characters Long'
),
'alphanumeric' => array(
  'rule' => 'alphaNumeric',
  'message' => 'Must Only Contain Alphanumeric Characters'
  );

CustomsController:
function testValidate() {
  if(!empty($this->data)) {
$this->User->set($this->data);
$this->User->validates();
  }
}

test_validate.ctp:
echo $form->create('Custom', array('controller' => 'customs', 'action'
=> 'testValidate'));
echo $form->input('my_field');
echo $form->create('submit');

If both the minlength and alphanumeric rules fail, only the
minlength's message is displayed. However, the validation works with
one or the other.

So, my first question is, am I doing something wrong or is this not a
feature of CakePHP 1.2.0.6311? Last question is - and this may be
stupid - but how does the model pass the message to the view?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Working out the model name of a controller

2008-02-23 Thread MonkeyGirl

Hi again!

I'm discovering the joys of moving a lot of things from individual
controllers to the app_controller. This means I need to be able to
work out the controller name and model name for whatever happens to be
inheriting it at any given time. This is how I'm doing it:

$controllerName = $this->params['controller']; // Work out the
name of the controller
$modelName = Inflector::classify($controllerName); // Work out the
name of the controller's corresponding model

This method works, but is it the right way of doing it? Should I be
using the inflector in this way?

Thanks,
Zoe.
--~--~-~--~~~---~--~~
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: cakephp 1.2 form

2008-02-23 Thread b logica

Try this to close your controller action:

$this->render('VIEW', 'ajax');

where VIEW is the name of your view. (or element?)


On Sat, Feb 23, 2008 at 12:30 PM, brammeleman <[EMAIL PROTECTED]> wrote:
>
>  I'm trying to create a simple Ajax based form. These are the steps
>  I've taken along with the questions that came up:
>
>  I've managed to get the forms' content into a div element. Done by
>  creating an 'ajax' instead of an 'html' link. When I submit the form,
>  I get redirected back to the index view showing the modified or added
>  record. All fine!
>  But, when the form validation fails, I get redirected to the form
>  directly rendered into the layout (instead of in the div element).
>
>  To solve this problem, I've replaced the $form->create helper call by
>  the $ajax->form helper call in the form view.  Telling the $ajax->form
>  function to update the div element.
>
>  Q1) what's the difference in using $ajax->form and $ajax->submit?
>  should one of them be used exclusively? or do they need to be used in
>  a pair (like $form->create and $form->end)?
>
>  Now it works nice when the form validation fails. But when the
>  submitted data validates, the redirected (index) page gets rendered in
>  the div. The funny thing is that somehow the requesthanler doesn't
>  know it's an ajax request. It renders the content in the default
>  layout.
>
>  I'm obviously missing the point somewhere
>  Q2) how can you make sure that form stays in the div, but when it
>  validates you get a non-ajax redirect?
>
>  Thanks for your help,
>
>  Bram
>
>  ps: someone else apparently posted a similar question in the bin:
>  http://bin.cakephp.org/saved/521
>  >
>

--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread villas

Thanks for the idea.  My set up is so simple that I can try anything
in seconds :)

I commented out the key lines as you suggested and it just worked as
before,  it returned the [user] data but not the [group].  In other
words, no change.

I've been playing with this on and off since November and it has
worked yet!  If someone could post here the simplest working example,
I would be grateful.  Until then,  I'm sceptical that anyone actually
uses HABTM.  I can just imagine that everyone has given it a try and
then just found ways to work around the problem!



On Feb 23, 7:28 pm, Corie <[EMAIL PROTECTED]> wrote:
> I have had a lot of problems with HABTM also. I'm convinced it's all
> bugged, and trying to find any solution to these simple problems leads
> you to workarounds and extra behaviors, which I don't consider
> solutions.
>
> Have you tried leaving out the foreignKey and associationForeignKey
> and letting Cake apply them automatically?
>
> On Feb 23, 2:13 pm, villas <[EMAIL PROTECTED]> wrote:
>
> > @blogica.  Everyone who has made HABTM work is a guru as far as I'm
> > concerned :)
>
> > To test what is being returned,  I'm simply putting this in my
> > controller view:
>
> > $this->User->recursive = 1;
> > debug($this->User->findAll());
>
> > the Group array is always empty.
>
> > Do I need to put more stuff in the model?
> > Can anyone share a working example?
>
> > On Feb 23, 6:37 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > > Oh, I'm by no stretch a Cake guru. I'm still working on my first app
> > > (porting over an existing site) in my spare time. But I'm trying to
> > > answer what questions I can so the gurus don't have to. Of course,
> > > corrections to any erroneous info I might give are more than welcome.
>
> > > I think that part of the problem with the
> > > $associationForeignKey/$foreignKey is that, under some circumstances,
> > > it doesn't matter if they're reversed. I say that because I just did
> > > just that in one of my models and it showed no obvious effect. But (if
> > > I'm correct in that assumption) problems definitely will show up if
> > > there are other inconsistencies.
>
> > > What I mean is, once the models, controllers, etc. are set up
> > > correctly, it may be that *sometimes* those values may be switched
> > > without showing any errors. But this will only be the case once
> > > everything's set up. Until then, if the values are switched, things
> > > will go wrong immediately.
>
> > > I'm just talking out of my arse right now; none of this has been
> > > tested. But I can see for myself that switching the values doesn't
> > > cause any obvious error.
>
> > > Actually, upon further thought, I think that it's not crucial for
> > > SELECT but that a save would fail miserably (or, more likely, have
> > > very inconsistent results).
>
> > > As for your initial problem, you probably need to set the correct
> > > recursion. You can also look into using the Bindable behavior:
>
> > >http://bakery.cakephp.org/articles/view/bindable-behavior-control-you...
>
> > > On Sat, Feb 23, 2008 at 12:38 PM, villas <[EMAIL PROTECTED]> wrote:
>
> > > >  @blogica.  Thanks for your reply and although you may be right about
> > > >  the keys being reversed in my inital post,  I had already tried them
> > > >  both ways before posting.
>
> > > >  You are also right about other examples being confused.  The CookBook
> > > >  example seems to be wrong in a couple of ways and when I eventually
> > > >  discover how this works,  I'll be delighted to propose amendments.
>
> > > >  Until then,  perhaps the best way for me to figure this out is by
> > > >  copying someone's working code.  Perhaps some kind soul would provide
> > > >  the barest working example for me to copy.  Otherwise,  I hope blogica
> > > >  or some other guru may provide an insight.
>
> > > >  On Feb 23, 4:56 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> > > >  > You have your keys reversed.
>
> > > >  > 'foreignKey' => 'user_id',
> > > >  > 'associationForeignKey' => 'group_id',
>
> > > >  > This same thing has caught me up, over and over again, due to looking
> > > >  > at the array and its keys from the wrong perspective. Rather than the
> > > >  > keys & values be about Group they are more about User, as pertains to
> > > >  > Group. I hope that makes sense. Just remember that the key with
> > > >  > 'association' is for the 'other' model (ie. not the model for the
> > > >  > present class but the one that is the key in the $hasAndBelongsToMany
> > > >  > array.
>
> > > >  > A surprising number of examples out there have it reversed. I think
> > > >  > there's an example in the docs somewhere that has it reversed, also.
>
> > > > > On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>
> > > >  > >  Cake 1.2 Beta / Php 5.xx / Firebird 2
>
> > > >  > >  I have never succeeded in making even the simplest HABTM 
> > > > association
> > > >  > >  work. I tried scaffold and reading everything I could and
> 

Re: CakePHP v1.2 stable enough for production?

2008-02-23 Thread Pablo Viojo
I think this has been asked, and answered, too many times ;) [1]...Just use
it!

Regards,


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net


[1]
http://groups.google.com/group/cake-php/search?group=cake-php&q=1.2+production&qt_g=Search+this+group

On Sat, Feb 23, 2008 at 5:42 PM, Greg Baker <[EMAIL PROTECTED]>
wrote:

>
> I know its beta..  But I'm wondering if people are using 1.2 in
> production environments?
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP v1.2 stable enough for production?

2008-02-23 Thread Greg Baker

I know its beta..  But I'm wondering if people are using 1.2 in
production environments?
--~--~-~--~~~---~--~~
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: Ruby on Rails 2.0 Removed Scaffold Generation?

2008-02-23 Thread Baz
Big changes, yes. Removal of key features??? What's that about?

For me, a web framework is about getting things done. This is just another
hurdle in the way of thatoh well.

On Sat, Feb 23, 2008 at 7:40 AM, red <[EMAIL PROTECTED]> wrote:

>
> Just about scaffolding - they did not removed the generator.
> Check this:
> http://wiki.rubyonrails.org/rails/pages/Scaffold
>
> Anyway changes in RoR 2.0 are big, but look at Cake 1.2 - some
> tutorials from 1.1 also won't work. Every software sometimes get 'big
> changes'.
>
>
>
> On 23 Lut, 12:43, Baz <[EMAIL PROTECTED]> wrote:
> > Hey all,
> >
> > After much pressure from some of my peers and colleagues, I've decided
> to
> > take a Ride on the Ruby on Rails train and see where it leads. The
> stupid
> > train didn't get out of the station, that's where it leads.
> >
> > I was drawn to RoR for a number of reasons:
> >
> >1. Been hearing about it for ages.
> >2. It's more "established"
> >3. There are a MILLION plugins out there for it. And they are a
> breeze
> >to "install".
> >4. The console does a lot of generation (at least it used to)
> >5. Got the Agile Web Dev. boo, and wanted to play with it.
> >6. There's an IDE (RadRails) that ties into the console and the
> server
> >and everything. Debugging is a breeze, nothing to install or
> configure, just
> >a few clicks. You could do all your "raking" straight from the IDE.
> It's
> >shiny :D
> >
> > I was just trying to go through one of the basic tutorials in the book.
> > After which, I would attempt to port some of my smaller CakePHP apps. To
> > make a long story shortthe brilliant guys decided for the 2.0release,
> > they would remove scaffold generation (the equivalent of baking).
> >
> > Now there are all these fancy database migrations, etc, etc. And I'm
> sure
> > they serve a very good purpose, but who gives a crap. I was already
> dreading
> > the "interesting" syntax of Ruby, now they're telling me I need to
> basically
> > write out my entire database structure into this "migration format" crap
> for
> > EVERY TABLE?
> >
> > I mean, it's not hard, but I just don't wanna do it. What's the point of
> all
> > those graphical database editors if I gotta go "generate model Post ...
> and
> > a whole bunch of fields and definitions"? And it's not even SQL. So
> that's
> > one thing I would have to learn before even being able to get started
> > really.
> >
> > It was also interesting how ALL the tutorials referenced the old method
> of
> > scaffolding. There was always a note at the top/bottom of the tut.
> saying
> > "this may not work in 2.0", but they never said what exactly.
> >
> > I must say, I'm greatly disappointed. I'm still baffled actually. By all
> > reports, RoR seemed to be highly automated, now they just pulled out a
> huge
> > chunk of it. I'm sorry, if CakePHP ever pulled out the "bake" console,
> I'd
> > have to shoot myself in the head.
> >
> > I should have known better. Fate brought me to CakePHP for reason. With
> all
> > it's quirks, this is the most productive I've been.
> >
> > Sorry for the rant.
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



filling an array for a selectbox (v1.2)

2008-02-23 Thread Ronald

It's probably something simple, but I'm trying to figure this out for
a few hours now and I just can't get it right.

I'm building a component and one function needs to return an array I
can use to fill a selectbox.
This return array needs to be filled from an array of objects,.

This is my loop to walk trough the array of objects.
---
for($i = 0; $i < count($issuerArray); $i++)
{
//$issuerArray[$i]->issuerID   <- this needs to be the id of
every option
//$issuerArray[$i]->issuerName; <- this needs to be the value of
every option
}
---
My question is how to get these values into a array (the return array)
in such a way that I can use it to fill an selectbox.
I tried several things but I allways end up with a selectbox with all
kind of strange values in it.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Integrating LightWindow in Cake

2008-02-23 Thread Novice Programmer
Hi,

Any one ever succesfully integrated cake php with LightWindow?(
http://www.stickmanlabs.com/lightwindow)

-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread Corie

I have had a lot of problems with HABTM also. I'm convinced it's all
bugged, and trying to find any solution to these simple problems leads
you to workarounds and extra behaviors, which I don't consider
solutions.

Have you tried leaving out the foreignKey and associationForeignKey
and letting Cake apply them automatically?

On Feb 23, 2:13 pm, villas <[EMAIL PROTECTED]> wrote:
> @blogica.  Everyone who has made HABTM work is a guru as far as I'm
> concerned :)
>
> To test what is being returned,  I'm simply putting this in my
> controller view:
>
> $this->User->recursive = 1;
> debug($this->User->findAll());
>
> the Group array is always empty.
>
> Do I need to put more stuff in the model?
> Can anyone share a working example?
>
> On Feb 23, 6:37 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > Oh, I'm by no stretch a Cake guru. I'm still working on my first app
> > (porting over an existing site) in my spare time. But I'm trying to
> > answer what questions I can so the gurus don't have to. Of course,
> > corrections to any erroneous info I might give are more than welcome.
>
> > I think that part of the problem with the
> > $associationForeignKey/$foreignKey is that, under some circumstances,
> > it doesn't matter if they're reversed. I say that because I just did
> > just that in one of my models and it showed no obvious effect. But (if
> > I'm correct in that assumption) problems definitely will show up if
> > there are other inconsistencies.
>
> > What I mean is, once the models, controllers, etc. are set up
> > correctly, it may be that *sometimes* those values may be switched
> > without showing any errors. But this will only be the case once
> > everything's set up. Until then, if the values are switched, things
> > will go wrong immediately.
>
> > I'm just talking out of my arse right now; none of this has been
> > tested. But I can see for myself that switching the values doesn't
> > cause any obvious error.
>
> > Actually, upon further thought, I think that it's not crucial for
> > SELECT but that a save would fail miserably (or, more likely, have
> > very inconsistent results).
>
> > As for your initial problem, you probably need to set the correct
> > recursion. You can also look into using the Bindable behavior:
>
> >http://bakery.cakephp.org/articles/view/bindable-behavior-control-you...
>
> > On Sat, Feb 23, 2008 at 12:38 PM, villas <[EMAIL PROTECTED]> wrote:
>
> > >  @blogica.  Thanks for your reply and although you may be right about
> > >  the keys being reversed in my inital post,  I had already tried them
> > >  both ways before posting.
>
> > >  You are also right about other examples being confused.  The CookBook
> > >  example seems to be wrong in a couple of ways and when I eventually
> > >  discover how this works,  I'll be delighted to propose amendments.
>
> > >  Until then,  perhaps the best way for me to figure this out is by
> > >  copying someone's working code.  Perhaps some kind soul would provide
> > >  the barest working example for me to copy.  Otherwise,  I hope blogica
> > >  or some other guru may provide an insight.
>
> > >  On Feb 23, 4:56 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> > >  > You have your keys reversed.
>
> > >  > 'foreignKey' => 'user_id',
> > >  > 'associationForeignKey' => 'group_id',
>
> > >  > This same thing has caught me up, over and over again, due to looking
> > >  > at the array and its keys from the wrong perspective. Rather than the
> > >  > keys & values be about Group they are more about User, as pertains to
> > >  > Group. I hope that makes sense. Just remember that the key with
> > >  > 'association' is for the 'other' model (ie. not the model for the
> > >  > present class but the one that is the key in the $hasAndBelongsToMany
> > >  > array.
>
> > >  > A surprising number of examples out there have it reversed. I think
> > >  > there's an example in the docs somewhere that has it reversed, also.
>
> > > > On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>
> > >  > >  Cake 1.2 Beta / Php 5.xx / Firebird 2
>
> > >  > >  I have never succeeded in making even the simplest HABTM association
> > >  > >  work. I tried scaffold and reading everything I could and
> > >  > >  experimenting different ways.  Here is the simple setup:
>
> > >  > >  Users:  id, name
> > >  > >  Groups: id, name
> > >  > >  Groups_Users: user_id, group_id
>
> > >  > >  Model:  User.php
> > >  > >  class User extends AppModel {
>
> > >  > > var $name = 'User';
> > >  > > var $useTable = 'users';
>
> > >  > > var $hasAndBelongsToMany = array(
> > >  > > 'Group' => array('className' => 'Group',
> > >  > > 'joinTable' => 
> > > 'groups_users',
> > >  > > 'foreignKey' => 
> > > 'group_id',
> > >  > > 'associationForeignKey' => 
> > > 'user_id',
> > >  > > 

Re: HABTM

2008-02-23 Thread villas

@blogica.  Everyone who has made HABTM work is a guru as far as I'm
concerned :)

To test what is being returned,  I'm simply putting this in my
controller view:

$this->User->recursive = 1;
debug($this->User->findAll());

the Group array is always empty.

Do I need to put more stuff in the model?
Can anyone share a working example?

On Feb 23, 6:37 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> Oh, I'm by no stretch a Cake guru. I'm still working on my first app
> (porting over an existing site) in my spare time. But I'm trying to
> answer what questions I can so the gurus don't have to. Of course,
> corrections to any erroneous info I might give are more than welcome.
>
> I think that part of the problem with the
> $associationForeignKey/$foreignKey is that, under some circumstances,
> it doesn't matter if they're reversed. I say that because I just did
> just that in one of my models and it showed no obvious effect. But (if
> I'm correct in that assumption) problems definitely will show up if
> there are other inconsistencies.
>
> What I mean is, once the models, controllers, etc. are set up
> correctly, it may be that *sometimes* those values may be switched
> without showing any errors. But this will only be the case once
> everything's set up. Until then, if the values are switched, things
> will go wrong immediately.
>
> I'm just talking out of my arse right now; none of this has been
> tested. But I can see for myself that switching the values doesn't
> cause any obvious error.
>
> Actually, upon further thought, I think that it's not crucial for
> SELECT but that a save would fail miserably (or, more likely, have
> very inconsistent results).
>
> As for your initial problem, you probably need to set the correct
> recursion. You can also look into using the Bindable behavior:
>
> http://bakery.cakephp.org/articles/view/bindable-behavior-control-you...
>
> On Sat, Feb 23, 2008 at 12:38 PM, villas <[EMAIL PROTECTED]> wrote:
>
> >  @blogica.  Thanks for your reply and although you may be right about
> >  the keys being reversed in my inital post,  I had already tried them
> >  both ways before posting.
>
> >  You are also right about other examples being confused.  The CookBook
> >  example seems to be wrong in a couple of ways and when I eventually
> >  discover how this works,  I'll be delighted to propose amendments.
>
> >  Until then,  perhaps the best way for me to figure this out is by
> >  copying someone's working code.  Perhaps some kind soul would provide
> >  the barest working example for me to copy.  Otherwise,  I hope blogica
> >  or some other guru may provide an insight.
>
> >  On Feb 23, 4:56 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> >  > You have your keys reversed.
>
> >  > 'foreignKey' => 'user_id',
> >  > 'associationForeignKey' => 'group_id',
>
> >  > This same thing has caught me up, over and over again, due to looking
> >  > at the array and its keys from the wrong perspective. Rather than the
> >  > keys & values be about Group they are more about User, as pertains to
> >  > Group. I hope that makes sense. Just remember that the key with
> >  > 'association' is for the 'other' model (ie. not the model for the
> >  > present class but the one that is the key in the $hasAndBelongsToMany
> >  > array.
>
> >  > A surprising number of examples out there have it reversed. I think
> >  > there's an example in the docs somewhere that has it reversed, also.
>
> > > On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>
> >  > >  Cake 1.2 Beta / Php 5.xx / Firebird 2
>
> >  > >  I have never succeeded in making even the simplest HABTM association
> >  > >  work. I tried scaffold and reading everything I could and
> >  > >  experimenting different ways.  Here is the simple setup:
>
> >  > >  Users:  id, name
> >  > >  Groups: id, name
> >  > >  Groups_Users: user_id, group_id
>
> >  > >  Model:  User.php
> >  > >  class User extends AppModel {
>
> >  > > var $name = 'User';
> >  > > var $useTable = 'users';
>
> >  > > var $hasAndBelongsToMany = array(
> >  > > 'Group' => array('className' => 'Group',
> >  > > 'joinTable' => 
> > 'groups_users',
> >  > > 'foreignKey' => 
> > 'group_id',
> >  > > 'associationForeignKey' => 
> > 'user_id',
> >  > > 'unique' => true,
> >  > > 'conditions' => '',
> >  > > 'fields' => '',
> >  > > 'order' => '',
> >  > > 'limit' => '',
> >  > > 'offset' => '',
> >  > > 'finderQuery' => '',
> >  > >  

where is data from AJAX POST?

2008-02-23 Thread [EMAIL PROTECTED]

I'd like to be able to POST some data periodically using jQuery ajax
calls. The URL contains an ID that is parsed out in the route, so the
controller should receive a value for $this->params['id'].

But how do I grab the values for the data I've POSTed? I thought it
would be in $this->data or might be in $this->RequestHandler->params[]
but that seems not to be the case. Because this is ALAX i'm finding it
difficult to debug this.

Note that I'm not using Cake's AJAX form creation or anything like
that. I don't see how that would fit with what I'm trying to do. This
isn't for submitting the entire form or saving the model, but for
making incremental saves of data in a textarea (TinyMCE). Think CMS.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Undefined Index in $this->Data?

2008-02-23 Thread Siebren Bakker
In my User model, I have an identicalFields function that is used to
determine if 2 inputs have the exact same text or not. I am trying to
compare my Email and ConfirmEmail fields.  When I call the function through
validation on my signup page, it works without any issue at all, however,
when I pass the same function through validation to my Edit function, it
returns an undefined index error:

Notice (8): Undefined index:  User
[APP/models/user.php, line 103


Here is the function in question:

98 function identicalFields( $field=array(), $compare_field=null
)
 99 {
100 foreach( $field as $key => $value )
101 {
102 $vi = $value;
103 $v2 =
$this->data[$this->name][$compare_field];
104 if ($vi !== $v2)
105 {
106 return false;
107 }
108 else
109 {
110 continue;
111 }
112 }
113 return true;
114 }

and here is the validation from earlier in the model

 62 'editemail' => array(
 63 'email' => array(
 64 'valid' => array(
 65 'rule' => array('email',
true),
 66 'message' => 'Please use a
valid E-mail address.'
 67 ),
 68 'checkUnique' => array(
 69 'rule' =>
array('checkUnique', 'email'),
 70 'message' => 'E-mail is
already being used. Choos
 71 )
 72 ),
 73 'confirm_email' => array(
 74 'valid' => array(
 75 'rule' => array('email',
true),
 76 'message' => 'Please use a
valid E-mail address!'
 77 ),
 78 'identical' => array(
 79 'rule' =>
array('identicalFields', 'email'),
 80 'message' => 'E-Mail
addresses must match'
 81 )
 82 )
 83 )

I am using ValidationSets, with my validates function set as :
116 function validates($ruleset=null, $data=array())
117 {
118 $this->currentRuleSet =
(isset($ruleset))?$ruleset:$this->currentRuleSet;
119 $this->validate =
$this->validationSets[$this->currentRuleSet];
120 return parent::validates($data)?true:false;
121
122 }


and a print_r of the $this->data array produces:

Array
(
[User] => Array
(
[email] => [EMAIL PROTECTED]
[confirm_email] => [EMAIL PROTECTED]
)

)


I hope this is enough information!
-- 
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

--~--~-~--~~~---~--~~
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: error of memory???

2008-02-23 Thread Cristian Vrabie

Well I use more tricks but I think the most important is that when I 
have a controller with many models I don't just pass them in the $uses 
var. I do this because the controller would load all models, and it's 
allmost sure you won't need all of them in all the actions. Instead i 
have a function in app_controller called getMyModel( $modelName ). This 
first checks to see if the model is not loaded, and if is not it calls 
App::import('Model',$modelName), then it instantiates the model, then it 
returns a refference to the model. So instead of 
$this->ModelName->find(..), i to $this->getMyModel->find(..). This way, 
if i only use a few models in an actions, only those will load.(this 
tries to be a rudimentary lazy loading of models).
Another trick is that i define only as few associations as possible (the 
critical ones). Instead I define them in another variable of the model 
(something like $__hasMany = array( 'myassoc' => ), and i have a 
function in app_model that lets me do quick binds at run time, like: 
$model->doMyBind( 'myassoc' ); I could do the same thing by describing 
the association with $model->bindModel but this is faster, and i don't 
have to define the asociation more than one time. Plus, if i think that 
i'll use that association a lot in a certain context, i user the 
"permanent" option of bindModel.
I have more of these "tricks", and I'm not sure using them is such a 
good practice. I never investigated if they don't provoke other effects 
that would do more bad than good. However, they seem to work so far, and 
I'm happy with them.

ooo.inbox wrote:
> Hello Christian...
> So interesting...
> Btw, i got the memory problem too using CakePHP.
>
> How do you manage it under 8M?
> What things that you do...?
>
> I hope you would to explain me.. thanks ;)
>
> On Feb 19, 4:31 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>   
>> I've noticed that sometimes the out of memory is generated by some
>> infinite recursion loops you create by mistake. It's quite easy to do
>> so.
>> And about the increasing of the php script memory, i tried to avoid it
>> by carefully coding and trying as much to lazy load the models,
>> components and other stuff that I need. So far i managed to keep it
>> under 8M even in large projects.
>>
>> On Feb 19, 2:56 am, "sixs" <[EMAIL PROTECTED]> wrote:> HI,
>> 
>>> I copied the index view and the index in controllers. I have a master and a 
>>> detail and I deleted some fields in the master. It displayed ok an this 
>>> error occurred when I clicked the list of the details.
>>> =
>>> Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
>>> allocate 276481 bytes) in C:\VertrigoServ\www\usa\views\layouts\default.ctp 
>>> on line 55
>>> ===
>>> Thanks for any help
>>> Jim
>>>   
>
> >
>
>   


--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread b logica

Oh, I'm by no stretch a Cake guru. I'm still working on my first app
(porting over an existing site) in my spare time. But I'm trying to
answer what questions I can so the gurus don't have to. Of course,
corrections to any erroneous info I might give are more than welcome.

I think that part of the problem with the
$associationForeignKey/$foreignKey is that, under some circumstances,
it doesn't matter if they're reversed. I say that because I just did
just that in one of my models and it showed no obvious effect. But (if
I'm correct in that assumption) problems definitely will show up if
there are other inconsistencies.

What I mean is, once the models, controllers, etc. are set up
correctly, it may be that *sometimes* those values may be switched
without showing any errors. But this will only be the case once
everything's set up. Until then, if the values are switched, things
will go wrong immediately.

I'm just talking out of my arse right now; none of this has been
tested. But I can see for myself that switching the values doesn't
cause any obvious error.

Actually, upon further thought, I think that it's not crucial for
SELECT but that a save would fail miserably (or, more likely, have
very inconsistent results).

As for your initial problem, you probably need to set the correct
recursion. You can also look into using the Bindable behavior:

http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings





On Sat, Feb 23, 2008 at 12:38 PM, villas <[EMAIL PROTECTED]> wrote:
>
>  @blogica.  Thanks for your reply and although you may be right about
>  the keys being reversed in my inital post,  I had already tried them
>  both ways before posting.
>
>  You are also right about other examples being confused.  The CookBook
>  example seems to be wrong in a couple of ways and when I eventually
>  discover how this works,  I'll be delighted to propose amendments.
>
>  Until then,  perhaps the best way for me to figure this out is by
>  copying someone's working code.  Perhaps some kind soul would provide
>  the barest working example for me to copy.  Otherwise,  I hope blogica
>  or some other guru may provide an insight.
>
>
>
>  On Feb 23, 4:56 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>  > You have your keys reversed.
>  >
>  > 'foreignKey' => 'user_id',
>  > 'associationForeignKey' => 'group_id',
>  >
>  > This same thing has caught me up, over and over again, due to looking
>  > at the array and its keys from the wrong perspective. Rather than the
>  > keys & values be about Group they are more about User, as pertains to
>  > Group. I hope that makes sense. Just remember that the key with
>  > 'association' is for the 'other' model (ie. not the model for the
>  > present class but the one that is the key in the $hasAndBelongsToMany
>  > array.
>  >
>  > A surprising number of examples out there have it reversed. I think
>  > there's an example in the docs somewhere that has it reversed, also.
>  >
>
>
> > On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>  >
>  > >  Cake 1.2 Beta / Php 5.xx / Firebird 2
>  >
>  > >  I have never succeeded in making even the simplest HABTM association
>  > >  work. I tried scaffold and reading everything I could and
>  > >  experimenting different ways.  Here is the simple setup:
>  >
>  > >  Users:  id, name
>  > >  Groups: id, name
>  > >  Groups_Users: user_id, group_id
>  >
>  > >  Model:  User.php
>  > >  class User extends AppModel {
>  >
>  > > var $name = 'User';
>  > > var $useTable = 'users';
>  >
>  > > var $hasAndBelongsToMany = array(
>  > > 'Group' => array('className' => 'Group',
>  > > 'joinTable' => 
> 'groups_users',
>  > > 'foreignKey' => 
> 'group_id',
>  > > 'associationForeignKey' => 
> 'user_id',
>  > > 'unique' => true,
>  > > 'conditions' => '',
>  > > 'fields' => '',
>  > > 'order' => '',
>  > > 'limit' => '',
>  > > 'offset' => '',
>  > > 'finderQuery' => '',
>  > > 'deleteQuery' => '',
>  > > 'insertQuery' => ''
>  > > )
>  > > );
>  > >  }
>  >
>  > >  When I use 'find' in my user controller and then dump the array,  I
>  > >  get the [user] array data,  but [group] array is always empty.
>  >
>  > >  The debug message shows the SQL from two queries.  When I run the
>  > >  queries manually they each return data (from users and groups
>  > >  respectively) as expected.
> 

Re: error of memory???

2008-02-23 Thread ooo.inbox

Hello Christian...
So interesting...
Btw, i got the memory problem too using CakePHP.

How do you manage it under 8M?
What things that you do...?

I hope you would to explain me.. thanks ;)

On Feb 19, 4:31 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I've noticed that sometimes the out of memory is generated by some
> infinite recursion loops you create by mistake. It's quite easy to do
> so.
> And about the increasing of the php script memory, i tried to avoid it
> by carefully coding and trying as much to lazy load the models,
> components and other stuff that I need. So far i managed to keep it
> under 8M even in large projects.
>
> On Feb 19, 2:56 am, "sixs" <[EMAIL PROTECTED]> wrote:> HI,
> > I copied the index view and the index in controllers. I have a master and a 
> > detail and I deleted some fields in the master. It displayed ok an this 
> > error occurred when I clicked the list of the details.
> > =
> > Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
> > allocate 276481 bytes) in C:\VertrigoServ\www\usa\views\layouts\default.ctp 
> > on line 55
> > ===
> > Thanks for any help
> > Jim

--~--~-~--~~~---~--~~
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: Very Cool API

2008-02-23 Thread Arjen V.
The jQuery wiki is a pretty good source of information, but my personal
favorite API reference the one for ExtJS: http://extjs.com/deploy/dev/docs/.
It does lack examples (for the most part) and user feedback, but you can
find what you need very quickly.


On Wed, Feb 20, 2008 at 7:27 PM, mbavio <[EMAIL PROTECTED]> wrote:

>
> Has anybody seen the API of jQuery?
>
> http://docs.jquery.com (right menu)
>
> Divided in section, each function has its explanation and a clear
> example.
>
> Is there any way that we can do this to the API of CakePHP, maybe with
> the new CookBook philosophy, and the users adding the cool examples?
>
> That would be really cool.
>
> Cheers,
> Martin B
> >
>

--~--~-~--~~~---~--~~
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: form->input label options

2008-02-23 Thread Samuel DeVore

you can also call $form->input like this

$form->input('Model.field',array('label'=>array('text'=>'The LABEL Has
Power','class'=>'this-label-has-class')));

Sam D

On Sat, Feb 23, 2008 at 1:21 AM, francky06l <[EMAIL PROTECTED]> wrote:
>
>  b logica, you are right, vertical-align should be set on the
>  containing block, I was just answering on the syntax for passing
>  style..
>
>
>  On Feb 23, 1:38 am, "b logica" <[EMAIL PROTECTED]> wrote:
>  > Though vertical-align on the label doesn't affect the block, itself,
>  > but the content. It might not make a difference in some cases but it's
>  > important to know. IMO, it'd be better to style the block with margin,
>  > float, width, and friends.
>  >
>
>
> > On Fri, Feb 22, 2008 at 6:44 PM, francky06l <[EMAIL PROTECTED]> wrote:
>  >
>  > >  or :
>  >
>  > >  $form->label('Model.field', array('style' => 'vertical-align: top;'))
>  >
>  > >  On Feb 22, 7:07 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>  > >  > What doctype are you using? I've never heard of a valign attribute 
> for label.
>  >
>  > >  > You can set the class in the label() method:
>  >
>  > >  > $form->label('Model.field', array('class' => 'LabelClass'))
>  >
>  > > > On Fri, Feb 22, 2008 at 10:06 AM, Richard Ward <[EMAIL PROTECTED]> 
> wrote:
>  > >  > > Hi all,
>  >
>  > >  > > How do you set the label options (valign) on a form->input tag 
> generated
>  > >  > > through baking?
>  >
>  > >  > > I know how to change the label text:
>  > >  > >  $form->input('Model.field', array('label' => 'labelText'));
>  >
>  > >  > > Is there some option setting or must I recode it to:
>  >
>  > >  > > $form->label('Model.field', 'labelText', array('valign' => 'top'));
>  > >  > > $form->input('Model.field');
>  >
>  > >  > > Thanks,
>  > >  > >  Richard
>  >
>



-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread villas

@blogica.  Thanks for your reply and although you may be right about
the keys being reversed in my inital post,  I had already tried them
both ways before posting.

You are also right about other examples being confused.  The CookBook
example seems to be wrong in a couple of ways and when I eventually
discover how this works,  I'll be delighted to propose amendments.

Until then,  perhaps the best way for me to figure this out is by
copying someone's working code.  Perhaps some kind soul would provide
the barest working example for me to copy.  Otherwise,  I hope blogica
or some other guru may provide an insight.


On Feb 23, 4:56 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> You have your keys reversed.
>
> 'foreignKey' => 'user_id',
> 'associationForeignKey' => 'group_id',
>
> This same thing has caught me up, over and over again, due to looking
> at the array and its keys from the wrong perspective. Rather than the
> keys & values be about Group they are more about User, as pertains to
> Group. I hope that makes sense. Just remember that the key with
> 'association' is for the 'other' model (ie. not the model for the
> present class but the one that is the key in the $hasAndBelongsToMany
> array.
>
> A surprising number of examples out there have it reversed. I think
> there's an example in the docs somewhere that has it reversed, also.
>
> On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>
> >  Cake 1.2 Beta / Php 5.xx / Firebird 2
>
> >  I have never succeeded in making even the simplest HABTM association
> >  work. I tried scaffold and reading everything I could and
> >  experimenting different ways.  Here is the simple setup:
>
> >  Users:  id, name
> >  Groups: id, name
> >  Groups_Users: user_id, group_id
>
> >  Model:  User.php
> >  class User extends AppModel {
>
> > var $name = 'User';
> > var $useTable = 'users';
>
> > var $hasAndBelongsToMany = array(
> > 'Group' => array('className' => 'Group',
> > 'joinTable' => 
> > 'groups_users',
> > 'foreignKey' => 'group_id',
> > 'associationForeignKey' => 
> > 'user_id',
> > 'unique' => true,
> > 'conditions' => '',
> > 'fields' => '',
> > 'order' => '',
> > 'limit' => '',
> > 'offset' => '',
> > 'finderQuery' => '',
> > 'deleteQuery' => '',
> > 'insertQuery' => ''
> > )
> > );
> >  }
>
> >  When I use 'find' in my user controller and then dump the array,  I
> >  get the [user] array data,  but [group] array is always empty.
>
> >  The debug message shows the SQL from two queries.  When I run the
> >  queries manually they each return data (from users and groups
> >  respectively) as expected.
>
> >  I know it should be simple,  but why can't I get the [group] array
> >  populated from the queries.  It has been driving me mad!
>
> >  Regards, villas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cakephp 1.2 form

2008-02-23 Thread brammeleman

I'm trying to create a simple Ajax based form. These are the steps
I've taken along with the questions that came up:

I've managed to get the forms' content into a div element. Done by
creating an 'ajax' instead of an 'html' link. When I submit the form,
I get redirected back to the index view showing the modified or added
record. All fine!
But, when the form validation fails, I get redirected to the form
directly rendered into the layout (instead of in the div element).

To solve this problem, I've replaced the $form->create helper call by
the $ajax->form helper call in the form view.  Telling the $ajax->form
function to update the div element.

Q1) what's the difference in using $ajax->form and $ajax->submit?
should one of them be used exclusively? or do they need to be used in
a pair (like $form->create and $form->end)?

Now it works nice when the form validation fails. But when the
submitted data validates, the redirected (index) page gets rendered in
the div. The funny thing is that somehow the requesthanler doesn't
know it's an ajax request. It renders the content in the default
layout.

I'm obviously missing the point somewhere
Q2) how can you make sure that form stays in the div, but when it
validates you get a non-ajax redirect?

Thanks for your help,

Bram

ps: someone else apparently posted a similar question in the bin:
http://bin.cakephp.org/saved/521
--~--~-~--~~~---~--~~
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: Problems creating records Cake 1.2 on postgres

2008-02-23 Thread b logica

What is the model name you're dealing with here? The 'public' part of
the query refers to the public schema and is used in creating the
sequence name (from which the last value is to be gotten). It looks
like something in your table name is causing Cake to come up with an
incomplete sequence name:

function lastInsertId($source, $field = 'id') {
foreach ($this->__descriptions[$source] as $name => $sourceinfo) {
if (strcasecmp($name, $field) == 0) {
break;
}
}

if (isset($this->_sequenceMap[$source])) {
$seq = $this->_sequenceMap[$source];
} elseif (preg_match('/^nextval\(\'(\w+)\'/', $sourceinfo['default'],
$matches)) {
$seq = $matches[1];
} else {
$seq = "{$source}_{$field}_seq";
}

$res = $this->rawQuery("SELECT last_value AS max FROM \"{$seq}\"");
$data = $this->fetchRow($res);
return $data[0]['max'];
}


If you can, log into psql and type:

\ds

to see your sequence names. Maybe something's screwy there. Otherwise,
it might be something you've set in your Cake app.

On Sat, Feb 23, 2008 at 1:27 AM, Bruce <[EMAIL PROTECTED]> wrote:
>
>  I am working in Cake 1.2 with PHP5 and a postgres backend DB. When I
>  try to create records in any app I have tried, I get a warning then an
>  SQL error. The record seems to be created in the db, but with my
>  limited knowledge, it looks to me like cake is constructing an
>  incomplete SQL statement when trying to retrieve the ID of the record
>  just written.
>
>  Output is like:
>
>  Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
>  relation "public" does not exist [CORE/cake/libs/model/datasources/dbo/
>  dbo_postgres.php, line 122]
>
>  Code | Context
>  $sql=   "SELECT last_value AS max FROM "public""
>   */
> function _execute($sql) {
> return pg_query($this->connection, $sql);
>
>  pg_query - CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line
>  122
>  DboPostgres::_execute() - CORE/cake/libs/model/datasources/dbo/
>  dbo_postgres.php, line 122
>  DboPostgres::execute() - CORE/cake/libs/model/datasources/
>  dbo_source.php, line 155
>  DboPostgres::fetchRow() - CORE/cake/libs/model/datasources/
>  dbo_source.php, line 269
>  DboPostgres::lastInsertId() - CORE/cake/libs/model/datasources/dbo/
>  dbo_postgres.php, line 355
>  DboPostgres::create() - CORE/cake/libs/model/datasources/
>  dbo_source.php, line 500
>  JobHistory::save() - CORE/cake/libs/model/model.php, line 1234
>  JobHistoriesController::add() - APP/controllers/
>  job_histories_controller.php, line 23
>  Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 265
>  Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 237
>  [main] - APP/webroot/index.php, line 84
>  Query: SELECT last_value AS max FROM "public"
>
>  Any suggestions?
>
>
>  >
>

--~--~-~--~~~---~--~~
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: Automagically

2008-02-23 Thread BlenderStyle

I actually like the term "automagically". To me, automagically means
the Cake team did something really convenient to help out us
developers. For example, the way the form helper input method
automagically figures out what kind of input to make is amazing. All I
have to do in my view is $form->input('password'); and it does the
rest automatically like it's magic or something. But of course, it's
not magic. It's automagic.

Matt
--~--~-~--~~~---~--~~
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: HABTM

2008-02-23 Thread b logica

You have your keys reversed.

'foreignKey' => 'user_id',
'associationForeignKey' => 'group_id',

This same thing has caught me up, over and over again, due to looking
at the array and its keys from the wrong perspective. Rather than the
keys & values be about Group they are more about User, as pertains to
Group. I hope that makes sense. Just remember that the key with
'association' is for the 'other' model (ie. not the model for the
present class but the one that is the key in the $hasAndBelongsToMany
array.

A surprising number of examples out there have it reversed. I think
there's an example in the docs somewhere that has it reversed, also.

On Sat, Feb 23, 2008 at 10:22 AM, villas <[EMAIL PROTECTED]> wrote:
>
>  Cake 1.2 Beta / Php 5.xx / Firebird 2
>
>  I have never succeeded in making even the simplest HABTM association
>  work. I tried scaffold and reading everything I could and
>  experimenting different ways.  Here is the simple setup:
>
>  Users:  id, name
>  Groups: id, name
>  Groups_Users: user_id, group_id
>
>  Model:  User.php
>  class User extends AppModel {
>
> var $name = 'User';
> var $useTable = 'users';
>
> var $hasAndBelongsToMany = array(
> 'Group' => array('className' => 'Group',
> 'joinTable' => 'groups_users',
> 'foreignKey' => 'group_id',
> 'associationForeignKey' => 'user_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> )
> );
>  }
>
>  When I use 'find' in my user controller and then dump the array,  I
>  get the [user] array data,  but [group] array is always empty.
>
>  The debug message shows the SQL from two queries.  When I run the
>  queries manually they each return data (from users and groups
>  respectively) as expected.
>
>  I know it should be simple,  but why can't I get the [group] array
>  populated from the queries.  It has been driving me mad!
>
>  Regards, villas
>  >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Eclipse 3.3.1 and Cake PHP 1.2

2008-02-23 Thread Technoguru

I have been following the tutorial at
http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-with-cake,
in order to setup a cakePHP and Eclipse Environment that will give me
the ability to use cakePHP code completion, as well as run the bake
script in the Eclipse Workspace.  However it does not seem to work.  I
am using CakePHP 1.2 and Eclipse 3.3.1 on a Windows XP, that has
Apache, PHP, and MYSQL already installed.  I get to the point labeled
"Defining projects" in the tutorial, and can't get cake and my project
to link up.
 Can someone explain how my files need to be setup (where do I place
the core, and where my projects go in relation to it), how to link the
cake core files into my project so I have access to its classes, how
 to verify that the link was made, and finally the syntax to setup the
bake script.  The more detail, the better.  Thank you very much.

UPDATE

I have made some progress, but the controller still does not inherit
the core classes. Here is how far I have gotten:
1. I installed Eclipse PDT
2. I noticed that I was on the PHP navigator and not the PHP explorer
initially, so I opened the explorer by going to Windows -> Show View -
> Other -> PHP Explorer (Under PHP tools)

3. I had to convert the project to a PDT project in order to get the
"Include Path" ability. Right click the project, and click "Convert to
PDT project". Now if you right click you will see the "Include
Path"options.
After including the path to the cake core, it stills seems like it is
not working. I look in the Outline, and the core classes are not
present, and auto complete does not work. Can someone please help us
out. 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: Automagically

2008-02-23 Thread AD7six

JIm please be aware that any comment here that isn't a question, and
especially about the docs, is unlikely to have any positive effect.

Before we go too far down the road to trolldem please therefore take
note that:
 The book.cakephp.org site is where the (constantly updated) docs
are
 A bakery login is necessary to login to edit or comment on the
content of the book
 Anyone can register at the bakery.
 You (and I mean you not "other people") can submit corrections or
suggestions of any kind. by clicking on the "Edit this section" link
above whatever it it that you want to correct, or the "Suggest a new
section here" link on the right.
 Problems or enhancments related to the application and not the
content should /not/ be logged as a comment or sent as an edit but
registered on trac and maked for the book.

And while I'm here if anyone is willing to translate the book content
but doesn't see their langauge in the footer (Bulgarian should be
there v soon) ping John and ask for your langauge to be added as an
option. I was denied apparently "Ali G stylee" isn't a language.

AD
--~--~-~--~~~---~--~~
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: Automagically

2008-02-23 Thread Siebren Bakker
In all seriousness, someone, or several people spent a lot of their free
time creating those docs, and as such, I feel a great amount of respect for
their hard work. The term "Automagically" does not have a dictionary
definition, but it is a great description of how cake automatically and
magically turns
input('username'); ?>
into

Username:




On Sat, Feb 23, 2008 at 9:53 AM, John David Anderson (_psychic_) <
[EMAIL PROTECTED]> wrote:

>
>
> On Feb 23, 2008, at 8:34 AM, jim starboard wrote:
>
> >
> >
> > Please stop using the term "automagically" in the docs. It's an
> > embarrassment.
>
> Please feel free to imagineer some actionable deliverable we can
> replace it with. Once you've done so we may be incentivized to
> leverage your value-add.
>
> In all seriousness:
>
> 1. There's a proper channel for critique - the mailing list isn't it.
> 2. Since this is an open source project, there's a certain amount of
> civility we require in our communications.
>
> Thanks,
>
> John
>
> >
>


-- 
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

--~--~-~--~~~---~--~~
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: Automagically

2008-02-23 Thread John David Anderson (_psychic_)


On Feb 23, 2008, at 8:34 AM, jim starboard wrote:

>
>
> Please stop using the term "automagically" in the docs. It's an
> embarrassment.

Please feel free to imagineer some actionable deliverable we can  
replace it with. Once you've done so we may be incentivized to  
leverage your value-add.

In all seriousness:

1. There's a proper channel for critique - the mailing list isn't it.
2. Since this is an open source project, there's a certain amount of  
civility we require in our communications.

Thanks,

John

--~--~-~--~~~---~--~~
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: Inheriting attributes

2008-02-23 Thread AD7six



On Feb 23, 1:51 pm, MonkeyGirl <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I'm setting up some attributes that are arrays in inherited classes.
> For example, in /app/app_model.php I have the $validate rules that
> apply to some columns which appear in every table. Similarly, in /app/
> app_controller.php I have some universal $paginate settings such as
> the limit.
>
> Now I'm trying to add to these universally applicable values in the
> arrays with values specific to each model and controller. For example,
> adding rules that are unique to each model and paginate settings
> specific to each controller.
>
> Does anyone here know the official, recommended, CakePHP-approved way
> of adding new values to these existing arrays once they've been
> inherited? I can't use $validate += array(stuff); outside of a method.
> Would putting it in beforeValidate for the model, and a similar line
> in beforeFilter for the controller, achieve what I'm after? I have the
> feeling this technique *might* work, but I'd be doing it in a really
> bad way.
>
> Is there a clean, simple way of doing this? Sorry if it's in the
> documentation. I had a quick look for it, but I'm not really sure what
> to search for.
>
> Thank you,
> Zoe.

You could take a look at the controller constructor and borrow the
same logic.

If you define a constructor in any of your classes DO NOT forget to:
call the parent
define your constructor to accept the same parameters as the parent
and pass them in the parent call

hth,

AD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP 1.2 + othAuth + last_visit -- hack

2008-02-23 Thread bingo

hi all,

just wondering did anyone was able to get last_visit updated without
using this line before call saveField command

$UserModel->data = array();

Based on different suggestions that I found on bakery and some
blogs..I changed the original code to update last_visit column of
users table in othAuth Component to this

$UserModel->id = $row[$this->user_model]['id'];
$row[$this->user_model][$this->user_table_last_visit] = date('Y-m-d
H:i:s');
$res = $UserModel->saveField($this->user_table_last_visit,$row[$this-
>user_model][$this->user_table_last_visit],true);

However, the above saveField commands update all the fields that have
default value and not just only 'last_visit'.
On IRC, gwoo suggested to use $UserModel->data = array() before call
saveField function..and that did the trick..

But I am concern will it break something else..and if not ..why just
saveField is not working..Also on doing some test, I found the problem
is only with othAuth component. If I use the same command from model,
everything works perfectly..

let me know if you think, I might have missed setting some variable in
othAuth component

Regards,
bingo
--~--~-~--~~~---~--~~
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: Automagically

2008-02-23 Thread Mariano Iglesias

Why? Just because you say so? On your comment I NEED to quote nate: "Your
opinion is wrong!"

I've gotta tell you, some people just *ask for it*... I mean they *beg* for
it...

-MI

---

CakeFest Hispano: December, 2008 - Buenos Aires, Argentina -
http://es.cakefest.org

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
de jim starboard
Enviado el: Sábado, 23 de Febrero de 2008 12:34 p.m.
Para: Cake PHP
Asunto: Automagically

Please stop using the term "automagically" in the docs. It's an
embarrassment.


--~--~-~--~~~---~--~~
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: Automagically

2008-02-23 Thread AD7six



On Feb 23, 4:34 pm, jim starboard <[EMAIL PROTECTED]> wrote:
> Please stop using the term "automagically" in the docs. It's an
> embarrassment.

Says who.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Automagically

2008-02-23 Thread jim starboard


Please stop using the term "automagically" in the docs. It's an
embarrassment.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM

2008-02-23 Thread villas

Cake 1.2 Beta / Php 5.xx / Firebird 2

I have never succeeded in making even the simplest HABTM association
work. I tried scaffold and reading everything I could and
experimenting different ways.  Here is the simple setup:

Users:  id, name
Groups: id, name
Groups_Users: user_id, group_id

Model:  User.php
class User extends AppModel {

var $name = 'User';
var $useTable = 'users';

var $hasAndBelongsToMany = array(
'Group' => array('className' => 'Group',
'joinTable' => 'groups_users',
'foreignKey' => 'group_id',
'associationForeignKey' => 'user_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
}

When I use 'find' in my user controller and then dump the array,  I
get the [user] array data,  but [group] array is always empty.

The debug message shows the SQL from two queries.  When I run the
queries manually they each return data (from users and groups
respectively) as expected.

I know it should be simple,  but why can't I get the [group] array
populated from the queries.  It has been driving me mad!

Regards, villas
--~--~-~--~~~---~--~~
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: A negative hasMany

2008-02-23 Thread Renan Gonçalves
Well, its solved.

I used the hasMany with finderQuery and limit =  and its runs perfeclty.

Those are my relationship:
var $hasMany = array(
'AtualizacoesCriadas' => array(
'className'=> 'Atualizacao',
'foreignKey'=> 'usuario_id'
),
'AplicacoesLiberadas' => array(
'className'=> 'Aplicacao',
'limit'=> '',
'finderQuery'=> '
SELECT `AplicacoesLiberadas`.* FROM `caixa_aplicacoes` AS
`AplicacoesLiberadas`
INNER JOIN `auth_sections` ON `auth_sections`.`path` =
"caixa"
INNER JOIN `auth_actions` ON `auth_actions`.`section_id`
= `auth_sections`.`id`
AND `AplicacoesLiberadas`.`instancia` =
`auth_actions`.`file`
INNER JOIN `auth_users_actions` ON
`auth_users_actions`.`action_id` = `auth_actions`.`id`
AND `auth_users_actions`.`user_id` = {$__cakeID__$}'
),
'AtualizacoesPendentes' => array(
'className'=> 'Atualizacao',
'limit'=> '',
'finderQuery'=> '
SELECT `AtualizacoesPendentes`.* FROM `caixa_atualizacoes`
AS `AtualizacoesPendentes`
INNER JOIN `caixa_aplicacoes` AS `AplicacoesLiberadas`
ON `AtualizacoesPendentes`.`aplicacao_id` = `AplicacoesLiberadas`.`id`
INNER JOIN `auth_sections` ON `auth_sections`.`path` =
"caixa"
INNER JOIN `auth_actions` ON `auth_actions`.`section_id`
= `auth_sections`.`id`
AND `AplicacoesLiberadas`.`instancia` =
`auth_actions`.`file`
INNER JOIN `auth_users_actions` ON
`auth_users_actions`.`action_id` = `auth_actions`.`id`
AND `auth_users_actions`.`user_id` = {$__cakeID__$}
WHERE
`AtualizacoesPendentes`.`id` NOT IN (
SELECT DISTINCT(`atualizacao_id`) FROM
`caixa_usuarios_atualizacoes` WHERE `usuario_id` = {$__cakeID__$}
)
GROUP BY `AtualizacoesPendentes`.`id`'
)
);

Cake RULES !!!

Thanks!

On Sat, Feb 23, 2008 at 10:49 AM, Renan Gonçalves <[EMAIL PROTECTED]>
wrote:

> I can use a query like this:
>
> SELECT r.* FROM revisions AS r WHERE r.id NOT IN (
>SELECT revision_id FROM user_has_revised WHERE user_id = $__cakeId__$
> )
>
> This must work if for each user execute this query. hasAndBelongsToMany
> don't work because its fetchs a all relationship of all users on a unique
> query.
>
> I opened this ticket https://trac.cakephp.org/ticket/4204, so when I put a
> limit its will work.
>
>
> Thanks.
>
>
> On Sat, Feb 23, 2008 at 6:28 AM, francky06l <[EMAIL PROTECTED]> wrote:
>
> >
> > How did you use the $__cakeId__$ in your finder query ?
> >
> > On Feb 23, 1:43 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > > Sorry ..
> > >
> > > I wanna do a hasAndBelongsToMany relationship. Sorry for this..
> > > I tried to use finderQuery, doing a find (one result) it's ok, but
> > with
> > > findAll don't runs...
> > >
> > > On Fri, Feb 22, 2008 at 10:21 PM, BlenderStyle <[EMAIL PROTECTED]
> > >
> > > wrote:
> > >
> > >
> > >
> > >
> > >
> > > > You might be able to do something like this in your Revision model:
> > >
> > > > function getNegativeRevisions($user_id) {
> > > >$conditions = array('user_id' => '<> '.$user.id);
> > > >return $this->findAll($conditions);
> > > > }
> > >
> > > > Then, in your RevisionsController:
> > > > $user_id = '5';
> > > > $negative_revisions =
> > $this->Revision->getNegativeRevisions($user_id);
> > >
> > > > I didn't test that, but it seems logical.
> > >
> > > > Matt Bowden
> > >
> > > > On Feb 22, 2:30 pm, "Renan Gonçalves" <[EMAIL PROTECTED]>
> > wrote:
> > > > > Hello!
> > >
> > > > > I have a application that has two main models (User and Revision
> > with
> > > > > relationship User has many Revision).
> > > > > I wanna to get all Revision that this User revised and all
> > Revision that
> > > > > this User don't revised. There are a way to get this information
> > using
> > > > the
> > > > > relationships?
> > >
> > > > > Thanks!
> > > > > --
> > > > > Renan Gonçalves - Software Engineer
> > > > > Cell Phone: +55 (11) 8633-6018
> > > > > MSN: [EMAIL PROTECTED]
> > > > > Web Site: renangoncalves.com
> > > > > São Paulo - SP/Brazil
> > >
> > > --
> > > Renan Gonçalves - Software Engineer
> > > Cell Phone: +55 (11) 8633-6018
> > > MSN: [EMAIL PROTECTED]
> > > Web Site: renangoncalves.com
> > > São Paulo - SP/Brazil
> > > >
> >
>
>
> --
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 (11) 8633-6018
> MSN: [EMAIL PROTECTED]
>
> Web Site: renangoncalves.com
> São Paulo - SP/Brazil
>



-- 
Renan Gonçalves - Software Engineer
Cell Phone: +55 (11) 8633-6018
MSN: [EMAIL PROTECTED]
Web Site: renangoncalves.c

Re: Ruby on Rails 2.0 Removed Scaffold Generation?

2008-02-23 Thread red

Just about scaffolding - they did not removed the generator.
Check this:
http://wiki.rubyonrails.org/rails/pages/Scaffold

Anyway changes in RoR 2.0 are big, but look at Cake 1.2 - some
tutorials from 1.1 also won't work. Every software sometimes get 'big
changes'.



On 23 Lut, 12:43, Baz <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> After much pressure from some of my peers and colleagues, I've decided to
> take a Ride on the Ruby on Rails train and see where it leads. The stupid
> train didn't get out of the station, that's where it leads.
>
> I was drawn to RoR for a number of reasons:
>
>1. Been hearing about it for ages.
>2. It's more "established"
>3. There are a MILLION plugins out there for it. And they are a breeze
>to "install".
>4. The console does a lot of generation (at least it used to)
>5. Got the Agile Web Dev. boo, and wanted to play with it.
>6. There's an IDE (RadRails) that ties into the console and the server
>and everything. Debugging is a breeze, nothing to install or configure, 
> just
>a few clicks. You could do all your "raking" straight from the IDE. It's
>shiny :D
>
> I was just trying to go through one of the basic tutorials in the book.
> After which, I would attempt to port some of my smaller CakePHP apps. To
> make a long story shortthe brilliant guys decided for the 2.0 release,
> they would remove scaffold generation (the equivalent of baking).
>
> Now there are all these fancy database migrations, etc, etc. And I'm sure
> they serve a very good purpose, but who gives a crap. I was already dreading
> the "interesting" syntax of Ruby, now they're telling me I need to basically
> write out my entire database structure into this "migration format" crap for
> EVERY TABLE?
>
> I mean, it's not hard, but I just don't wanna do it. What's the point of all
> those graphical database editors if I gotta go "generate model Post ... and
> a whole bunch of fields and definitions"? And it's not even SQL. So that's
> one thing I would have to learn before even being able to get started
> really.
>
> It was also interesting how ALL the tutorials referenced the old method of
> scaffolding. There was always a note at the top/bottom of the tut. saying
> "this may not work in 2.0", but they never said what exactly.
>
> I must say, I'm greatly disappointed. I'm still baffled actually. By all
> reports, RoR seemed to be highly automated, now they just pulled out a huge
> chunk of it. I'm sorry, if CakePHP ever pulled out the "bake" console, I'd
> have to shoot myself in the head.
>
> I should have known better. Fate brought me to CakePHP for reason. With all
> it's quirks, this is the most productive I've been.
>
> Sorry for the rant.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Inheriting attributes

2008-02-23 Thread MonkeyGirl

Hi.

I'm setting up some attributes that are arrays in inherited classes.
For example, in /app/app_model.php I have the $validate rules that
apply to some columns which appear in every table. Similarly, in /app/
app_controller.php I have some universal $paginate settings such as
the limit.

Now I'm trying to add to these universally applicable values in the
arrays with values specific to each model and controller. For example,
adding rules that are unique to each model and paginate settings
specific to each controller.

Does anyone here know the official, recommended, CakePHP-approved way
of adding new values to these existing arrays once they've been
inherited? I can't use $validate += array(stuff); outside of a method.
Would putting it in beforeValidate for the model, and a similar line
in beforeFilter for the controller, achieve what I'm after? I have the
feeling this technique *might* work, but I'd be doing it in a really
bad way.

Is there a clean, simple way of doing this? Sorry if it's in the
documentation. I had a quick look for it, but I'm not really sure what
to search for.

Thank you,
Zoe.
--~--~-~--~~~---~--~~
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: A negative hasMany

2008-02-23 Thread Renan Gonçalves
I can use a query like this:

SELECT r.* FROM revisions AS r WHERE r.id NOT IN (
   SELECT revision_id FROM user_has_revised WHERE user_id = $__cakeId__$
)

This must work if for each user execute this query. hasAndBelongsToMany
don't work because its fetchs a all relationship of all users on a unique
query.

I opened this ticket https://trac.cakephp.org/ticket/4204, so when I put a
limit its will work.


Thanks.

On Sat, Feb 23, 2008 at 6:28 AM, francky06l <[EMAIL PROTECTED]> wrote:

>
> How did you use the $__cakeId__$ in your finder query ?
>
> On Feb 23, 1:43 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > Sorry ..
> >
> > I wanna do a hasAndBelongsToMany relationship. Sorry for this..
> > I tried to use finderQuery, doing a find (one result) it's ok, but with
> > findAll don't runs...
> >
> > On Fri, Feb 22, 2008 at 10:21 PM, BlenderStyle <[EMAIL PROTECTED]>
> > wrote:
> >
> >
> >
> >
> >
> > > You might be able to do something like this in your Revision model:
> >
> > > function getNegativeRevisions($user_id) {
> > >$conditions = array('user_id' => '<> '.$user.id);
> > >return $this->findAll($conditions);
> > > }
> >
> > > Then, in your RevisionsController:
> > > $user_id = '5';
> > > $negative_revisions = $this->Revision->getNegativeRevisions($user_id);
> >
> > > I didn't test that, but it seems logical.
> >
> > > Matt Bowden
> >
> > > On Feb 22, 2:30 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > > > Hello!
> >
> > > > I have a application that has two main models (User and Revision
> with
> > > > relationship User has many Revision).
> > > > I wanna to get all Revision that this User revised and all Revision
> that
> > > > this User don't revised. There are a way to get this information
> using
> > > the
> > > > relationships?
> >
> > > > Thanks!
> > > > --
> > > > Renan Gonçalves - Software Engineer
> > > > Cell Phone: +55 (11) 8633-6018
> > > > MSN: [EMAIL PROTECTED]
> > > > Web Site: renangoncalves.com
> > > > São Paulo - SP/Brazil
> >
> > --
> > Renan Gonçalves - Software Engineer
> > Cell Phone: +55 (11) 8633-6018
> > MSN: [EMAIL PROTECTED]
> > Web Site: renangoncalves.com
> > São Paulo - SP/Brazil
> >
>


-- 
Renan Gonçalves - Software Engineer
Cell Phone: +55 (11) 8633-6018
MSN: [EMAIL PROTECTED]
Web Site: renangoncalves.com
São Paulo - SP/Brazil

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fatal error: ConnectionManager::getDataSource while switching dynamic database

2008-02-23 Thread Kotekar

Hi,

i have dynamic database switching logic in the model page

// theme.php code
requestURL = $_REQUEST['url'];
if(substr_count($this->requestURL, '/unicode'))
{
$this->useDbConfig = 'unicode';
parent::__construct();
}
else if(substr_count($this->requestURL, 
'/ansi'))
{

$this->useDbConfig = 'ansi';
parent::__construct();
}
else
{
header("Location: /modes/error");
}
}
}
//  Code Ends Here..

this logic works fine, if the enter the the url directly on the
browser address bar or the links on the same domian page.

if i have clicked from external site reference to this page, i get
this FATAL ERROR message "Fatal error:
ConnectionManager::getDataSource - Non-existent data source in /var/
www/html/cake/libs/model/connection_manager.php on line 113"

USE CASE to reproduce this error:

1. Try to open this URL by pasting on the browser address bar:
http://saadhaara.com/themes/home/ansi/kannada

2. you'll see few Notice / Warning message along with the HTML content
which is ansci based content (Not easy to read, its in indian
language), but this is the expected result

3. Now, Open this URL: http://kanlit.net/, and click the link
"saadhaara" which tries to load the same URL as specified above.

4. Now you'll find the FATAL ERROR message and no HTML content

I am wondering, what is the problem with this code. Its works fine in
my local setup of the site in all the USE CASES which specified above.

please provide some light on this, i appreciate your suggestion/
feedback.

Br,
Raghava Kotekar
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Ruby on Rails 2.0 Removed Scaffold Generation?

2008-02-23 Thread Baz
Hey all,

After much pressure from some of my peers and colleagues, I've decided to
take a Ride on the Ruby on Rails train and see where it leads. The stupid
train didn't get out of the station, that's where it leads.

I was drawn to RoR for a number of reasons:

   1. Been hearing about it for ages.
   2. It's more "established"
   3. There are a MILLION plugins out there for it. And they are a breeze
   to "install".
   4. The console does a lot of generation (at least it used to)
   5. Got the Agile Web Dev. boo, and wanted to play with it.
   6. There's an IDE (RadRails) that ties into the console and the server
   and everything. Debugging is a breeze, nothing to install or configure, just
   a few clicks. You could do all your "raking" straight from the IDE. It's
   shiny :D

I was just trying to go through one of the basic tutorials in the book.
After which, I would attempt to port some of my smaller CakePHP apps. To
make a long story shortthe brilliant guys decided for the 2.0 release,
they would remove scaffold generation (the equivalent of baking).

Now there are all these fancy database migrations, etc, etc. And I'm sure
they serve a very good purpose, but who gives a crap. I was already dreading
the "interesting" syntax of Ruby, now they're telling me I need to basically
write out my entire database structure into this "migration format" crap for
EVERY TABLE?

I mean, it's not hard, but I just don't wanna do it. What's the point of all
those graphical database editors if I gotta go "generate model Post ... and
a whole bunch of fields and definitions"? And it's not even SQL. So that's
one thing I would have to learn before even being able to get started
really.

It was also interesting how ALL the tutorials referenced the old method of
scaffolding. There was always a note at the top/bottom of the tut. saying
"this may not work in 2.0", but they never said what exactly.

I must say, I'm greatly disappointed. I'm still baffled actually. By all
reports, RoR seemed to be highly automated, now they just pulled out a huge
chunk of it. I'm sorry, if CakePHP ever pulled out the "bake" console, I'd
have to shoot myself in the head.

I should have known better. Fate brought me to CakePHP for reason. With all
it's quirks, this is the most productive I've been.

Sorry for the rant.

--~--~-~--~~~---~--~~
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: Auth Component - Should authError be displayed if session times out?

2008-02-23 Thread Baz
Set what in the login?

On Sat, Feb 23, 2008 at 3:02 AM, francky06l <[EMAIL PROTECTED]> wrote:

>
> Actually you could set this in your Login action itself (if
> empty($this->data)) ..
> Very simple :-)
>
> On Feb 22, 8:12 pm, Baz <[EMAIL PROTECTED]> wrote:
> > I have it dirt simple. In the login, I write the cookie. I set no
> expiration
> > on it. According to the docs, this will cause the cookie to expire when
> the
> > browser closes, which is perfect...
> >
> > and in beforeRender() NOT filter:
> >
> > function beforeRender()
> > {
> >$loggedIn = $this->Cookie->read('Auth.UserLogged');
> >if (!$this->Auth->user() && isset($loggedIn)){  // If not logged in,
> but
> > cookie says logged in
> >   del cookie
> >   set expired flash
> >}
> >
> > No complicationsThat's all I need.
> >
> > On Fri, Feb 22, 2008 at 12:10 PM, francky06l <[EMAIL PROTECTED]>
> wrote:
> >
> > > Actually I can make it more simple, I will think about and post
> > > more ...
> >
> > > On Feb 22, 7:01 pm, francky06l <[EMAIL PROTECTED]> wrote:
> > > > I have got it working, not tested all cases ...If Baz and
> EchoChargen
> > > > try, let me know problem and/or enhancements
> >
> > > > In UserController if login successful :
> >
> > > > $this->Cookie->write(array('user.logged' => 1), null, true, '+1
> > > > day');
> >
> > > > I suppose after one day we do not want "Session expired anymore". I
> > > > delete the Cookie value in logout action, but did not paste this
> > > > here ..
> > > > Note the Cookie parameters are set in AppController below..
> >
> > > > Now in AppController::beforeFilter
> >
> > > > $this->Cookie->domain = '';
> > > > $this->Cookie->name   = 'TESTAPP';
> > > > $this->Cookie->time   = '+30 days';
> >
> > > > if(isset($this->Auth))
> > > > {
> > > > if($this->name == 'Pages')  // we might want to test the
> > > > allowed action (in case of beforeFilter set them in Auth before
> > > > calling parent)
> > > > $this->Auth->allow('*');
> > > > else
> > > > {
> > > > $this->Cookie->startup();  // essential to
> be
> > > > able to read value
> > > > $step = $this->Cookie->read('User.logged');
> >
> > > >   if(!$this->Session->valid())
> > > >   {
> > > >   if($v == 1)
> > > >  {
> > > > $this->Cookie->write(array('User.logged' => 2),
> > > > null, true, '+5 minute');
> > > >// we give 5 minutes for the user to log in the
> > > > step after
> > > >  }
> > > >  }
> > > >  else
> > > > {
> > > >  if($v == 2)
> > > > {
> > > > $this->Session->setFlash("Session has expired",
> > > > 'default', array(), 'auth');
> > > > $this->Cookie->del("User.logged");
> > > >}
> > > >}
> >
> > > >   $this->Auth->loginAction = '/users/login';
> > > >   }
> >
> > > > That;'s about it ... seems to work ok ..Haven't try all cases I
> guess
> > > > with different expiration time on cookie values.
> >
> > > > hth
> > > > Franck
> >
> > > > On Feb 22, 6:03 am, Baz <[EMAIL PROTECTED]> wrote:
> >
> > > > > I've given upSessions expire and the redirect causes issues. I
> > > thought
> > > > > it was a bug, but it's not...Just an annoyance.
> >
> > > > > I don't know what's wrong with going the cookie route. With all
> the
> > > > > redirects, I really don't see a way around it.
> >
> > > > > On Thu, Feb 21, 2008 at 10:58 PM, EchoChargen <
> [EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > > I'm having a hard go of it on this still.  Has anyone else seen
> the
> > > > > > behavior above?
> > > > > > Francky - could you elaborate a little on your approach?
> > > > > > Thanks,
> > > > > > Jeremy
> >
> > > > > > On Feb 21, 12:30 am, francky06l <[EMAIL PROTECTED]> wrote:
> > > > > > > I have made it work, the only thing I had problem was the
> first
> > > time
> > > > > > > on the page but this can be fixed with Baz approach (Cookie).
> > > > > > > Baz if you pass twice in befoeFilter, you can detect it by
> setting
> > > a
> > > > > > > variable (maybe static) in beforeFiler ?
> >
> > > > > > > On Feb 21, 5:32 am, EchoChargen <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > Another thing of note, is if I run through the steps:
> > > > > > > > 1. login, get redirected to what I have in
> Auth->loginRedirect
> > > > > > > > 2. let session expire
> > > > > > > > 3. click a link to a protected action and get redirected to
> > > > > > Auth->loginAction, and in my case above get a flash message with
> > > "your
> >
> > > > > > > > session timed out."
> > > > > > > > 4. At this point, if I sit on the login page and let the
> session
> > > > > > > > timeout again, then submit the login format this point
> > > > > > Auth->authError is getting set, I get

Re: Auth Component - Should authError be displayed if session times out?

2008-02-23 Thread francky06l

Actually you could set this in your Login action itself (if
empty($this->data)) ..
Very simple :-)

On Feb 22, 8:12 pm, Baz <[EMAIL PROTECTED]> wrote:
> I have it dirt simple. In the login, I write the cookie. I set no expiration
> on it. According to the docs, this will cause the cookie to expire when the
> browser closes, which is perfect...
>
> and in beforeRender() NOT filter:
>
> function beforeRender()
> {
>$loggedIn = $this->Cookie->read('Auth.UserLogged');
>if (!$this->Auth->user() && isset($loggedIn)){  // If not logged in, but
> cookie says logged in
>   del cookie
>   set expired flash
>}
>
> No complicationsThat's all I need.
>
> On Fri, Feb 22, 2008 at 12:10 PM, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Actually I can make it more simple, I will think about and post
> > more ...
>
> > On Feb 22, 7:01 pm, francky06l <[EMAIL PROTECTED]> wrote:
> > > I have got it working, not tested all cases ...If Baz and EchoChargen
> > > try, let me know problem and/or enhancements
>
> > > In UserController if login successful :
>
> > > $this->Cookie->write(array('user.logged' => 1), null, true, '+1
> > > day');
>
> > > I suppose after one day we do not want "Session expired anymore". I
> > > delete the Cookie value in logout action, but did not paste this
> > > here ..
> > > Note the Cookie parameters are set in AppController below..
>
> > > Now in AppController::beforeFilter
>
> > > $this->Cookie->domain = '';
> > > $this->Cookie->name   = 'TESTAPP';
> > > $this->Cookie->time   = '+30 days';
>
> > > if(isset($this->Auth))
> > > {
> > > if($this->name == 'Pages')  // we might want to test the
> > > allowed action (in case of beforeFilter set them in Auth before
> > > calling parent)
> > > $this->Auth->allow('*');
> > > else
> > > {
> > > $this->Cookie->startup();  // essential to be
> > > able to read value
> > > $step = $this->Cookie->read('User.logged');
>
> > >   if(!$this->Session->valid())
> > >   {
> > >   if($v == 1)
> > >  {
> > > $this->Cookie->write(array('User.logged' => 2),
> > > null, true, '+5 minute');
> > >// we give 5 minutes for the user to log in the
> > > step after
> > >  }
> > >  }
> > >  else
> > > {
> > >  if($v == 2)
> > > {
> > > $this->Session->setFlash("Session has expired",
> > > 'default', array(), 'auth');
> > > $this->Cookie->del("User.logged");
> > >}
> > >}
>
> > >   $this->Auth->loginAction = '/users/login';
> > >   }
>
> > > That;'s about it ... seems to work ok ..Haven't try all cases I guess
> > > with different expiration time on cookie values.
>
> > > hth
> > > Franck
>
> > > On Feb 22, 6:03 am, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > I've given upSessions expire and the redirect causes issues. I
> > thought
> > > > it was a bug, but it's not...Just an annoyance.
>
> > > > I don't know what's wrong with going the cookie route. With all the
> > > > redirects, I really don't see a way around it.
>
> > > > On Thu, Feb 21, 2008 at 10:58 PM, EchoChargen <[EMAIL PROTECTED]>
> > wrote:
>
> > > > > I'm having a hard go of it on this still.  Has anyone else seen the
> > > > > behavior above?
> > > > > Francky - could you elaborate a little on your approach?
> > > > > Thanks,
> > > > > Jeremy
>
> > > > > On Feb 21, 12:30 am, francky06l <[EMAIL PROTECTED]> wrote:
> > > > > > I have made it work, the only thing I had problem was the first
> > time
> > > > > > on the page but this can be fixed with Baz approach (Cookie).
> > > > > > Baz if you pass twice in befoeFilter, you can detect it by setting
> > a
> > > > > > variable (maybe static) in beforeFiler ?
>
> > > > > > On Feb 21, 5:32 am, EchoChargen <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Another thing of note, is if I run through the steps:
> > > > > > > 1. login, get redirected to what I have in Auth->loginRedirect
> > > > > > > 2. let session expire
> > > > > > > 3. click a link to a protected action and get redirected to
> > > > > Auth->loginAction, and in my case above get a flash message with
> > "your
>
> > > > > > > session timed out."
> > > > > > > 4. At this point, if I sit on the login page and let the session
> > > > > > > timeout again, then submit the login format this point
> > > > > Auth->authError is getting set, I get redirected back to
> > Auth->loginAction
>
> > > > > > > and the flash.message.auth displays the message I have
> > configured for
> > > > > > > Auth->authError.
>
> > > > > > > This is repeatable for me.  Is this behavior anyone else has
> > seen?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "

Problems creating records Cake 1.2 on postgres

2008-02-23 Thread Bruce

I am working in Cake 1.2 with PHP5 and a postgres backend DB. When I
try to create records in any app I have tried, I get a warning then an
SQL error. The record seems to be created in the db, but with my
limited knowledge, it looks to me like cake is constructing an
incomplete SQL statement when trying to retrieve the ID of the record
just written.

Output is like:

Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
relation "public" does not exist [CORE/cake/libs/model/datasources/dbo/
dbo_postgres.php, line 122]

Code | Context
$sql=   "SELECT last_value AS max FROM "public""
 */
function _execute($sql) {
return pg_query($this->connection, $sql);

pg_query - CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line
122
DboPostgres::_execute() - CORE/cake/libs/model/datasources/dbo/
dbo_postgres.php, line 122
DboPostgres::execute() - CORE/cake/libs/model/datasources/
dbo_source.php, line 155
DboPostgres::fetchRow() - CORE/cake/libs/model/datasources/
dbo_source.php, line 269
DboPostgres::lastInsertId() - CORE/cake/libs/model/datasources/dbo/
dbo_postgres.php, line 355
DboPostgres::create() - CORE/cake/libs/model/datasources/
dbo_source.php, line 500
JobHistory::save() - CORE/cake/libs/model/model.php, line 1234
JobHistoriesController::add() - APP/controllers/
job_histories_controller.php, line 23
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 265
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 237
[main] - APP/webroot/index.php, line 84
Query: SELECT last_value AS max FROM "public"

Any suggestions?


--~--~-~--~~~---~--~~
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: A negative hasMany

2008-02-23 Thread francky06l

How did you use the $__cakeId__$ in your finder query ?

On Feb 23, 1:43 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> Sorry ..
>
> I wanna do a hasAndBelongsToMany relationship. Sorry for this..
> I tried to use finderQuery, doing a find (one result) it's ok, but with
> findAll don't runs...
>
> On Fri, Feb 22, 2008 at 10:21 PM, BlenderStyle <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > You might be able to do something like this in your Revision model:
>
> > function getNegativeRevisions($user_id) {
> >$conditions = array('user_id' => '<> '.$user.id);
> >return $this->findAll($conditions);
> > }
>
> > Then, in your RevisionsController:
> > $user_id = '5';
> > $negative_revisions = $this->Revision->getNegativeRevisions($user_id);
>
> > I didn't test that, but it seems logical.
>
> > Matt Bowden
>
> > On Feb 22, 2:30 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > > Hello!
>
> > > I have a application that has two main models (User and Revision with
> > > relationship User has many Revision).
> > > I wanna to get all Revision that this User revised and all Revision that
> > > this User don't revised. There are a way to get this information using
> > the
> > > relationships?
>
> > > Thanks!
> > > --
> > > Renan Gonçalves - Software Engineer
> > > Cell Phone: +55 (11) 8633-6018
> > > MSN: [EMAIL PROTECTED]
> > > Web Site: renangoncalves.com
> > > São Paulo - SP/Brazil
>
> --
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 (11) 8633-6018
> MSN: [EMAIL PROTECTED]
> Web Site: renangoncalves.com
> São Paulo - SP/Brazil
--~--~-~--~~~---~--~~
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: Model that is not tied to a table

2008-02-23 Thread jim starboard


Model Call backs are event related - this is not the way. I think what
I need are associations.


On Feb 22, 9:09 pm, John David Anderson <[EMAIL PROTECTED]>
wrote:
> On Feb 22, 2008, at 6:59 PM, jim starboard wrote:
>
>
>
> > "As far as I know, there's no need for multiple-table models "
>
> > Why? that seems overly simplistic.
>
> It is. :)
>
> > ORM should allow a data
> > representation where setting a single property might update several
> > tables.
>
> It does. Check into model callbacks in the manual.
>
> > Why should my controller need to access multiple models when I
> > should be able to access a single model that in turn references
> > several tables (or child models).
>
> It may, but you can set it up how you'd like. I can't recommend
> touching too many tables with a single operation - if your domain
> logic for a given set of data is strewn and shared between classes,
> it's harder to place things and fix problems.
>
> -- John
--~--~-~--~~~---~--~~
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: form->input label options

2008-02-23 Thread francky06l

b logica, you are right, vertical-align should be set on the
containing block, I was just answering on the syntax for passing
style..

On Feb 23, 1:38 am, "b logica" <[EMAIL PROTECTED]> wrote:
> Though vertical-align on the label doesn't affect the block, itself,
> but the content. It might not make a difference in some cases but it's
> important to know. IMO, it'd be better to style the block with margin,
> float, width, and friends.
>
> On Fri, Feb 22, 2008 at 6:44 PM, francky06l <[EMAIL PROTECTED]> wrote:
>
> >  or :
>
> >  $form->label('Model.field', array('style' => 'vertical-align: top;'))
>
> >  On Feb 22, 7:07 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> >  > What doctype are you using? I've never heard of a valign attribute for 
> > label.
>
> >  > You can set the class in the label() method:
>
> >  > $form->label('Model.field', array('class' => 'LabelClass'))
>
> > > On Fri, Feb 22, 2008 at 10:06 AM, Richard Ward <[EMAIL PROTECTED]> wrote:
> >  > > Hi all,
>
> >  > > How do you set the label options (valign) on a form->input tag 
> > generated
> >  > > through baking?
>
> >  > > I know how to change the label text:
> >  > >  $form->input('Model.field', array('label' => 'labelText'));
>
> >  > > Is there some option setting or must I recode it to:
>
> >  > > $form->label('Model.field', 'labelText', array('valign' => 'top'));
> >  > > $form->input('Model.field');
>
> >  > > Thanks,
> >  > >  Richard
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---