0

I'm trying to modify the CakePHP bake script so that I can incorporate saving of images from an image helper in an appropriately named field.

How do I go about getting the list of fields/variables in my model? I see that the $modelObj object is available, I've tried performing json_encode on this to get an idea for what's inside and theres a "_schema" list which seems to have all my field names inside... but I can't access this as it's not an array?

tereško
  • 58,060
  • 25
  • 98
  • 150
Jamie Chapman
  • 4,229
  • 5
  • 29
  • 47

1 Answers1

1

Make a call to:

$this->ModelName->schema()

It will return a field-by-field list containing field names and data types.

Tyler
  • 2,126
  • 1
  • 12
  • 11