Saturday, July 4, 2009

Automagically filling table-fields?

Hi all you experienced bakers.

I'm new to the world of CakePHP, so forgive me if this is a very basic
question.
I followed a few tutorials, and have a question about getting
information filled automagically into the different fields of the
table.

First off, I extended the blog tutorial with a simple implementation
of Auth, based heavily on what I could find here:
http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-auth-users-habtm-groups-cakephp

Then, I've extended on the blog tutorial, and have been adding new
fields to the "posts" table from the example. One of the new fields, I
created is 'username'.

Here's the deal: I'd really like to have the 'username' field being
filled automagically based on what user is logged in, just like it
does to both the 'modified' and 'created' fields by default in the
blog-tutorial.

From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database]
"Check out "CakePHP Conventions" for more information, but suffice it
to say that naming our table 'posts' automatically hooks it to our
Post model, and having fields called 'modified' and 'created' will be
automagically managed by Cake."

Thanks in advance!
Best regards,
Emil K

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: