Re: unset unwanted fields

2007-09-14 Thread RichardAtHome

I may be misunderstanding your query, but can't you just remove the
fields from edit.ctp ?

Admin will still be able to change them in admin_edit.ctp

On Sep 14, 4:42 pm, bujanga <[EMAIL PROTECTED]> wrote:
> I think my question is just the result of a Friday brainlock but anyway.
>
> Is there a cake way to prevent unwanted fields being inserted into an
> edit form post?
> * Admin user is allowed to set $nologin to TRUE or FALSE
> * but Manager user is only allowed to view it.
> * Manager user is however allowed to change other items on the User model
> * Admin submits via admin_edit.ctp
> * while Manager submits through edit.ctp.
>
> Normally, I would discard all unwanted values. I can certainly do this
> here but is there a cake specific way that I am missing?
>
> Gary Dalton


--~--~-~--~~~---~--~~
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: please comment on my design decision

2007-09-03 Thread RichardAtHome

You're right, your design doesn't feel eligant ;-) It breaks the rules
of database normalisation.

Not that that is necessarily a bad thing, sometimes you have to break
normal form for the sake of performance.

Basically, what you are describing is: Profile -> hasMany -> Questions

If the same questions are used in many profiles, you have a: Profile -
> hasAndBelongsToMany -> Questions.

If you are storing answers to those questions, the answers would be
stored in the HABTM join table.

On Sep 1, 5:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> I am completing a project using cake where the application requires
> user profiles with several hundred, yes several hundred, questions/
> fields.  However, only about 20 of these are used in searching,
> sorting, etc., the rest are for display purposes only.
>
> So, I basically included those 20 main fields in my profiles table,
> and I added a text field called non_searcable.  Then I just serialize
> all the other fields and store them there, unserialize them for
> display.
>
> I have seen a design where a 2 column table is employed, field_name
> and field_value, and all these fields are stored in that way.  It just
> seems like a slow, painful method, and you end up with text type
> fields storing a string of 4 characters, storing numbers, etc.
>
> What do you think?  For some reason my design doesn't feel 'elegant',
> but it works, although is did require a little trickery on the edit
> actions and view actions, bet Set::merge was awesome!
>
> Anyway, just curious.  I put a lot of pressure on myself to come up
> with super engineered solutions, when often times I think small apps
> are over designed.
>
> TIA,
> Brian


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



Rails Envy

2007-08-25 Thread RichardAtHome

http://www.youtube.com/watch?v=GQXqWkWqnSw

I lol'ed :-D


--~--~-~--~~~---~--~~
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: Database constraint violation using save()

2007-08-23 Thread RichardAtHome

Also spotted this method today:

http://cakeexplorer.wordpress.com/2007/08/23/cakephp-12-custom-validation-unique-behavior/


On Aug 23, 9:58 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> http://bakery.cakephp.org/articles/view/checking-for-duplicate-record...
>
> On Aug 23, 9:39 am, Deniz Chaban <[EMAIL PROTECTED]> wrote:
>
> > Hi. I have a UNIQUE contraint on one of my fields in my database
> > table.
>
> > When using save() sometimes this constraint gets violated. MySQL then
> > returns an exception. How do I catch this exception so that I can show
> > the user a good error message?
>
> > I do not want to make a select query to see if that value is not
> > already in use before calling to save.
>
> > I can't find any information about this anywhere. Maybe this is just
> > impossible with PHP. I'm using cake 1.2 and PHP > 4.3.
>
> > Thanks,
> > Deniz


--~--~-~--~~~---~--~~
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: Database constraint violation using save()

2007-08-23 Thread RichardAtHome

http://bakery.cakephp.org/articles/view/checking-for-duplicate-records-unique-record


On Aug 23, 9:39 am, Deniz Chaban <[EMAIL PROTECTED]> wrote:
> Hi. I have a UNIQUE contraint on one of my fields in my database
> table.
>
> When using save() sometimes this constraint gets violated. MySQL then
> returns an exception. How do I catch this exception so that I can show
> the user a good error message?
>
> I do not want to make a select query to see if that value is not
> already in use before calling to save.
>
> I can't find any information about this anywhere. Maybe this is just
> impossible with PHP. I'm using cake 1.2 and PHP > 4.3.
>
> Thanks,
> Deniz


