# `/orchard` repo

This repository contains the OA and Workstation applications. It's primarily a PHP-based codebase, some of which is PHP-classic a.k.a. non-MVC. The MVC is Zend 1. It makes request to [Vector API](https://github.com/theorchard/api).

## Getting Started

See [this Notion doc](https://www.notion.so/PHP-Monolith-Development-1b899e3ad94143b6a3fbdcb6834d4b1b) for how to get started with development using either a dev box or running locally.

## Development

### Update composer.lock
After adding or updating php packages, you need to re-generate `composer.lock`.

```bash
make update_composer_lock
```

or

```bash
docker compose run --rm --build update-lockfile
```

### Database

Typically, your squad will have it's own mysql instance (running `art_relations` and other databases), and you will usually also be granted read-only permission to the PROD replica, `reportsar`.

### Pull Requests

Code should be [PSR-2](https://github.com/theorchard/orchard/wiki/PSR-2-Coding-Standard) compliant.

### Missing a Configuration Variable? Please Contribute!

During development, you may run into a config that has not been captured by the ansible script.

An uncaptured config can typically be identified by the fact that it's value has not been templated in `{{ HANDLEBAR }}` format, and is still set to a value on the lines of `"REPLACE_ME"` or `"CHANGE_ME"` or some other non-unique string.

If it doesn't exist in the [ansible `devorch` variables file](https://github.com/theorchard/ansible-dev-box-setup/blob/master/config/vars.devorch.yml):

- **Create the new config:** Pick a unique name for your config like `NOTIFICATION_EMAIL_ADDRESS` and put it in the [variables file](https://github.com/theorchard/ansible-dev-box-setup/blob/master/config/vars.devorch.yml) so that it gets picked up for translating the shadow files task.
- **Update the shadow file:** In the `/orchard` repo, update your shadow to have the value be your new template variable.

#### Example shadow update:
In some file like `/application/configs/someconfig.shadow.ini` you will want to update from:

```Makefile
NOTIFICATION_EMAIL_ADDRESS= REPLACE_ME
```
to:
```Makefile
NOTIFICATION_EMAIL_ADDRESS= "{{ NOTIFICATION_EMAIL_ADDRESS }}"
```
#### Checking a feature flag in a Workstation PHP Controller:
If your controller subclasses from Web_Controller_Alw (most Workstation controllers do) then you can check a feature flag like this

```php
        $my_var = $this->isFeatureVariantActive('name_of_feature_flag', 'enabled');
```
