I'm building a plugin which creates a few tables, and need to store some fairly robust data. I've done this before and previously gotten by with mostly AttributeType::String
and AttributeType::Mixed
, but this time I'd like to ensure I'm doing things by the book. Problem is: so far as I can tell, nobody's written the book.
I started out by Model and Record documentation, but they don't reference the possible AttributeType options. Next I read the class reference, but this isn't helpful either. Then I looked at the ModelHelper and DbHelper code. These were a bit helpful, but they don't explain how exactly an AttributeType affects throughout Craft. Eventually I found Experience's Definitive Guide to Validation in Craft series (specifically the linked AttributeType entry). This is quite helpful, but because it's focused mostly on validation, it doesn't answer many of my questions.
It's possible that the book by Experience answers gives more detail, but I'm surprised I need a book to learn about this. It also seems like a slight gamble, as I'm only potentially interested in one chapter right now.
Here's the sort of thing I'm hoping to learn:
- What is the
Name
type used for? - What's the difference between
Handle
andSlug
? Why choose one over the other? - What exactly does
Template
do, and why does it need its own type? - What's the difference between
Url
andUri
? Is it just the validation?
Maybe it's not important to know these things, but I think it would be helpful to understand what I'm doing and how these types are processed and affect the system. It's also not completely clear what types are available, as the ModelHelper source doesn't list types like String
. I assume that's getting inherited from Yii, but I'm not certain.
Question:
Is there some documentation, or blog post, out there that explains the types available through AttributeType
?