--~--~-~--~~~---~--~~
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 with different roles

2007-08-21 Thread RichardAtHome

What you have is:

A message has an author and a recipient. Both the author and recipient
are users so

Message Table:

id, Primary Key
author_id, Foreign Key to Users table
recipient_id, Foreign Key to Users table

Check out the docs for $belongsTo, you can tell cake that the
author_id field points Users.id and recipient_id points to Users.id
(the same or a different user).


On Aug 21, 4:04 pm, deepc <[EMAIL PROTECTED]> wrote:
> A question to habtm.
> I have an object message and user
> A message could be a sent or an received message and belongs to an
> user.
> Is it possible to model such different roles between the same object
> in cake?


--~--~-~--~~~---~--~~
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 with different roles

2007-08-21 Thread RichardAtHome

Meant to add, this is not a HABTM relationship unless you want to link
the message to multiple recipients and/or multiple authors

On Aug 21, 4:04 pm, deepc <[EMAIL PROTECTED]> wrote:
> A question to habtm.
> I have an object message and user
> A message could be a sent or an received message and belongs to an
> user.
> Is it possible to model such different roles between the same object
> in cake?


--~--~-~--~~~---~--~~
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: R: Auditing

2007-08-20 Thread RichardAtHome

If you are using a later version of MySQL (>= 5.0.2), you could add a
database trigger (ON UPDATE, ON DELETE, etc.) to log changes
automatically without having to change your code.

See: http://dev.mysql.com/doc/refman/5.0/en/triggers.html


On Aug 20, 11:59 am, <[EMAIL PROTECTED]> wrote:
> This my attempt to solve the problem (logfile is a table for auditing):
>
>   function beforeSave() {
> $this->currentAction = $this->id ? 'Update' : 'Insert';
> return true;
>   }
>
>   function afterSave() {
> // hope that this is not necessary
> // because cake has filled in the id after save
>
> if(!$this->id) {
>   $id = $this->getLastInsertId();
> } else {
>   $id = $this->id ;
> }
>
> /*
> ** Save Log
> **
> */
> loadModel("Logfile");
> $Logfile = new Logfile;
> $data['Logfile']['created']   = date("Y-m-d H:i:s");
> $data['Logfile']['tablename'] = $this->name;
> $data['Logfile']['tableid']   = $this->getLastUsedId();
> $data['Logfile']['username']  = @$_SESSION['cakeAuth']['login'];
> $data['Logfile']['action']= $this->currentAction;
> $data['Logfile']['ipaddress'] = @$_SERVER['REMOTE_ADDR'];
> $Logfile->save($data);
> $Logfile = null;
>
> $this->currentAction = '';
>
> return true;
>   }
>
>   function afterDelete() {
> /*
> ** save Log
> */
> loadModel("Logfile");
> $Logfile = new Logfile;
> $data['Logfile']['created']   = date("Y-m-d H:i:s");
> $data['Logfile']['tablename'] = $this->name;
> $data['Logfile']['tableid']   = $this->getLastUsedId();
> $data['Logfile']['username']  = @$_SESSION['cakeAuth']['login'];
> $data['Logfile']['action']= 'Delete';
> $data['Logfile']['ipaddress'] = @$_SERVER['REMOTE_ADDR'];
> $Logfile->save($data);
> $Logfile = null;
>
> return true;
>   }
>
> > -Messaggio originale-
> > Da: cake-php@googlegroups.com
> > [mailto:[EMAIL PROTECTED] Per conto di zipman
> > Inviato: lunedì 20 agosto 2007 12.42
> > A: Cake PHP
> > Oggetto: Auditing
>
> > Hello,
>
> > I have finished a project and now I want to add auditing
> > support, as to know when an update or delete occured and with
> > what parameters.
> > I guess the solution to my problem is the afterSave callback
> > which I'll have to put in the app_model.php. The problem is I
> > don't know how to access the parameters used for save (the
> > model on which the save function was called and with what
> > parameters). How can I do this?


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



Re: can't get index.php page to show in color and images

