Re: session problems with cake 1.18 and CAKE_SECURITY=high?

2008-01-08 Thread Martin Schapendonk

On 1/7/08, beetlejuice [EMAIL PROTECTED] wrote:
 the data i wrote into the session when user successfully logged in are
 no longer available in the next page.

 do you have an idea ?

CAKE_SECURITY set to high also means that Cake checks the referer and
drops the session if it believes it is being tampered with.

A setup with a reverse proxy might trigger that behavior. Do you have
a reverse proxy in front of your 'real' webserver?

Try if lowering CAKE_SECURITY to medium solves the problem, although
I'm not quite sure what other security implications that might have.

Martin

-- 
  Martin Schapendonk, http://www.schapendonk.org/blog/

--~--~-~--~~~---~--~~
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: session problems with cake 1.18 and CAKE_SECURITY=high?

2008-01-08 Thread Martin Schapendonk

On 1/8/08, Davide [EMAIL PROTECTED] wrote:
 I've also tried with security HIGH, MEDIUM and LOW but none of them
 works. When I get back to 1.1.18 everything is ok.

This may be trivial, but the setting is case sensitive. Did you try
high, medium and low as well?

Martin

-- 
  Martin Schapendonk, http://www.schapendonk.org/blog/

--~--~-~--~~~---~--~~
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: session doesn't work if model file begins with blank line ?!

2008-01-08 Thread Martin Schapendonk

On 1/8/08, beetlejuice [EMAIL PROTECTED] wrote:
 must be because of some text output before header could be send ?

Yes, you must have seen that error.

ANY whitespace outside php-tags in models/controllers (and most other
Cake-files) can and usually will ruin your session.

Martin

-- 
  Martin Schapendonk, http://www.schapendonk.org/blog/

--~--~-~--~~~---~--~~
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: Composite Primary Keys

2007-11-09 Thread Martin Schapendonk

On 11/9/07, Mr-Yellow [EMAIL PROTECTED] wrote:
 Nice to know I just spent months designing a massive properly
 normalised and indexed database.
 Only to findout Cake doesn't support properly designed databases.

After designing the theoretical correct model, I always thought there
was an additional step apply any optimizations for the technical
implementation. Adding a surrogate primary key to each table belongs
to that category, if you want to use Cake.

I guess your design needs that little bit of extra Cake-tweaking.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 and Oracle throwing errors

2007-11-08 Thread Martin Schapendonk

On 11/6/07, Chris Thompson [EMAIL PROTECTED] wrote:
 This is for the reserved words table names.

Don't expect the dbo_oracle does not quote identifiers-problem to be
solved any time soon. I have emailed the author of dbo_oracle (Jeff
Loiselle) about this and besides his lack of time there are some
technical difficulties as well.

Your best bet is to use table/model names that do not conflict with
Oracle reserved words.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: findall on 3 models chained with belongsto

2007-11-05 Thread Martin Schapendonk

On 11/5/07, Claudia [EMAIL PROTECTED] wrote:
 b) The query is really inefficient: Example: If the first query
 returns 10 results we need 21 queries for in total (the join query and
 then 10 queries each for model2 and model3). We could get the same
 result by having only one query which uses a left join for joining
 model1 and model2 and another left join for joining model2 and model3.

Why is that a problem? Are you already suffering from performance problems?

Or do you think you *might* have a performance problem? Or you might
consider 21 queries not so nice.

First make it work, then make it faster. You can always revert to a
custom finder query if you happen to experience problems with the
amount of queries.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 1.2, AuthComponent: Call to a member function isAuthorized() on a non-object

2007-11-02 Thread Martin Schapendonk

On 10/30/07, a.php.programmer [EMAIL PROTECTED] wrote:
 $this-auth-authorize = 'controller';

I already had that, the error still appears.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



1.2, AuthComponent: Call to a member function isAuthorized() on a non-object

2007-10-29 Thread Martin Schapendonk

After updating to pre-beta r5875, my app fails after login with:

Call to a member function isAuthorized() on a non-object in
path\to\cakephp\cake\libs\controller\components\auth.php on line 414

I have an isAuthorized() function in AppController, which I thought
would be enough to prevent this error. I tried adding an
isAuthorized() function to every single controller as well, but the
error is still the same.

Any help is greatly appreciated.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Programming with controllers

2007-10-17 Thread Martin Schapendonk
2007/10/17, maschoen [EMAIL PROTECTED]:

  Perhaps the ´flash´ message would be appropriate?

 Thanks for the suggestion, but I don't think you understand the
 issue.   Which controller would I issue the flash message from?
 The login controller is where it needs to go, but doesn't know what
 the error message is.   The main controller knows the what the error
 message is, but issuing the flash message request from it would not
 put it where the html is rendered.

I'm not sure if I understand your architecture.

Correct me if I'm wrong:

You have SomeController, which has SomeAction, which renders SomeView.

SomeView includes a login section, which is rendered by, say
LoginController, action LoginForm (called by requestAction).

LoginForm is submitted to the LoginAction of LoginController.

LoginAction processes the data from LoginForm, and redirects back to
where it came from (SomeAction in SomeController).

If LoginAction would set a flash message, it is perfectly possible for
SomeView to show it (in fact, *any* view could render a flash message,
irregardless of the controller/action that set it).

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Oracle connectivity with CakePHP

2007-10-16 Thread Martin Schapendonk

