MVC Design Question

2009-03-12 Thread Alex Jeffery

Hi,

I am building a small cake application to learn MVC and cakePHP.
I have a question about where to put business logic, I have read that
controls should be skinny and models should be fat. Eg the business
rules should live in the models.

In my application I have the following models User, Portfolio,
Currency.
A user has 1 portfolio which has 1 currency. When I register a user I
would like to create their portfolio and assign it the default
currency.

My question is where to do the creation of the portfolio?
(Fat Controller)
1. Call the User model to create a new user.
2. Call the Currency model to get the default currency.
3. Call the Portfolio model to create a new portfolio for the new user
with the default currency.

Or

(Fat Model)
1. The controller calls a custom function on the Users model. Eg
registerUser($formData)
2. The User model validates and saves the new user.
3. The user model then calls the Portfolio model to create a new
portfolio for the new user.
4. The Portfolio model calls the Currency model to get the default
currency and creates the new portfolio for the new user.

The advantage I can see to the Fat Model way is that the logic for
registering a new user is all in one spot.
So if I have many controllers that need to register a new user I can
just use the same code.

Is this on the right track?

Thanks,
Alex

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



GoogleBot gets a 404 on site with out index.php

2007-09-29 Thread Alex Jeffery

Hi,

I have a strange issue where I have installed cakePHP and it looks
like it works fine.
If I browse to http://AlexJeffery.org/ I see what I would expect.
How ever googlesite maps says it gets a 404 on http://AlexJeffery.org/

I have tried several spiders to generate a sitemap and they all get a
404 on http://AlexJeffery.org/
If I point them to http://AlexJeffery.org/index.php they can find that
and spider correctly.

I tried adding the following line to the .htaccess in the app/webroot
DirectoryIndex index.php
But it still gets a 404

Any ideas on how to fix this?
I would like my sitemap to work :)

Thanks,
Alex


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