2007-08-20 Thread RichardAtHome

I had this problem myself only yesterday on my home (Windows) machine.

Here's the solution:

Don't change 

Look a little further down the conf file and you'll see another
directory section that points to your web root (e.g):



Make the changes there ;-)


On Aug 20, 1:07 am, "sixs" <[EMAIL PROTECTED]> wrote:
> HI,
> I'm trying cakephp again. I can get cakephp index.php page to display after 
> installing wamp and cakephp. I can get the message that it finds mysql 
> database.But I change the allowwrit is set to All in http[d.conf. as
>  
> Options FollowSymLinks
> AllowOverride All
> Order deny,allow
> Deny from all
> Satisfy all
> 
> If I uncomment this line I get an error line 106:
>
> #LoadModule rewrite_module modules/mod_rewrite.so
> What am I not doing
> 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: Practical effect of Mambo going with CakePHP?

2007-08-16 Thread RichardAtHome

The interesting part for me is that once Mambo is powered by PHP it
should be a heck of a lot easier to develop websites that require CMS
functionality.

Most of the websites I develop at the moment have CMS elements
(allowing the site owners to add new content, change content etc.)
with some custom coded areas: e.g. an event booking system.


On Aug 16, 2:35 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> > I'm sure that mambo going with cake is great from a feel good point of
> > view.
>
> > But, what practical benefit is there for cakephp developers? Will it
> > be easier for cake developers to develop mambo modules? Will mambo
> > modules be valuable for cake developers?
>
> I'd say a major bonus would be understanding how mambo is put
> together, which is quite hard now without a lot of work. Once it's
> cakeified, it will be pretty easy to get a view of what's going on.
> This will in turn make building modules much easier (will modules be
> replaced by cakephp plugins I wonder?), and just using it as a
> learning example to pick apart will be good.
>
> just me y 2p
>
> jb
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett


--~--~-~--~~~---~--~~
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 I access database or execute some sql inside views ?

2007-08-14 Thread RichardAtHome

Post the problem and lets see if we can help you out :-)

On Aug 14, 10:29 am, Wimg <[EMAIL PROTECTED]> wrote:
> correct,, i just have a problem do not how to solve


--~--~-~--~~~---~--~~
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: Link to a location on the same page

2007-08-13 Thread RichardAtHome

