# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.13.2] - 2019-08-14
### Fixed
- `articles:setDefaultClient` does not overwrite existing client info in multi-client instances.

## [1.13.1] - 2019-08-13
### Added
- Packages now also have stable identifiers. Be sure to run `identifier:regenerate` after deployment.
- Offers now also have stable identifiers. Be sure to run `identifier:regenerate` after deployment.

### Changed
- The `families` attribute for gastronomy articles is now imported as a label instead of a translated string.
- The previous `features` attribute for attractions is now being imported as separate attributes. This allows for filtering.
    - `features.information` -> `information`
    - `features.acceptedPayments` -> `acceptedPayments`
    - `features.forKids` -> `forKids`
    - `features.spokenLangauges` -> `spokenLangauges`
    - `features.priceSegment` -> `priceSegment`

### Fixed
- Removed invalid migration that changed all article clients to `default`.
- Fixed package import failing if no featureGroups missing

### Fixed
- The related entities for cities now have the correct predicted uuid that includes the specific client.

## [1.13.0] - 2019-08-01
### Added
- Configuring multiple clients for the `Toubiz/Legacy/Event` service is now supported.
- Synchronization commands now have a `--only-modified-in-last` argument to only synchronize
  changed records. Example: `$ php flow articles:synchronize --only-modified-in-last '2 days'`.
- Synchronization commands now have a `--concurrency` argument to specify how many requests are
  being sent out at once.
- Added command to reset the default client on all article records.
  
### Changed
- All api services no support multiple clients. The configuration for this should be changed (see
README.md) but the old configuration structure is still supported.  
- All article types now store the configured client. This changes the identifiers on all articles,
  and references (e.g. teasers) will break. Please see "Action Required" below. 
  
### Fixed
- Event import now uses the configured apiKey.
- Removal of attributes now doesn't cause removal of articles.

### Action Required

- Please move all api service configuration to a client.

```yaml
# Example for toubiz events api:
# Before
Newland:
  Toubiz:
    Sync:
      Neos:
        services:
          'Toubiz/Legacy/Event':
            client: 'foo'
            languages: [ 'de', 'en', 'fr' ]

# After
Newland:
  Toubiz:
    Sync:
      Neos:
        services:
          'Toubiz/Legacy/Event':
            clients:
              Default:
                client: 'foo'
                languages: [ 'de', 'en', 'fr' ]
```

- To prevent duplicates, _before_ the next sync, run `php flow articles:setDefaultClient` and then
  `php flow identifier:regenerate`.
- To filter lists of tours per client, add the configuration under `Newland.Toubiz.Poi.Neos.clientFilter`.
  Check the settings file for examples.

## [1.12.3] - 2019-07-22
### Changed
- The field "facts" for city data can now store longer info.

## [1.12.2] - 2019-07-15
### Fixed
- Migration `20190613045253` has incorrected parameters.
- Now removing database entries when `identifier:regenerate` identifies duplicates

## [1.12.0] - 2019-07-12
### Added
- Articles now have a defined main medium (generally an image). This can be displayed in teaser
  elements, etc.
- Articles now have a new main type: "city". Cities are part of the general article import, and can
  explicitly be imported via `articles:synchonize --only="cities"`. Cities have related lists of
  articles. These require deterministic identifiers (see below). Please read the "Action required"
  section.
- A new `category:removeunused` command to clean out old categories that are not used for articles
  or events.
- The following entities now use persistent object identifiers. This means that the identifier of the
  entity is determined by it's properties - leading to the same object getting the same data event when
  clearing the database and reimporting. This is important because the identifiers are being used in
  multiple places. This way deleting all entities are doing a fresh import does not break existing nodes
  on the site.
    - Articles
    - Events
    - Event Dates
    - Categories
- A new `identifier:regenerate` command has been added to migrate from unstable identifiers to deterministic
  identifiers. Read more about that in the 'Action required' section.

