# Fields and projections

{% hint style="success" %}
This is the official documentation of the `forestadmin/laravel-forestadmin` v2+ and `forestadmin/symfony-forestadmin` PHP agents.
{% endhint %}

### Fields

Field identifiers simply are strings that identify a column in the context of a collection.

Let’s consider the following database structure; collections, fields and relationships:

{% @mermaid/diagram content="erDiagram
Books |o--|| Authors: ManyToOne
Books ||--o| Reviews: OneToMany

Books {
int id
int authorId
string title
ManyToOne myAuthor
OneToMany myReviews
}
Authors {
int id
string firstname
string lastname
}
Reviews {
int id
int bookId
string content
int rating
}" %}

In this context, you’ll find below some examples that show valid and invalid field calls:

| Collection | Field                | Valid?                                                           |
| ---------- | -------------------- | ---------------------------------------------------------------- |
| Books      | "title"              | 🟢 Yes                                                           |
| Books      | "myAuthor:firstname" | 🟢 Yes                                                           |
| Books      | "myReviews:content"  | ❌ No, only relationships which yield one record can be traversed |
| Reviews    | "content"            | 🟢 Yes                                                           |
| Reviews    | "myBook:title"       | ❌ No, reverse relationships are *not* automatically defined      |

### Projections

Projections are mainly used to fetch partial records and automatically fetch linked records.

Projections simply are an array of fields.

```json
["id", "title", "author:firstName"] // for books
```