Better yet, (doesn't use an 'A' tag to mark up the destination:)

This is where I want to go

Send me there

On Aug 8, 11:42 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> Links to the same page do not require the full url so why not use straight
> html?
>
>  This is where I want to go
>
> Send me there
>
> Plain and simple.
>
> Geoff
>
> On 8/9/07, mussond <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I changed the name to be #Verbs but when I click it I get redirected
> > to the URL: /top_tiers/index#Verbs.  This page displays exactly like /
> > top_tiers/index would.
>
> > I don't know how I'd implement $html->link() because it asks for a URL
> > and an array but I want the same array.
>
> > Has anyone got any ideas or an example for the problem?
>
> > Dave
>
> > On Aug 7, 11:55 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> > > Bookmarks use #bookmarkName last time I checked.
>
> > > Geoff
> > > --http://lemoncake.wordpress.com
>
> > > On Aug 8, 11:50 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > > On 8/7/07, mussond <[EMAIL PROTECTED]> wrote:
>
> > > > > Hey all, I trying to create a bookmark link on my page.  I couldn't
> > > > > find anything in api that would let me do this, so I've tried to do
> > it
> > > > > using HTML but when I click the link I get a page saying I have a
> > > > > missing controller, $Verbs.
>
> > > > > Below is part of my HTML code.  I can see how the $Verbs controller
> > > > > comes about as its the name of my bookmark.  How do I get it follow
> > > > > the HTML and not Cake?
>
> > > > Why can't you use $html->link() ?
>
> > > > --
> > > > Chris Hartjes
> > > > Senior Developer
> > > > Cake Development Corporation
>
> > > > My motto for 2007:  "Just build it, damnit!"
>
> > > > @TheBallpark -http://www.littlehart.net/attheballpark
> > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard
>
> --http://lemoncake.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: Default Controller Action

2007-08-13 Thread RichardAtHome

I think this bakery article answers your question:

http://bakery.cakephp.org/articles/view/taking-advantage-of-the-pages-controller

I prefer to add a page-by-page route in routes.php:

Router::connect('/contact', array('controller' => 'pages', 'action' =>
'display', 'contact'));
Router::connect('/about', array('controller' => 'pages', 'action' =>
'display', 'about'));

(you could stick all the static pages in an array and loop through
them setting router:connect)

On Aug 10, 7:24 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I tried...$Route->connect('/*', array('conroller' => 'homes', 'action'
> => 'display', 'view'));  But that doesn't work.
>
> Is this a typo : sould be array('controller'
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Aug 10, 1:38 pm, 1Marc <[EMAIL PROTECTED]> wrote:
>
> > Can you setup a default controller action in the routes?
>
> > For instance...
> > /my-url-here would by default go to homes/view/my-url-here.   It
> > doesn't find an associated controller so it just defaults to the Homes
> > Controller View.
>
> > But if it finds a controller it does what is normal:
> > /properties/view/my-url-here would still go to the properties view.
>
> > I tried...$Route->connect('/*', array('conroller' => 'homes', 'action'
> > => 'display', 'view'));  But that doesn't work.
>
> > Can anyone help?


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



Re: Error message wrong line...

2007-08-13 Thread RichardAtHome

The PHP back end has encountered a syntax error, but reporting the
'wrong' line.

Actually, the line is correct. That's the point at which the PHP
backend gave up processing the file.

i.e. the syntax error only became apparent when the whole block of
code (terminated by the } ) was processed.

The actually error is usually close by (above) the line reported in
the error message.

On Aug 12, 2:01 pm, Mike Digital Egg <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone come across error messages which say there is a problem
> with the wrong line? I am getting the following error message:
>
> Fatal error: Call to a member function on a non-object in /path/app/
> app_controller.php on line 65
>
> When I look at line 65 in app_controller.php it is just the closing }
> on a function, this function is being called beforeFilter throughout
> the site with no problems, but occasionally the above error message
> appears?
>
> Anyone come across this behaviour before?
>
> Cheers
>
> Mike


--~--~-~--~~~---~--~~
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 User - Problem Going Through Tutorial "Your First Bite."

2007-02-13 Thread RichardAtHome

> > My guess is that you have some whitespace after or before the  > and ?> in your note.php model file.
>

This is a very common problem. The best way to deal with it is to not
close the php tag (its optional automatically included by php when it
reaches the end of file) :

-- start of file --
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Override $conditions to query WHERE array(INTs)

2007-02-13 Thread RichardAtHome

> The problem is that MySQL cannot/will not take a string of integers as
> a WHERE/IN clause on an INT field

Yes it will. The problem is that your aren't passing an array in, your
passing a string.

Cake automagically converts the where clause to:

.. WHERE (`Bid`.`industry_id` IN ('400,402,403') )

because you pass in the string '400,402,403'

The correct where clause should read:

.. WHERE (`Bid`.`industry_id` IN ('400','402','403') )

Which is what you get when you pass in an array.

Re-read Mikee comment for how to pass an array in.

Hope this helps :-)



