Re: An idea to improve cake's code design

2007-09-04 Thread xephex

Okay, but how do you think about changing cake's architecture?


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



An idea to improve cake's code design

2007-09-03 Thread xephex

When reading throug CakePHP's code, an idea came to me and I wanted to
share it with you.
It became a bit more text than I thougt so I put it into a PDF.

http://cake-php.googlegroups.com/web/The+Factory+function.pdf

What do you think? Would it make sense to implement that?


--~--~-~--~~~---~--~~
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: $_SERVER['HTTTP_REFERERR'] or $_SERVER['PHP_SELF'] in CAKE ?

2007-08-22 Thread xephex

On 22 Aug., 12:42, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I have two controllers : slideshows and slides. One slideshow can have
 many slides.

 I'm editing my slideshow that have for example 9 slides :

 (photoslideshows/edit/1).

 Near each slide i have action from other controller : slides/delete/id
 so i can delete each photo from this slideshow.

 $html-link('Delete', /slides/delete/.$slide['Photoslide']['id'],
   null,'Jestes pewien?') .'br /' ;

 In my slides controller i have action:
 function delete($id)
 {
 $this-Photoslide-del($id);
 $this-flash('Slide with id: '.$id.'deleted', '/photoslideshows/
 slideshow_list');

 }

 After delete action i want to get back to my slideshow that i
 currently editing not to slideshow_list of  all slideshows.

 How to do this? Please help.

 In PHP i use $_SERVER['HTTTP_REFERERR']  or $_SERVER['PHP_SELF'] . How
 can i do this in CAKEPHP

$_SERVER['PHP_SELF'] wont help you - this has nothing to do with
referers.
You can use $_SERVER['HTTP_REFERER']
Or, you read the slides slideshow before deleting it. Then you delete
it and then you can redirect to the slideshow you read.


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



How do I write ´fieldA´ = ´fieldB´ in a condition using an array and not a string?

2007-08-22 Thread xephex

Hi all,

I got a ModelA that hasOne ModelB.
They aren't suppost like
ModelB.foreignKey = ModelA.id
as I need
ModelB.foreignkey = ModelA.otherField

I tried
class ModelA {
var $hasOne = array('ModelB'=array('conditions' = 'ModelB.foreignKey
= ModelA.otherField'));
}
This doesn't work because Cake produces:
ON (`ModelB`.`foreignKey` = `ModelA`.`otherField` AND
`ModelB`.`foreignKey` = `ModelA`.`id`)

I read DboSource::generateAssociationQuery() line 1094 and I know now
that I need something like:
class ModelA {
var $hasOne = array('ModelB'=array('conditions' =
array('ModelB.foreignKey' = 'ModelA.otherField'));
}
This of course doesn't work because 'ModelA.otherField' is treated as
a string and not as a field, which would be what I need.

So it comes down to this: How do I write ´fieldA´ = ´fieldB´ in a
condition using an array and not a string?


--~--~-~--~~~---~--~~
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: How do I write ´fieldA´ = ´fieldB´ in a condition using an array and not a string?

2007-08-22 Thread xephex

On 22 Aug., 16:32, AD7six [EMAIL PROTECTED] wrote:
 Whether it helps in the end is another matter, but the answer is..
I'm afraid it did not help. Thanks anyway.

In the meantime, i've found the solution:
var $hasOne = array('ModelB'=array('conditions' =
array('ModelB.foreignKey' = '-!\x60ModelA\x60.\x60otherField\x60'));

-! allows me to write direct SQL.

Somehow, my backticks became strange characters but replacing them by
\x60 solved this charset bug.


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