### Fixed
- Fixed translatable repositories not adding language clauses to some queries.
- tportal services now support multiple languages.
- Fixed instances of link generation (or other actions) prior to displaying lists
  tainting repository languages causing them to either ignore languages or display
  items in an incorrect language.

### Action Required
- To migrate data to be consistent please run through the following steps in that order:
    1. Run `doctrine:migrate`. You don't have to create migrations, they are now shipped with the sync package.
    2. Run `category:removeunused` - This will ensure that only used categories are in the database.
    3. Run `identifier:regenerate` - This will regenerate the persistence_object_identifiers to a stable version.
    4. Rerun all importers.
- The steps above must be executed for every environment. It's not enough to run them locally and then deploy.
  They have to be executed locally, on preview and on live after the next deployment.

## [1.11.3] - 2019-07-04
### Fixed
- Fixed certain queries ignoring languages
- Fixed old event record deletion deleting too many records.
- Fixed relationships of articles & events (e.g. addresses) not being imported correctly if multiple
  languages are being used and the relationships are identified using the same id in the external system.

### Action Required
If you are coming form a previous version, you should truncate some relationship tables and fields in order
to ensure that these are rebuilt correctly. This can be done by using a migration such as the following 
and reimporting all entities afterwards. This is only necessary when updating to the 1.11.* branch.
When importing to the 1.12.* branch this will be done for you - you'll not have to worry about this.

```php
$this->addSql('UPDATE newland_toubiz_sync_neos_domain_model_article SET mainaddress=NULL');
$this->addSql('UPDATE newland_toubiz_sync_neos_domain_model_article SET mainmedium=NULL');
$this->addSql('UPDATE newland_toubiz_sync_neos_domain_model_event SET location=NULL');
$this->addSql('UPDATE newland_toubiz_sync_neos_domain_model_event SET organizer=NULL');

$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_article_addresses_join');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_article_files_join');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_article_media_join');

$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_event_eventtags_join');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_event_media_join');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_package_media_join');

$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_address');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_file');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_medium');
$this->addSql('DELETE FROM newland_toubiz_sync_neos_domain_model_eventtag');
```

If you are not concerned about soft relationships (such as links in textfields) to entities
then you can also use `php flow articles:remove` and `php flow events:remove` followed by a
reimport to ensure that all imported relationships are consistent.

## [1.11.1] - 2019-06-28
### Fixed
- Fixed certain queries ignoring languages

## [1.11.0] - 2019-06-27
### Added
- Entities imported from tportal are now language aware. You can now configure the `languages`
  option for these services similar to other services.

## [1.10.5] - 2019-06-25
### Fixed
- Sites using custom page node types (as opposed to the default `Neos.NodeTypes:Page`) now no longer
  fail during the 'Rebuilding URLs' phase of synchronization commands.
- Fixed incorrect cache clearing after sync commands

## [1.10.2] - 2019-06-19
### Fixed
- Fixed packages without preview images breaking imports

## [1.10.0] - 2019-06-07
### Changed
- Added a trait for unique URLs to events and articles.
- Categories are now sorted. The first category is considered the main category.
- Languages for services now must be explicitly configured. The default for imported languages has changed from all languages to just german.
– External event detail pages (e.g. to RCE events calendar) can now be build. See README for an example.

### Fixed
- `events:remove` now iterates over all configured languages.
- Article attributes are now language and client aware.
- Article import no longer creates Duplicate categories.

### Potentially Breaking / Action required
- If your website supports languages other than german (If the website is multilingual) then
  you will have to configure the languages to import from for every service configured.
  The following example shows Legacy toubiz configuration but this is true for all multilingual
  data sources.
```yaml
# Before: Implicitly imports all languages
Toubiz:
  Sync:
    Neos:
      services:
        Toubiz/Legacy/Db:
          apiKey: ABC123DEF456
          client: 1234

# After: Must configure relevant languages explicitly
Toubiz:
  Sync:
    Neos:
      services:
        Toubiz/Legacy/Db:
          apiKey: ABC123DEF456
          client: 1234
          languages:
            - de
            - en
            - es
            - fr
```