On Feb 13, 10:16 am, "digitalcowboy" <[EMAIL PROTECTED]> wrote:
> The stumped part was right after what you quoted "...without Cake
> converting them to a string."
>
> The problem is that MySQL cannot/will not take a string of integers as
> a WHERE/IN clause on an INT field and Cake requires that the
> conditions parameter be a string.  No matter how I passed the values
> to Cake's query they came out with quotes around them - like a string
> - and MySQL would only "see" the first INT in the string.
>
> Thanks to everyone for your responses.  I didn't find a solution to
> the problem itself, but I figured out ways around it.
>
> On Feb 12, 3:38 pm, "Mikee Freedom" <[EMAIL PROTECTED]> wrote:
>
> > hey dood,
>
> > what do you mean by this exactly?
>
> > "I can't figure out how to fill in the values from a variable..."
>
> > If you've set up your form to pass the id's as an array :
>
> > 
> > 
> > 
>
> > when you reference :
>
> > $this->data['Object']['id']
>
> > In your controller it should already be an array. Then you could do
> > something like :
>
> > $conditions = array (
> > 'Object.id' => $this->data['Object']['id']
> > );
>
> > Which will then allow Cake to create the WHERE / IN statement.
>
> > Does that make sense?
>
> > HTH,
> > mikee
>
> > On 13/02/07, digitalcowboy <[EMAIL PROTECTED]> wrote:
>
> > > I appreciate the help but I already have that part.  The values in
> > > that array are any possible combination of 10 coming from the
> > > checkboxes in the form.  I'm trying to do exactly what you suggest but
> > > I can't figure out how to fill in the values from a variable without
> > > Cake converting them to a string.
>
> > > On Feb 12, 11:26 am, "djiize" <[EMAIL PROTECTED]> wrote:
> > > > to to a IN query, do this:
> > > > $criteria['Bid.industry_id'] = array(400,402,403);  // free to you to
> > > > populate the array
> > > > $this->Bid->findAll($criteria);
>
> > > > it will automagically do:
> > > > ... WHERE Bid.industry_id IN (400, 402, 403);
>
> > > > On 12 fév, 17:45, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
>
> > > > > You could probably get around this with the query method for the
> > > > > model.
>
> > > > > $this->Model->query($custom_query);
>
> > > > > On Feb 12, 5:44 am, "digitalcowboy" <[EMAIL PROTECTED]> wrote:
>
> > > > > > I wasn't sure how to title this.  Here's my challenge:
>
> > > > > > I have an array of 10 checkboxes to select categories for a search.
> > > > > > The checkboxes are passing INT values from the form.  The search
> > > > > > function then needs to apply the checked catgeories as conditions on
> > > > > > the query.  I couldn't figure out how to pass an array as the
> > > > > > $conditions value itself.  The closest I've been able to come is 
> > > > > > doing
> > > > > > an implode on the array to create a string for $conditions.  The
> > > > > > problem is that the array values and, more importantly, the field 
> > > > > > the
> > > > > > condition is applied to are INT.  Cake is building the query like 
> > > > > > so:
>
> > > > > > ... WHERE (`Bid`.`industry_id` IN ('400,402,403') )
>
> > > > > > That's fine except that MySQL seems to be choking because of the
> > > > > > single quotes and only searching on the first value (WHERE 
> > > > > > industry_id
> > > > > > = 400 in this example).  I confirmed this by running the query
> > > > > > directly against the database.  After removing the single quotes
> > > > > > around the list of INTs - [WHERE (`Bid`.`industry_id` IN
> > > > > > (400,402,403) )] - it finds everything as it should.
>
> > > > > > Long way to get to this question:  Is there any way I can pass an
> > > > > > array of INTs for the $conditions on findAll instead of a string or
> > > > > > get MySQL to properly accept the array of INTs in string form?
>
> > > > > > Thanks in advance.


--~--~-~--~~~---~--~~
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: problem on belongsTo many models

2007-02-07 Thread RichardAtHome

If I'm understanding correctly:

You will need to set up two associations:

in model equipment:

$belongsTo = array('school', 'area');

(make sure the school and area arguments above appear in the same
order as their school_id and area_id in the table)

On a related note, I'm not sure that's the best schema to represent
your data and the logic requirements.


On Feb 7, 3:19 am, "exiang" <[EMAIL PROTECTED]> wrote:
> Here is the scenario:
>
> 1)
> An Area have many schools
> A school belongs to an area
>
> 2)
> A school have many equipments
> An area have many equipments too
> Thus, an equipment can belongs to either a school or an area (as in
> belongs to the office of the area that govern all school)
>
> 3)
> i have db table and models for area, school and equipment
>
> 4)
> when an equipment belongs to a school, its area_id field will marked 0
> when an equipment belongs to an area, its school_id field will marked
> 0
>
> How can i define the belongsTo in Equipment class to work in my
> requirement?


--~--~-~--~~~---~--~~
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: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-29 Thread RichardAtHome

Grrr... still getting used to the new google groups gui. Didn't see 
the 2nd page of replies...

