/**
* Create an entity.
*
* This method does not execute any service requests.
*
* Entities are created with a Datastore Key, or by specifying a Kind. Kinds
* are only allowed for insert operations. For any other case, you must
* specify a named key. If a kind is given, an ID will be automatically
* allocated for the entity upon insert. Additionally, if your entity
* requires a complex key elementPath, you must create the key separately.
*
* In complex applications you may want to create your own entity types.
* Google Cloud PHP supports subclassing of {@see Google\Cloud\Datastore\Entity}.
* If the name of a subclass of Entity is given in the options array, an
* entity will be created with that class rather than the default class.
*
* Example:
* ```
* $key = $datastore->key('Person', 'Bob');
* $entity = $datastore->entity($key, [
* 'firstName' => 'Bob',
* 'lastName' => 'Testguy'
* ]);
* ```
*
* ```
* //[snippet=array]
* // Entity values can be assigned and accessed via the array syntax.
* $entity = $datastore->entity($key);
*
* $entity['firstName'] = 'Bob';
* $entity['lastName'] = 'Testguy';
* ```
*
* ```
* //[snippet=object_accessor]
* // Entity values can also be assigned and accessed via an object syntax.
* $entity = $datastore->entity($key);
*
* $entity->firstName = 'Bob';
* $entity->lastName = 'Testguy';
* ```
*
* ```
* //[snippet=incomplete]
* // Entities can be created with a Kind only, for inserting into datastore
* $entity = $datastore->entity('Person');
* ```
*
* ```
* //[snippet=custom_class]
* // Entities can be custom classes extending the built-in Entity class.
* class Person extends Google\Cloud\Datastore\Entity
* {}
*
* $person = $datastore->entity('Person', [ 'firstName' => 'Bob'], [
* 'className' => Person::class
* ]);
*
* echo get_class($person); // `Person`
* ```
*
* ```
* //[snippet=exclude_indexes]
* // If you wish to exclude certain properties from datastore indexes,
* // property names may be supplied in the method $options:
*
* $entity = $datastore->entity('Person', [
* 'firstName' => 'Bob',
* 'dateOfBirth' => new DateTime('January 31, 1969')
* ], [
* 'excludeFromIndexes' => [
* 'dateOfBirth'
* ]
* ]);
* ```
*
* @see https://cloud.google.com/datastore/reference/rest/v1/Entity Entity
*
* @param Key|string $key The key used to identify the record, or a string $kind.
* @param array $entity [optional] The data to fill the entity with.
* @param array $options [optional] {
* Configuration Options
*
* @type string $className The name of a class extending {@see Google\Cloud\Datastore\Entity}.
* If provided, an instance of that class will be returned instead of Entity.
* If not set, {@see Google\Cloud\Datastore\Entity} will be used.
* @type array $excludeFromIndexes A list of entity keys to exclude from
* datastore indexes.
* }
* @return Entity
*/
public function entity($key, array $entity = [], array $options = [])
{
return $this->operation->entity($key, $entity, $options);
}