---
title: "Session: How to Customize the Identity Property Lookup for Entities"
url: "https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-identity-property-lookup-for-entities"
version: "6.2"
language: "php"
---

# Session: How to Customize the Identity Property Lookup for Entities

> Client language: PHP. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-identity-property-lookup-for-entities.md), [Java](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-identity-property-lookup-for-entities.java.md), [Node.js](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-identity-property-lookup-for-entities.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

- When a client handles an entity, it must know which property is the entity's identifier.  
  By default, the client always looks for the `Id` property (case-sensitive).

- This behavior can be changed by overwriting the `FindIdentityProperty` convention.  
  To do so, use the `setFindIdentityProperty` method.

## Syntax

```php
public function setFindIdentityProperty(?Closure $findIdentityProperty): void;
```

## Example

The simplest example would be to check if the property name is equal to 'Identifier'.

```php
$store->getConventions()->setFindIdentityProperty(function($property) {
      return "Identifier" == $property->getName();
});
```

## See also

- [Conventions](https://docs.ravendb.net/6.2/client-api/configuration/conventions.md)
- [How to Customize ID Generation for Entities](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-id-generation-for-entities.md)
- [How to Customize Collection Assignment for Entities](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-customize-collection-assignment-for-entities.php.md)
- [Document Identifier Generation](https://docs.ravendb.net/6.2/server/kb/document-identifier-generation.md)