On Jan 29, 3:09 pm, "RichardAtHome" <[EMAIL PROTECTED]> wrote:
> "If there is a trick, perhaps you could share it with the list? "
>
> If you double click the relationship (the line connecting the tables),
> you can edit the name of the field DBDesigner uses for the foreign
> key.
>
> (took me a while to work this one out too)


--~--~-~--~~~---~--~~
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: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-29 Thread RichardAtHome

"If there is a trick, perhaps you could share it with the list? "

If you double click the relationship (the line connecting the tables), 
you can edit the name of the field DBDesigner uses for the foreign 
key.

(took me a while to work this one out too)


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

2007-01-23 Thread RichardAtHome

I think I might have come up with a possible application:

A forum. This seems to tick all the required boxes and I particularly
like the idea of building it to be embedded in another cake application
or run stand-alone.

I've had a look on cakeforge and the only other forum related project
is about including phpBB into an existing cake application.


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

2007-01-23 Thread RichardAtHome

Some great comments for all concerned :-)

I haven't had a look at Cheesecake-Photoblog yet, but judging by its
feature list and a (very quick look at the code) I certainly will be!

I'm not trying to steal anyones thunder here. tbh, my reasons for
getting the project underway are pretty selfish. I intend to use it as
a tool to learn CakePHP beyond the basics of scaffolding etc.

My plan is still taking shape, but what I'd like to do write some
articles (and hopefully get them published, either on my blog or on the
Bakery on each of the components and how they all fit together.

"Another problem with a reference project might be keeping it updated
with the latest CakePHP development. "

That was high up on my list of priorities.

As Cheescake seems to hit all the targets, perhaps I should think up
another application - there's no-point re-inventing the wheel is there?

Perhaps a inventory manager or an intranet portal?


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

2007-01-22 Thread RichardAtHome

Thanks for the feedback so far :-)

I am, by no stretch of the imagination a Cake guru (this is why I'm
starting this project).

What I am planning on doing is to post first drafts of code as I
understand they should be written to this group and get
advice/tweaks/feedback. Hopefully, by the end of the discussion we
should have some code that follows best practices.


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

2007-01-22 Thread RichardAtHome

Another thing to add to the list of components:

Email


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

2007-01-22 Thread RichardAtHome

Ok, I've had my moan about the documentation for cake ;-)

Time to do something about it.

I'd like to create a 'Reference' Project and associated documentation.
Something that uses best practices and incorporates all the common
elements a commercial cake project would call on and illustrates how to
bind them together into a coherent whole.

What I'd like to end up with is a freely available project that people
can turn to whenever they say 'how do i'

I'm thinking of basing it on the blog tutorial as everyone understands
what a blog is and a fully featured blog should use pretty much all of
the bells and whistles most other projects require.

Before I start coding, I'd like to hear what functionality and features
people would like to see. My basic list would be something like:

Authentication
Multicolumn layouts
Themes
Incorporating a 3rd party WYSIWYG editor
File Uploads
RSS feeds (could a view be leveraged into providing these?)
Article Search
Site Navigation / breadcrumb components

Anything else? If someone suggests something outside of the scope of a
blog then I'm quite happy to change the application to something more
fitting. Suggestions for other applications are welcome too.

As I have to work for a living, this will be a part time project so
don't expect masses of code straight away ;-)


--~--~-~--~~~---~--~~
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: Unoffical API / Beta RFC [new]

2007-01-22 Thread RichardAtHome

tbh, I wasn't being off topic (kinda ;-). Jippi was asking what people
would like to see in a documentation project and I answered: Example
code.

It snowballed from there.

I'm definitely not having a dig at all the hard work done by everyone
on the CakePHP project. If I didn't think it had potential I wouldn't
have bothered righting the post.

Jippi, the app is looking great :-) How about posting a few tutorials
on how you glued all the various bits together? Include that in the
documentation and I think you are on to a winner!


--~--~-~--~~~---~--~~
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: Unoffical API / Beta RFC [new]

2007-01-22 Thread RichardAtHome

Tarique, I'm definitely not 'copying out' ;-)

I'd love to contribute to CakePHP as I believe its the best thing to
happen to PHP in all the time I've been programming with it (since
PHP3).