2007/10/15, Kristopher [EMAIL PROTECTED]:
 I have been struggling to get CakePHP to communicate with an Oracle 9i
 database.  I have installed the 10g Instant Client and have created a
 batch file to run my Apache 2.2 server.  In this batch file I have set
 the following environnment variables:

 set ORACLE_BASE=D:\oracle
 set ORACLE_HOME=%ORACLE_BASE%\ora92
 set ORA_NLS=%ORACLE_HOME%\ocommon\nls\admin\data
 set ORA_NLS33=%ORACLE_HOME%\ocommon\nls\admin\data
 set NLS_LANG=UTF8

The Instant Client does not require you to have any ORACLE_* or NLS_*
environment variables.

Try the 10g's Easy Connect syntax:

class DATABASE_CONFIG {

var $default = array(
'driver' = 'oracle',
'persistent' = false,
'connect' = 'oci_connect',
'host' = '',
'login' = 'user',
'password' = 'password',
'database' = 'hostname:port/serviceName',
'prefix' = ''
);

}

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: about cakephp 1.2 development

2007-10-02 Thread Martin Schapendonk

2007/10/2, Adwin Wijaya [EMAIL PROTECTED]:
 is the alpha (current development) to the final version has something
 new to be added or just a bug testing ?

It's done when it's done.

Current 1.2.0 is still alpha, which means it isn't feature stable yet.
For example, I know for sure that the Auth component is still under
development. Look at open tickets in the trac.

The core team has already announced that the next release will have
beta status, which means: feature stable, bug fixing only.

Several people have reported fine results with the 1.2 nightly builds,
even on production sites. You might decide that running a nightly
build is an acceptable risk to you.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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, Auth-component and reverse proxies

2007-09-27 Thread Martin Schapendonk

2007/9/26, Martin Schapendonk [EMAIL PROTECTED]:
 Anyone knows what could be happening here?

Let's answer my own email (at least partially).

It is related to the CAKE_SECURITY setting. Changing this setting from
high to medium 'solved' the problem.

The documentation states: CakePHP session IDs are also regenerated
between requests if CAKE_SECURITY is set to 'high'..

So... regenerating session IDs in combination with a reverse proxy
doesn't seem to work.

Does lowering the CAKE_SECURITY setting have any other consequences
for security?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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, Auth-component and reverse proxies

2007-09-27 Thread Martin Schapendonk

2007/9/27, Martin Schapendonk [EMAIL PROTECTED]:
 It is related to the CAKE_SECURITY setting. Changing this setting from
 high to medium 'solved' the problem.

In the group archive I read CAKE_SECURITY set to high also checks the
referer, which would explain why it doesn't work with a reverse proxy
(since cake doesn't know of any reverse proxy in front of it).

Can anybody confirm this? The message was rather old (1+ years).

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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, Auth-component and reverse proxies

2007-09-26 Thread Martin Schapendonk

Hi,

Not sure if this is offtopic for the list, but I suspect it is (it
seems related to the Auth component).

Using Cake 1.2.0.5427alpha.

I have a Cake setup with a reverse proxy as frontend. This reverse
proxy passes all requests to the cakephp app on the backend webserver
and forwards all responses back to the browser. Both webservers are
Apache 2.2.x.

The app is working fine without authentication. If I enable the Auth
component, I never get past the login page! This is what happens:

- Login page is rendered
- I fill in a valid username/password combination
- Submit login page
- I get a redirect to the login succesful page (value of
$this-Auth-loginRedirect)
- ... and immediately another redirect to the login page again
- Login page is rendered

Anyone knows what could be happening here?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Really?  I just did one with $form-input('fieldname', array('values'
 = $array)) and it worked just fine.  Interesting...

Nope, doesn't work. Strange. When I look in
cake/libs/view/helpers/form.php, it mentions $options['options'] in
several places. I couldn't find any reference to $options['values'].

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Well, the array I passed in was one I created using generateList() so
 it had key = value pairs.  That might've made the difference.

Probably not, because I did also.

Controller: $audiences = $this-Activity-Audience-generateList();
View: echo $form-input('ade_id', array('options'=$audiences));

Are you using a nightly build? Did anything change between 5427alpha and today?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
  Probably not, because I did also.
 
  Controller: $audiences = $this-Activity-Audience-generateList();
  View: echo $form-input('ade_id', array('options'=$audiences));

 $values is the output of generateList()

 echo $form-input('field', array('label' = __('label', true),
 'values' = $values));

 and that works just fine.  Used it all over the place.

 So, I wonder who is right here...

I give up. 'values' doesn't work for me, 'options' does.
pr($audiences) shows me a nice key=value array.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Hey, I'm not saying you're wrong.  I'm just wondering why my method
 seems to work okay for me, and I'm using the latest bleeding-edge
 version of Cake 1.2.x.x.

I just tried bleeding edge Cake (r5676 of the 1.2.x.x branch). Still
the same result - options works, values doesn't.

I'm using Oracle as database, although I hope that should not matter.

I'll send you a small proof-of-concept (directly, not through the
list) that shows what code is working for me.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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() syntax for associations not following Cake conventions

2007-09-19 Thread Martin Schapendonk

2007/9/18, Chris Hartjes [EMAIL PROTECTED]:
  How should I change the call to $form-input() to show a select-list?
  The list with audiences is available to the view in variable
  $audiences.

 Try this code using 1.2.x.x

 $form-input('ade_id', array('values' = $audiences));

Thanks for pointing me in the right direction.

It was array('options'=$audiences) instead of values, but I found it.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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-input() syntax for associations not following Cake conventions

2007-09-18 Thread Martin Schapendonk

Hi,

Using latest cake alpha (r5427).

I have an association between two models that doesn't follow Cake
conventions (Activity belongsTo Audience and its counterpart
Audience hasMany Activity).

Cake's convention demands that the association is on
Activity.audience_id. In my case, it isn't, it's on Activity.ade_id.

