I am not sure if it is a good idea to just allow them to use a single @DynamicFields, maybe we should throw an exception if they use it that way? Also, if they modify a value inside $data should we persist the changes?

Jonathan H. Wage
added a comment - 28/Aug/10 11:25 AM Nice idea! So something like this could essentially work:
/** @Document */
class User
{
/** @DynamicFields */
public $data;
}
$user = $dm->find(....);
echo $user->data['username'];
I am not sure if it is a good idea to just allow them to use a single @DynamicFields, maybe we should throw an exception if they use it that way? Also, if they modify a value inside $data should we persist the changes?

Benjamin Eberlei
added a comment - 29/Aug/10 2:37 AM ok maybe array_merge() is a bit dangerous, when the dynamic field has a property named like a real property.
But you could do $data = array_merge($dynamicData, $staticData); and should be fine then semantically, of course this should be documented
I think you should have at least an ID or not? but something like this would even be very fast for prototyping:
/** @Document */
class User
{
/** @Id @Field */
private $id;
/** @DynamicFields */
public $data;
}