I was trying to illustrate that perhaps, if the documentation was
available then the learning process would be faster and I would be in a
better position to help others. As it stands, I'm no-where near up to
speed with CakePHP to help out in any substantial way.

And your are right, this is one of the most friendly, a knowledgeable
lists I've subscribed to and I'm keen to take a more active roll.

I understand how OSS projects are developed, but lack of documentation
has sunk other worthy projects in the past. I'd hate to see cake suffer
the same misfortune.

I'm not asking for wikipedia scale documentation. What would really be
useful would be to extend the sample Blog application to cover the
stuff that make a site 'work'.


--~--~-~--~~~---~--~~
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: Unoffical API / Beta RFC [new]

2007-01-21 Thread RichardAtHome

Kudos for ralph who elequently illustrated my *only *problem with
CakePHP.

Cake is a top bit of coding. Seems to do so much of what I want, but
the practical documentation is lacking.

Code examples are crutial. Even generic ones. Specific ones are even
better.

No-one comes to Cake without a good understanding of PHP. What we need
are concrete examples of how common stuff is done. From there we can
piece together the intricacies.

IMHO, the best introduction to cake was done on the IBM site:
http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html

They showed, from first priciples how to put together a cake app.
That's what the documentation needs. API documention is fine for
CakePHP guru's, but it was only after reading the IBM stuff I *got* it.

I learned more from lesson 1, than I did from anything on the Cake
site.

This is defintely not a winge. I'm loving Cake. If my proffessional
deadlines were'nt so tight in my projects I'd be contributing
documentation about what I've got it to do right now. Cake *feels*
right to me, and I know this is the direction my own code should be
going.

As it stands, if a commercial project comes up that I think: 'This
would be perfect for a Cake'. I have to pass and go back to what I know
I can get working.

If you want Cake to be defacto, you are going to have to publish basic
tutorials on:

Authentication. Showing how to develop a system where users register,
sign in, sign out, have access to certain pages, how user_id's are used
to filter data, etc.

How a page is put together: Sounds simple I know, but I'm still
struggling to see how a cake app would build a comercial (not some toy
blog you couldn't charge for) site. Real websites are much more than a
common header, footer and one action. *Show* how components and
elements are brought together to build a page.

Gah, feels like a rant - but I'm not ranting ;-) Just frustrated when I
can feel the potential, but the practicallity is missing some important
steps.


--~--~-~--~~~---~--~~
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 to handle multipe hasOne?

2007-01-21 Thread RichardAtHome

Should be:

var $hasOne = array (
   "Author" =>
array("classname" =>
"Author",

"dependent" => false,

"foreignKey" => "book_id"),
   "AssistantAuthor" =>
array("classname" =>
"Author",

"dependent" => false,

"foreignKey" => "book_id"),
); 


Only the alias name should be different


--~--~-~--~~~---~--~~
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: Admin Access

2007-01-21 Thread RichardAtHome

php functions can have many returns. Proccessing stops (and returns) at
the first one the program logic reaches:

http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Good idea to combine edit.thtml and add.thtml?

2007-01-21 Thread RichardAtHome

If you set the action property of the form to empty ( "" ) then the
form will post back to the page that it was rendered on. Handy if you
are passing parameters through the url.


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

2007-01-19 Thread RichardAtHome


Its duplicated data because you are already storing which branches
belong to a company via the users table (users belong to a company AND
a branch).

If you use a nullable foreign key for the branch id you can also
represent people who are in the company but not associated with any
particular branch.

As with most things in life, there are many right answers. You just
have to pick which one is best for your particular needs.


--~--~-~--~~~---~--~~
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: Component vs. AppController vs. requestAction

2007-01-19 Thread RichardAtHome


"Just want to take an opportunity to thank you for the support you give
everyone here. "

Hear, hear!


--~--~-~--~~~---~--~~
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: idea: trace things into a log window

2007-01-19 Thread RichardAtHome


You can also use the windows build of the *nix command tail to monitor
the log file:

http://tailforwin32.sourceforge.net/


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

2007-01-19 Thread RichardAtHome


"and Branch belongsTo Company (without that, there's no correlation
Company and Branch) "

