# PHP Annotations Plugin Intentions

**Intentions** create Doctrine column mappings and repository references from the editor when an entity class is missing metadata.

---

## Add Doctrine column mapping

**Feature ID:** `DoctrineColumnIntention`  
**Feature Page:** [Add Doctrine column mapping](https://espend.de/phpstorm/plugin/php-annotations#doctrine-column-intention)  

Adds an ORM field mapping for an unmapped entity property.

The generator detects existing project style and writes either DocBlock annotations or PHP attributes. It guesses column type from the property name and PHP type, treats nullable types as nullable columns, and maps PHP arrays to JSON.

### Code Examples

```
# Before:
use Doctrine\ORM\Mapping as ORM;

final class Product
{
    private ?array $payload = null;
}
```

```
# After:
use Doctrine\ORM\Mapping as ORM;

final class Product
{
    #[ORM\Column(type: 'json', nullable: true)]
    private ?array $payload = null;
}
```

---

## Add Doctrine repository

**Feature ID:** `DoctrineRepositoryIntention`  
**Feature Page:** [Add Doctrine repository](https://espend.de/phpstorm/plugin/php-annotations#doctrine-repository-intention)  

Adds a repository class to an entity mapping or creates the repository file when it does not exist.

The action searches common repository namespaces, creates a `Repository` directory when possible, and uses the ServiceEntityRepository template when DoctrineBundle is available.

### Code Examples

```
# Before:
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 */
final class Product
{
}
```

```
# After:
use App\Repository\ProductRepository;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass=ProductRepository::class)
 */
final class Product
{
}
```

---

