ruflin/Elastica — pull request #312 by munkie (2013-01-21 11:52:55+00:00)
Title: Document populate from response

- On **Type->addDocument()** id will be set in document from response if no id was provided
- On **Type->addDocuments()** id will be set in all document with not assigned ids
- On **Type->updateDcoument** fields will be updated if *fields* options is set. It should be either *_source* value or array of fields to update
- Added Document data properties overloading, so data fields can be accessed and manipulated using magic methods __get, __set, __isset, __unset

###### Add document example:
```php
$document = new Document();
$document->name = 'Batman'; // sets data field 'name' using magic method __set()
$type->addDocument($document);
echo $document->getId(); // will print id generated be elasticsearch
```

###### Update document example:
```php
$document = new Document(1);
$document->name = 'Batman';
$script = new Script('ctx._source.name = name');
$script->setParam('name', 'Robin');
$document->setFields(array('name')); // this fields values will be updated
$type->updateDocument($document);
echo $document->name; // will print 'Robin'
```