I got my models/controllers set up to handle this. My view shows:

echo $form-input('ade_id');

FormHelper shows me a plain text box, but I expected a nice
select-list with all available audiences.

How should I change the call to $form-input() to show a select-list?
The list with audiences is available to the view in variable
$audiences.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: override dbo

2007-08-31 Thread Martin Schapendonk

Hi Jeff,

2007/8/30, Jeff Loiselle aka phishy [EMAIL PROTECTED]:
 I wrote the Oracle DBO. The version in the latest 1.2 nightly works
 and is supported. As Chris Hartjes said, if you have any problems with
 that version, submit a ticket to Trac. I would love to get more Oracle
 people on board. Please let us know if you have any further problems.

I'm on board :-)

Looked at ticket 2024, hoped to solve it with ticket 3159 but that was
a terrible mistake :-(

I'm thinking about a robust solution to quoting identifiers in Oracle,
so that it is no problem to use Oracle reserved words (it is most
obvious with any example that has a User-model).

Is that on your todo-list as well? Are there any other unresolved
issues that I might be able to help with?

Regards,
Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Why can't AddModule statement can't be added to htpd.conf????????

2007-08-30 Thread Martin Schapendonk

2007/8/29, SIXS [EMAIL PROTECTED]:
 Hi, When I add the AddModule statement to httpd.conf and I restart the
 server it doesn't restart successfully.
 Any ideas?

Check your errorlog or run 'apachectl configtest'.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: override dbo

2007-08-28 Thread Martin Schapendonk

2007/8/28, Adwin Wijaya [EMAIL PROTECTED]:
 After using a dbo_odbc for a day .. i decided not to use it ... it is
 unstable for me .. and many bugs found in there :(
 i also cannot use cake for my project :(

Have you tried the native dbo_oracle.php?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Efficiency of database driven sessions

2007-08-15 Thread Martin Schapendonk

2007/8/14, Pillow [EMAIL PROTECTED]:
 However, it also have disadvantages - each $this - Session - read/
 write(); equals one database query. I use sessions very often, so
 number of queries to database on every request has risen rapidly.

Just give it a try.
30.000 sessions a day shouldn't be a problem for any decent database.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Calling stored procedures

2007-07-19 Thread Martin Schapendonk

Hi,

What would be a nice way to call stored procedures and capture their
output/return value from CakePHP?

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Silly HTTPS quesiton...

2007-04-20 Thread Martin Schapendonk

2007/4/20, Paul Webster [EMAIL PROTECTED]:
 Like I said, this may not be the best practice way to do it, but to me
 it did it good enough given the situation I was addressing. Criticism
 and feedback most welcome.

With that solution, you might experience browser security warnings
when posting forms to a URL that's being redirected.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 and Version control Poll

2007-03-09 Thread Martin Schapendonk

2007/3/8, Sonic Baker [EMAIL PROTECTED]:
 I take it this means you use  the vendors directory in the root of the repo
 for the initial vendor drops, then tag each drop and merge the changes
 between 'current' and the previous tag into the vendors directory in the
 cake or app directoies, e.g.

 repo
 trunk
 app
 controllers
 
 
 vendors -
 cake   |-- changes merged from below into here
 vendors  ---

 branches
 tags
 vendor vendor drops of cake, external calsses etc go here
 cake
 current
 1.1.2.xxx
 1.1.3.xxx
 etc...
 some_lib
 current
 1.0.1
 1.1.2
 etc...
 Is this along the lines of what you're doing?


That is exactly how I laid out my repository. Cake as well as other
external libs go in the vendors-dir in the repository, loaded by
svn_load_dirs. I drop the entire Cake-archive, including app and cake.

I then merge changes between previously-current and current into the trunk.

Any changes to the app-skeleton (or changes in default configuration
files in app - consider an extra configuration option) will be merged
in as well (of course, I'm extra cautious with any merge that changes
something in app/).

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: New Cake FAQ

2007-03-09 Thread Martin Schapendonk

2007/3/8, nate [EMAIL PROTECTED]:
 We're putting together an official CakePHP FAQ.  So add your
 recommended frequently asked questions (and answers) here:
 https://trac.cakephp.org/ticket/1576

Q: Why does Cake mess up my website in browser XYZ?

A: It's not Cake's fault - check your views and layouts to track down
any browser incompatibilities in the rendered HTML.


Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: apache virtual host set up, mirror cake route to another domain

2007-02-27 Thread Martin Schapendonk

2007/2/27, Jon Bennett [EMAIL PROTECTED]:
 www.blog-domain.com is a mirror of www.domain.com/blog

 is that possible?

 We had originally tried a .htaccess redirect, but that caused issues
 with the standard cake rules:

It would be far easier to configure blog-domain.com to live on another
VirtualHost than to try to integrate the redirect and the cake site on
1 virtual host.

This VirtualHost config just contains a Redirect:

Redirect / http://www.domain.com/blog/


Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: apache virtual host set up, mirror cake route to another domain

2007-02-27 Thread Martin Schapendonk

2007/2/27, Jon Bennett [EMAIL PROTECTED]:
 RewriteCond %{HTTP_REFERER} ^http://(www.)?blogdomain.com [NC]
 RewriteRule (.*) http://www.domain.com/blog/$1 [R=301,L]

 which worked, except we had no CSS or images, anyone got any ideas how
 I can get them working?

I can't believe I missed that the first time, but I think you should
check %{HTTP_HOST} instead of %{HTTP_REFERER}.

RewriteCond %{HTTP_HOST} ^(www.)?blogdomain.com$ [NC]
RewriteRule (.*) http://www.domain.com/blog/$1 [R=301,L]


Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Recursive model

2007-02-26 Thread Martin Schapendonk

Hi there,

Using CakePHP 1.2 (r4451).

I have a model Study that references itself (three attributes: id,
parent_id, name). The Model is defined as follows (extra stuff removed
for simplicity):

?php
class Study extends AppModel {
  var $name = 'Study';
  var $hasMany = array(
'Study' = array(
  'associationForeignKey' = 'parent_id'
)
  );
  var $belongsTo = array(
'Study' = array(
  'foreignKey' = 'parent_id'
)
  );
}
?

I use a scaffolding controller to get up and running quickly. The
controller doesn't show me any Studies, and the debug log tells me:

SELECT `Study`.`id`, `Study`.`parent_id`, `Study`.`naam`,
`Study`.`id`, `Study`.`parent_id`, `Study`.`naam` FROM `studies` AS
`Study` LEFT JOIN `studies` AS `Study` ON `Study`.`parent_id` =
`Study`.`id` WHERE (1 = 1) LIMIT 20

Error: 1066: Not unique table/alias: 'Study'

Which seems rather logical, since the SQL query contains the alias
'Study' twice.

Am I doing something wrong, or should I report a ticket?

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Share a sequence between two tables

2007-02-26 Thread Martin Schapendonk
2007/2/26, Gonçalo Marrafa [EMAIL PROTECTED]:
 Hi have two tables in my database that get their id's from the same
 sequence. The problem is that when i try to insert records in either of
 them cake tries to get the record's id by selecting the nextval for
 tablename_id_seq, which isn't correct.

You don't mention it, but I assume you use Oracle based on the fact
you mention sequences. You also don't mention the Cake version and the
database driver you use.

The dbo_oracle.php in Cake 1.2 seems OK. Did you try to use that one?

Regards, Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Share a sequence between two tables

2007-02-26 Thread Martin Schapendonk
2007/2/26, Martin Schapendonk [EMAIL PROTECTED]:
 2007/2/26, Gonçalo Marrafa [EMAIL PROTECTED]:
  Hi have two tables in my database that get their id's from the same
  sequence. The problem is that when i try to insert records in either of
  them cake tries to get the record's id by selecting the nextval for
  tablename_id_seq, which isn't correct.

 You don't mention it, but I assume you use Oracle based on the fact
 you mention sequences. You also don't mention the Cake version and the
 database driver you use.

 The dbo_oracle.php in Cake 1.2 seems OK. Did you try to use that one?

Sorry, that was only half an answer if I reread your mail.

The dbo_oracle.php in Cake 1.2 seems to retrieve sequence.currval, and
not sequence.nextval. If any Cake code retrieves sequence.nextval to
determine the lastInsertId, I guess it would be an error and you
should report it in Trac (trac.cakephp.org).

To make ID generation transparant for Cake, you could easily create
two synonyms table1_id_seq and table2_id_seq for the underlying
sequence. This way, both tables can have IDs generated by one
sequence.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 version numbering and SVN revision numbers

2007-01-24 Thread Martin Schapendonk

2007/1/23, Larry E. Masters aka PhpNut [EMAIL PROTECTED]:
 I have an explanation on the version numbering I use.
 https://trac.cakephp.org/wiki/Developement/VersionNumbers

 Yes the last number in the release version is the actual revision number of
 the subversion check out.

Thanks, sorry for not finding the version numbering scheme myself...

Right now, I see many changes being applied to branches/1.2.x.x. When
will those changes be applied to the trunk?

Or is it better to use branches/1.2.x.x instead of trunk/1.2.x.x for
dev versions?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 version numbering and SVN revision numbers

2007-01-23 Thread Martin Schapendonk

2007/1/22, dkarlson [EMAIL PROTECTED]:
 Yes. I checked out rev 4205 from
 https://svn.cakephp.org/repo/trunk/cake/1.1.x.x and compared it against
 the zip file of 1.1.12.4205 I got from cakeforge. They are identical.

And could somebody of the cakephp team shine their light on the
question if this is always the case? For any given release, can I
checkout that particular revision of the trunk and expect it to be
identical to the release?

Thanks, Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 version numbering and SVN revision numbers

2007-01-21 Thread Martin Schapendonk

Hi all,

CakePHP releases include the SVN revision number in their name (e.g.
1.1.12.4205).

Does this also mean If you checkout the trunk as of revision 4205,
you get the same files as CakePHP release 1.1.12?

Thanks,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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.1.11.4064, thawed and redelivered better than before.

2007-01-12 Thread Martin Schapendonk
Felix and the rest,

I have tried your suggestion to create a vendor branch. I have a
directory with cake setup as svn:externals, however, if I try to copy
and commit it, I get the following error:

[EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn update

Fetching external item into '1.2.x.x'
External at revision 4273.

At revision 26.

[EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn copy 1.2.x.x/ 1.2.x.x.4273/
A 1.2.x.x.4273

[EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn commit
Adding cakephp/1.2.x.x.4273
svn: Commit failed (details follow):
svn: PROPFIND request failed on '/repo/trunk/cake/1.2.x.x'
svn: PROPFIND of '/repo/trunk/cake/1.2.x.x': 405 Method Not Allowed
(https://dev.schapendonk.org)
svn: Your commit message was left in a temporary file:
svn:'/home/martin/findem/vendor/svn-commit.tmp'
[EMAIL PROTECTED]:~/findem/vendor/cakephp$

The path /repo/trunk/cake/1.2.x.x refers to CakePHP's svn repository!
It seems that svn copy remembers where it got the files from.

What is the proper way to tag a directory that is a svn:externals?

2006/12/4, Felix Geisendörfer [EMAIL PROTECTED]:


 Hey Felix, really good suggestion... I'm going to try implementing this.
 However, I would I manage changes to files inside app/webroot (as you said)
 considering they're out of the vendor package?
  Nothing is out of the vendor package ; ). A complete copy of the latest
 version of CakePHP always rests in /vendors/cakephp/current. When a new
 CakePHP version is released, you checkout /vendors/cakephp/current and
 simply copy the new version over the old one. If files were removed you have
 to delete them manually (via SVN), but that doesn't happen very often. Then
 you commit the new version. After that you tag it in /vendors/cakephp (in
 our case as r4064). After that you simply merge the changes between the last
 CakePHP version (r3825) and the current one (r4064) into /trunk (your
 working copy of it). In case things inside /app have changed, *only* those
 changes will be applied, no custom mods will be overwritten. After merging
 the update in, you commit /trunk and voila, you updated CakePHP.

  For a better understanding checkout a typical vendor branch folder layout:

  vendors
  |---cakephp
  |---|---r4064
  |---|---|---app
  |---|---|---docs
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---current
  |---|---|---app
  |---|---|---docs
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---r3825
  |---|---|---app
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---|---VERSION.txt

  I hope that helps.

  -- Felix

 --
  http://www.thinkingphp.org
  http://www.fg-webdesign.de

  Marcelo de Moraes Serpa wrote:

  Well, most of the times replacing the /cake folder will be enough.
 Sometimes however, files inside /app change, like /app/webroot/index.php. In
 those cases you should replace them as well to be on the safe side.
 
  In order to see what has changed in those files you can check the SVN
 difference between your local version and the one you intent to upgrade to.
 The best way to get this hassle out of your life is to manage your project
 in SVN and to use a vendor branch for CakePHP. This makes updating very easy
 and I highly recommend it.



  Hey Felix, really good suggestion... I'm going to try implementing this.
 However, I would I manage changes to files inside app/webroot (as you said)
 considering they're out of the vendor package?



 On 12/4/06, Claudio Poli  [EMAIL PROTECTED] wrote:
 
  I'm having some problem..
  In an application I've loaded a bunch of model into app_controller.php
  like
  var $uses = array('Blah', 'Etc');
  to be available in every controller; after the upgrade into every
  controller I go CakePHP tells me that he wants a model with the same
  name as the controller.
  for example I've a Welcome controller that do not have any model but
  uses an Article model.
 
  what's going wrong here?
 
  thanks
 
 
 




  



-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
 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.1.11.4064, thawed and redelivered better than before.

2007-01-12 Thread Martin Schapendonk
Yeah, that helps :-)

I thought I could take the easy route by not using svn_load_dirs,
but svn:externals instead.

Just an idea that pops up: I can simply update cakephp in the trunk by
merging directly from the svn:externals directory:

[EMAIL PROTECTED]:~/findem/trunk$ svn merge -r4272:4273
../vendor/cakephp/1.2.x.x/ cakephp/

(supposed that the last version I integrated was revision 4272 and I
wanted to merge revision 4273 in the trunk)

Regards, Martin

2007/1/12, Felix Geisendörfer [EMAIL PROTECTED]:

  Hey Martin,

  vendor branching means that you *do not* use svn:externals but update the
 vendor branch manually from time to time yourself.

  This page has all information about this process:
 http://svnbook.red-bean.com/en/1.1/ch07s05.html

  Let me know if that helps,
  -- Felix Geisendörfer aka the_undefined

 --
  http://www.thinkingphp.org
  http://www.fg-webdesign.de


  Martin Schapendonk wrote:
  Felix and the rest,

 I have tried your suggestion to create a vendor branch. I have a
 directory with cake setup as svn:externals, however, if I try to copy
 and commit it, I get the following error:

 [EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn update

 Fetching external item into '1.2.x.x'
 External at revision 4273.

 At revision 26.

 [EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn copy 1.2.x.x/ 1.2.x.x.4273/
 A 1.2.x.x.4273

 [EMAIL PROTECTED]:~/findem/vendor/cakephp$ svn commit
 Adding cakephp/1.2.x.x.4273
 svn: Commit failed (details follow):
 svn: PROPFIND request failed on '/repo/trunk/cake/1.2.x.x'
 svn: PROPFIND of '/repo/trunk/cake/1.2.x.x': 405 Method Not Allowed
 (https://dev.schapendonk.org)
 svn: Your commit message was left in a temporary file:
 svn: '/home/martin/findem/vendor/svn-commit.tmp'
 [EMAIL PROTECTED]:~/findem/vendor/cakephp$

 The path /repo/trunk/cake/1.2.x.x refers to CakePHP's svn repository!
 It seems that svn copy remembers where it got the files from.

 What is the proper way to tag a directory that is a svn:externals?

 2006/12/4, Felix Geisendörfer [EMAIL PROTECTED]:


  Hey Felix, really good suggestion... I'm going to try implementing this.
 However, I would I manage changes to files inside app/webroot (as you said)
 considering they're out of the vendor package?
  Nothing is out of the vendor package ; ). A complete copy of the latest
 version of CakePHP always rests in /vendors/cakephp/current. When a new
 CakePHP version is released, you checkout /vendors/cakephp/current and
 simply copy the new version over the old one. If files were removed you have
 to delete them manually (via SVN), but that doesn't happen very often. Then
 you commit the new version. After that you tag it in /vendors/cakephp (in
 our case as r4064). After that you simply merge the changes between the last
 CakePHP version (r3825) and the current one (r4064) into /trunk (your
 working copy of it). In case things inside /app have changed, *only* those
 changes will be applied, no custom mods will be overwritten. After merging
 the update in, you commit /trunk and voila, you updated CakePHP.

  For a better understanding checkout a typical vendor branch folder layout:

  vendors
  |---cakephp
  |---|---r4064
  |---|---|---app
  |---|---|---docs
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---current
  |---|---|---app
  |---|---|---docs
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---r3825
  |---|---|---app
  |---|---|---cake
  |---|---|---vendors
  |---|---|---index.php
  |---|---|---.htaccess
  |---|---|---VERSION.txt

  I hope that helps.

  -- Felix

 --
  http://www.thinkingphp.org
  http://www.fg-webdesign.de

  Marcelo de Moraes Serpa wrote:



  Well, most of the times replacing the /cake folder will be enough.

  Sometimes however, files inside /app change, like /app/webroot/index.php.
 In
 those cases you should replace them as well to be on the safe side.


  In order to see what has changed in those files you can check the SVN

  difference between your local version and the one you intent to upgrade to.
 The best way to get this hassle out of your life is to manage your project
 in SVN and to use a vendor branch for CakePHP. This makes updating very easy
 and I highly recommend it.



  Hey Felix, really good suggestion... I'm going to try implementing this.
 However, I would I manage changes to files inside app/webroot (as you said)
 considering they're out of the vendor package?



 On 12/4/06, Claudio Poli  [EMAIL PROTECTED] wrote:


  I'm having some problem..
 In an application I've loaded a bunch of model into app_controller.php
 like
 var $uses = array('Blah', 'Etc');
 to be available in every controller; after the upgrade into every
 controller I go CakePHP tells me that he wants a model with the same
 name as the controller.
 for example I've a Welcome controller that do not have any model but
 uses an Article model

Re: Can CakePHP do this? - Two

2007-01-04 Thread Martin Schapendonk


2007/1/3, skyblueink [EMAIL PROTECTED]:

I have no choice but to call $this-set() one thousand times in
Controller, and write foreach statement one thousand times in View.


Maybe you could make myfunction() a little bit more intelligent?

function myfunction($i) {
  switch($i)
  {
case 1:
  $result[0] = 'lemon';
  $result[1] = 'banana';
  $result[2] = 'apple';
  $return = array('title' = 'Fruits are here', 'things' = $result);
  break;
case 2:
  $result[0] = 'lion';
  $result[1] = 'tiger';
  $result[2] = 'monkey';
  $return = array('title' = 'Animals are here', 'things' = $result);
  break;
case 3:
  $result[0] = 'red';
  $result[1] = 'blue';
  $result[2] = 'green';
  $return = array('title' = 'Colors are here', 'things' = $result);
  break;
  }
  return $return;
}

Your controller can call myfunction() any number of times you like,
collect all arrays and make them available to the view.

In the controller:

function pass() {
  $result = array();
  for ($i = 1; $i = 3; $i++) {
 $result[] = $this-Test-myfunction($i);
  }
  $this-set('results',$result);
}



In the view:

foreach($results as $result) {
 echo Header: . $result[title];
 foreach($result[things] as $thing) {
   echo $thing;
 }
}

Not quite sure what you are trying to accomplish, however.

Martin

--
 Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Can CakePHP do this? - Two

2007-01-04 Thread Martin Schapendonk


In that case, my solution won't help you very much. Output is only
sent to the browser after the view is generated. You may be able to
speed up that process, but it is still being sent to the browser
afterwards.

Perhaps you can use AJAX for partial rendering, or cache the results
(or a combination of both).

Martin


--
 Martin Schapendonk, [EMAIL PROTECTED]

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

2006-12-06 Thread Martin Schapendonk

2006/12/6, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 Maybe you're right, but cake suport transactions, and locking should be
 (If the SQL engine can).
 http://dev.mysql.com/doc/refman/5.0/en/transactional-commands.html

The first question that pops up is: why, oh why?

I can't imagine the real life situation where you actually want an
entire table to be locked. Maybe only for specific maintenance issues,
but not in production code on a live web server.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
 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: Planning on CakePHP future versions

2006-10-25 Thread Martin Schapendonk

2006/10/25, Dr. Tarique Sani [EMAIL PROTECTED]:
 I am now curious as to where we did not play by the rules in the above
 two cases :)

I suppose you should have filed a ticket in Trac (http://trac.cakephp.org/).

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: URL's

2006-10-15 Thread Martin Schapendonk

2006/10/16, phpcoder [EMAIL PROTECTED]:
 Yes it does load the page with a trailing slash, so it appears to be
 getting closer :-)

You probably have things set up with an Alias. And this Alias probably
has a trailing slash in your configuration file.

Alias-es are very picky about trailing slashes. If you specify them in
your configuration, they are required. Remove the trailing slash,
restart Apache and tell us if things are working.

Quote from http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias

Note that if you include a trailing / on the url-path then the server
will require a trailing / in order to expand the alias. That is, if
you use Alias /icons/ /usr/local/apache/icons/ then the url /icons
will not be aliased.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Mutually exclusive associations

2006-10-13 Thread Martin Schapendonk

On 10/13/06, gremlin [EMAIL PROTECTED] wrote:
 Keep addresses in an address table.
 A join table could connect contacts to addresses   -  likewise for
 companies and addresses.
 Disallowing a company to have the same address as a contact is going to
 eventually bite you in the ass. I for one do private contract work from
 my home. My own companies address is my home address. I could be a
 contact REQIURING a company address identical to my personal one.

Sure, but I don't rule out the possibility of two
contacts/organizations having an identical address. But if they do, I
want those addresses to be separate tuples in the addresses relation.

Suppose your business grows and gets too big for your home. You want
to update your companies address, but not your home address. That's
not possible if both tuples point to the same address tuple.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Mutually exclusive associations

2006-10-12 Thread Martin Schapendonk

On 10/11/06, AD7six [EMAIL PROTECTED] wrote:
 However, strictly speaking it does not provide any way to prevent an
 Address to belong to a Person and an Organization at the same time.

 ?

 If on the address table there are 2 fields 'class' and 'foreign_id'
 which are used to define to which class and object the address relates
 it is not possible for the same address to point to more than one
 person/org. If you are defining in the person/org class which is their
 address by setting a field named address_id the foreign key is in the
 wrong table.

In that case, you're right.

I was thinking about an addresses table with two columns person_id
and organization_id. This does not prevent an address from belonging
to an organization and a person at the same time.

I think the foreign_id column pointing to either persons or
organizations is not such a nice solution, since it removes the
possibility of having a foreign key relation in the database.

In the database (in my case, usually Oracle) I would implement things
with an optional foreign key relation and a check constraint that
specifies that only one of the two columns may be filled. I was
looking for some similar functionality in CakePHP.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Mutually exclusive associations

2006-10-06 Thread Martin Schapendonk

On 10/6/06, AD7six [EMAIL PROTECTED] wrote:
 Going from a Person/Organisation to an address should be fairly easy:
 Person/Org
var $hasMany = array(
'Comment'=array(
foreignKey=foreign_id,

 conditions=`Comment`.`class`='person',
dependent=true,
)
);

How nice! I overlooked that I can specify $conditions on an association.

However, strictly speaking it does not provide any way to prevent an
Address to belong to a Person and an Organization at the same time.

Maybe I should implement a type attribute after all... but I didn't
want to do that, since I considered it a derived column (person_id
filled -- type = person, organization_id filled -- type =
organization).

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Mutually exclusive associations

2006-10-05 Thread Martin Schapendonk

Hi all,

Is there a way to tell Cake that any model A belongsTo model B OR
model C, but NOT to B and C at the same time? (consider an Address
which can only belong to a Person or an Organization).

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Mutually exclusive associations

2006-10-05 Thread Martin Schapendonk

On 10/6/06, Grant Cox [EMAIL PROTECTED] wrote:
 Why not just make your Person and Organization have address_id fields
 (ie Person belongsTo Address), and forget about the reverse
 association?  Are you ever going to want to load an address with it's
 related Person/Organization, or are you just going to want to load a
 Person/Organization and get the related Address?

Because in my example, I didn't tell you that a Person/Organization
can have multiple addresses.

Or maybe I could solve this with a PersonAddress and
OrganizationAddress based on the same table? However, that would
violate DRY, because those models are going to be very, very similar.

Another idea: maybe I could implement this in a validation?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Autocomplete: show name, return id

2006-10-03 Thread Martin Schapendonk

shameless
  Bump.
/shameless

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Autocomplete: show name, return id

2006-10-02 Thread Martin Schapendonk

Hi all,

Imagine a table with two columns, id and name (for the sake of simplicity).

I would like to make an autocomplete-field, which allows the user to
pick a name, but include the value of id if the form is submitted.

Is this possible?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: More Fuel for the What Is A Model Debate

2006-09-27 Thread Martin Schapendonk

On 9/27/06, Chris Hartjes [EMAIL PROTECTED] wrote:
 Placing data validation and other data
 munging in the model seems to be the way of this definition.  Food for
 thought, that's for sure.

I second that. Data validation rules (or business logic/business
rules) should be enforced on your data at all times - that's their
nature. If you implement business logic in controllers, you run the
risk of duplicating yourself when you use the same model in another
controller.

Even worse, if you happen to forget the rules in the other controller,
or implement them slightly differently, your database may become
(functionally) corrupt.

Therefore, I would suggest to everybody to implement business logic as
close to the persistency layer as possible (*). For CakePHP, this
means the model.

Martin

(*) no offense, I know this might trigger a lot of opinions about
n-tier application architecture ...

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Is this the correct use of Models?

2006-09-27 Thread Martin Schapendonk

On 9/27/06, Jon Bennett [EMAIL PROTECTED] wrote:
 if you have setup an association between Posts and Comments, this info
 should already be there, try pr ($this-Post-findAll); in your
 controller to see what's there, because you should be able to jsut
 count() the comments, eg:

It seems a bad idea to me to do it like this from a performance point
of view. A findAll() fetches all rows from the database, while a
count(*) in the database returns only one row with the count.

Any recommendations from someone with more knowledge of the CakePHP core?

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Should I always define all associations?

2006-09-19 Thread Martin Schapendonk

On 9/19/06, Shutter [EMAIL PROTECTED] wrote:
 My main concern is optimization. It would seem easier to only enable
 certain associations during queries...but perhaps my thinking is
 off-base. How can this be optimized so that the application can scale
 well?

I think your thinking is off base ;-)

Associations are not only useful in case of retrieval - but think of
what would/should happen to a particular User's Posts if you happen to
delete that User.

Imho, the best thing to do would be to model all associations and use
$recursive where appropriate.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Need a Genius for this one!

2006-09-18 Thread Martin Schapendonk

On 9/18/06, ameshkin [EMAIL PROTECTED] wrote:
 But what I need to do, is somehow only show the results from the
 database where the birthday is in between two different ages.

Then do it in the database, not in PHP.

Assuming MySQL: year(current_date()) - year(date_of_birth) returns
almost someone's age. Almost, since it is one year too many if
someone's birthday hasn't passed yet in the current year. datediff()
comes to the rescue.

Read http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html
which will most likely give you enough information to build the query
on your own. And then you'll be your own genius :-)



-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Problem with Sql statements

2006-09-17 Thread Martin Schapendonk

On 9/17/06, M [EMAIL PROTECTED] wrote:
 1- $this-model-begin();
 2- $result = $this-model-save();
 3- $sql = 'call myprocedure()';
 4- $this-model-execute( $sql );
 5 -$this-model-commit();

 How can I structure the code to make the statements 2 and 4 atomic? I
 know I can test the return code for statement 2, but I don't know how
 to do it with statement 4.

The API states that execute() returns an array, but the stored
procedure might not return anything and still be okay. I don't know
what error will be returned by the database server. Maybe you have to
manually check for db errors and abort, depending on the result.

The code to manually check for db errors is regularly posted here,
search for nate and getdatasource and you should be fine.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: renderElement et son $params

2006-09-17 Thread Martin Schapendonk

On 9/17/06, bicephale [EMAIL PROTECTED] wrote:
 snip

I suspect you'll have more success if you post in English.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Displaying full name in (almost) every view

2006-09-14 Thread Martin Schapendonk

Thanks for all your suggestions.
I will definitely look into othAuth.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Messaging service

2006-09-13 Thread Martin Schapendonk

On 9/13/06, John Zimmerman [EMAIL PROTECTED] wrote:
 The other way to do it would be to create a cronjobs_controller.php that
 would have table called cronjobs full of tasks that needed to be executed
 and their corresponding schedules.  You could then setup a page to access in
 your controller that would check for tasks to execute.  You can then setup
 an actual cron job to access that part of the controller via a standard url
 using wget or possibly curl.  That way you know that you are checking for
 tasks to run on a regular schedule and not just on page requests.

I don't see the benefit of the extra roundtrip via the webserver?

Isn't it more clear to have a cronjob execute a script directly
instead of redirecting it through the webserver and an extra
controller? Moreover, your ISP could impose limits on maximum
execution time. Batch processing may very well take longer than the
timeout.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Displaying full name in (almost) every view

2006-09-13 Thread Martin Schapendonk

Hi all,

I'm trying to get a feeling on CakePHP best practices.

I'd like to show each logged in user his/her full name on every page.
So, there must be something like a User-model of the loggedin user
available to every view, right?

What would be the best way to accomplish this? I was thinking to add a
beforeRender to the app_controller which makes the User-model
available to every view.

Would that be the best/right thing to do?

Thanks,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Leverage Cake For File Downloads

2006-09-07 Thread Martin Schapendonk

On 9/6/06, Brandon [EMAIL PROTECTED] wrote:
 Cake to perform this renaming?  For instance, if a user goes to
 /audio/download/1, their download dialogue will read something like
 artist-title.mp3.

Google for the Content-Disposition header, that should get you going.


-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Noob: tablename singular ...y and plural ...ies ?

2006-09-06 Thread Martin Schapendonk

On 9/6/06, simb [EMAIL PROTECTED] wrote:
 I assume that cakephp has just a simple pattern that plurals are
 singulars with an s at the end, right?

Assumption is the mother of all f***ups :-)

Cake can handle a much greater variety of singulars and plurals. Take
a look at cake/libs/inflector.php and amaze yourself.

Plus, you can always customize pluralization for anything the normal
Inflector does not handle very well in app/config/inflections.php.

Regards, Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Route problem. How to ignore the action name?

2006-09-06 Thread Martin Schapendonk

On 9/6/06, nate [EMAIL PROTECTED] wrote:
 Right, you need to hard-code a route for each action.  I'm actually
 working on some Router enhancements that'll make this process a little
 easier.

Would this include the possibility to provide separate routes for
action names irrespective of the controller?

Explanation: I would like to use Cake's programming by convention as
much as possible, which pretty much ties me up to program in English.
However, I would like my URLs to appear in Dutch. It would be very
convenient if I could provide separate translations for actions (e.g.
'edit' = 'wijzig').

Then, for each action 'wijzig' (irrespective of the controller), the
'edit' action would be called and I wouldn't have to define a custom
route for each and every controller.

Regards, Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: OT: svn and new files

2006-09-06 Thread Martin Schapendonk

On 9/6/06, Martin [EMAIL PROTECTED] wrote:
 There must be a way to tell svn to go through my working copy and add
 all new files, right? I just cant find out how to do this.

Good reference material on SVN: http://svnbook.red-bean.com/

Quote: Normally, the command svn add * will skip over any directories
that are already under version control. Sometimes, however, you may
want to add every unversioned object in your working copy, including
those hiding deeper down. Passing the --force option makes svn add
recurse into versioned directories.

So, svn add * --force in the root of your working copy should take
care of anything beneath it that isn't under version control yet.

Regards, Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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



Re: Further Authorization Fun

2006-08-31 Thread Martin Schapendonk

On 8/31/06, MrTufty [EMAIL PROTECTED] wrote:
 The SQL I have managed to write to get the permissions for the
 usergroups that a user is part of is this, for anyone who is
 interested:

 SELECT permissions, type
 FROM permissions
 LEFT JOIN usergroups_permissions
 ON usergroups_permissions.permission_id = permissions.id
 WHERE usergroups_permissions.usergroup_id
 IN (
 SELECT usergroup_id
 FROM users_usergroups
 WHERE users_usergroups.user_id = ?
 );

 I could probably achieve everything I want to do with a UNION, but I
 havent yet looked into that, and from what I have read, theyre rather
 slow

Why the subquery?

select p.permission
, up.type
from permissions p
, usergroups_permissions up
, users_usergroups uu
where p.id = up.permission_id
and up.usergroup_id = uu.usergroup_id
and uu.user_id = ?


Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

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