and again you'd be duplicating information ;-)

You could get a list of branches for each company via the users table

Get branches for company:

SELECT DISTINCT branches.id, branches.name
FROM branches
INNER JOIN users
ON users.branch_id=branch.id
INNER JOIN companies
ON users.company_id=companies.id
WHERE company.id=???

Get users in company:

SELECT users.id, users.name
FROM users
WHERE users.company_id=???

Get Users in a branch:

SELECT users.id, users.name
FROM users
WHERE users.branch_id = ???

Note: I've done all this in my head so there's bound the be errors :-D


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

2007-01-19 Thread RichardAtHome


You would break the rules of database normalisation if you linked the
users to the company. You would be duplicating data.

Note: Breaking the rules of database normalisation will not condemn
your soul to an eternity in the pit - sometimes the real world gets in
the way of a perfect ideal.

An alternative model would be:

Company hasMany Users
Branches has Many Users


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

2007-01-18 Thread RichardAtHome



http://localhost/~username/users/action


Most action pages require an ID of the object (record) the action is to
be performed onso the URL looks lilke:

http://localhost/~username/users/action/1

What happens if you go to:

http://localhost/~username/users/

?

If you are getting a 404 error, try replacing ~username in the above
URL with your username. For example - if your username is max, try:

http://localhost/max/users/


--~--~-~--~~~---~--~~
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: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-14 Thread RichardAtHome


Yup, works fine with Windows :-)

(I pretty much use it every day)


--~--~-~--~~~---~--~~
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: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread RichardAtHome

Another (minor) problem with the otherwise excellent DBDesigner is that
it uses MySQL old passwords. This means that once you create your MySQL
User, you then need to run the following sql before you can connect
with DBDesigner:

SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

Also worth noting: DBDesigner is no longer actively developed. It's
functionality is being incorporated into the MySQL GUI tools. Check out
the MySQL Workbench tool (
http://dev.mysql.com/downloads/gui-tools/5.0.html )


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



International PHP Magazine Poll:Best PHP Framework

2007-01-10 Thread RichardAtHome

Congratulations to everyone responsible for making CakePHP happen!

http://www.php-mag.net/magphpde/magphpde_news/psecom,id,26752,nodeid,5.html

'CakePHP' has beaten all its competitors with a majority of 78.5%
votes taking home the title of the best PHP MVC Framework. Next in line
is 'Sympony' with 10.9 %votes.WACT, Achievo, PHPonTrax was last on
the list as three of them garnered a dismal 0.0% votes each.


--~--~-~--~~~---~--~~
 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: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread RichardAtHome

I found the following tutorial very helpful:

http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html

(if free to view, but requires registration - check out the other two
parts too)

Got me over the initial learning hump and well on the way to producing
a 'real' application.


--~--~-~--~~~---~--~~
 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: Simplify foreach() - unpleasant array

2007-01-10 Thread RichardAtHome

Grant Cox wrote:

> Using $reservation['Reservation']['number'];  is correct.  This is
> because each retrieved row may have associated models - ie
> $reservation['Room'] etc.

Ah, another chink of sunlight just broke through the clouds :-)

I was going to ask this same question myself. My workaround (for models
with no associated models was to do the following:

$tmp=$reservations['Reservation'];

foreach($tmp as $reservation) {

  echo $reservation['number'];

}


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



Nice overview of Cake (with examples)

2006-07-12 Thread RichardAtHome

Just thought I'd draw your attention to a new article over on
sitepoint:

The CakePHP Framework: Your First Bite -
http://www.sitepoint.com/article/application-development-cakephp

It's a nicely written introduction to CakePHP. It only covers very
basic first principles (it lightly glosses over adding joins in your
models for example), but a good read non-the-less.


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



Cake Software Foundation Certification

2006-06-01 Thread RichardAtHome

>From the Cake Software Foundation Certification page (
http://www.cakefoundation.org/pages/certification ) :

"and will be able to use the CakePHP trademark when promoting their
services"

Does this mean non-certified developer wont be able to use the CakePHP
trademark?

If this is true what about all the free publicity CakePHP will loose?


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



<    1   2   3