## [1.7.4] - 2019-05-17
### Added
- Language handling of repositories can now be disabled
- Repositories now have methods for easy batch handling

## [1.7.3] - 2019-05-14
### Fixed
- Fixed categories being imported with an empty string as language

## [1.7.2] - 2019-05-09
### Added
- Add new signal for URL build

## [1.7.1] - 2019-05-09
### Added
- Tables now have indexes on columns to speed up imports

### Fixed
- Invalid UTF-8 characters are now stripped from incoming data
- Memory leak for article imports has been fixed. Memory consumption does
  not scale with the number of records anymore.
- Fixed logger not being passed to DbService

## [1.7.0] - 2019-05-08
### Added
- Categories are now language-aware.
- There is now feedback on how many articles were removed during import.
- The order of images for an articles is now saved.
- Add `--only` flag for article synchronize command to allow import of a single article type.

### Changed
- PHP 7.2 and up is now required.

### Changed
- The default language for imports in now only German.

### Fixed
- Check for translations during import.
- The magic repository methods now respect the current language.
- Fixed incorrect querying when applying filters by client. By not having the `and`
condition they would override the basic filtering applied.
- Main address no longer blocks removal of articles.
- Attributes are now cleared correctly if there were any previously but not anymore.

## [1.6.1] - 2019-04-18
### Fixed
- Fixed selecting multiple articles when joining to categories
- Imported zip codes now have precedence over calculated ones.

## [1.6.0] - 2019-04-17
### Added
- Article Sync Command now clears cache after it finishes.
- `/redirect/{type}/*` Endpoint to handle generic endpoints as defined by `toubiz-api`.
- Ticket contact field is now imported for events.
- Brochure models and API access has been added
- Social media information for articles
- `events:synchronizeOne` command

### Changed
- `openingTypeFormat` on `Article` has been renamed to `openingTimesFormat`. This is not a breaking
  change as this attribute has not been used anywhere yet.

### Fixed
- List views with no category filter selected now display distinct articles, no duplicates.

## [1.5.0] - 2019-04-03
### Added
- Addresses can now use geo location services to retrieve zip codes (for region filtering)
- Every API Service can now be configured with an additional `baseUri` option allowing integrators
  to point Neos to different instances of Services (e.g. TPortal staging server).
- All removal tasks now ask for confirmation before really deleting entities.

### Fixed
- Path cache is now flushed after imports preventing URLs ending in `-1`.
- `doctrine/collections` is now pinned to 1.5.0 to prevent version conflicts.
- Adresses with coordinates close to 0/0 (e.g. 0.02/0.04) are now being ignored.
- A whole import does not fail anymore if a single import step fails.

## [1.4.0] - 2019-03-08
### Added
- Synchronization CommandControllers now emit the `start` `progress` and `end`
  signals that make hooking into the synchronization process easier.
- All synchronization CommandControllers now output status information. Use the `--quiet` to disable them.
- Attribute collections are now countable
- The `articles:synchronize` now has a `--time-to-live` option that deletes records older than x days.
- New `articles:synchronizeTours` command that only synchronizes tours
- New setting `expireDays` that defines the days an deactivated or expired event should stay reachable.

### Fixed
- `CategoryFilter` now correctly sets `toDate` in initialize method
- Fixed query for incorrect field `originalid` in `RegionRepository`
- For gastronomy articles only those with the `online=1` attribute are being imported.

### Removed
- `AbstractCommandController` has been moved to the `Newland.NeosCommon` package

### Migration notes
- Use `php flow snowreport:synchronize` to ensure all requested fields are filled out.

## [1.3.2] 2019-02-07
### Fixed
- Removed migrations that assume the database to be in a defined state as most databases are not in that state.
  For the time being projects / site packages are in charge of migrations as they know their own state best.
