Download the PHP package sandstorm/gedmotranslatableconnector without Composer

On this page you can find all versions of the php package sandstorm/gedmotranslatableconnector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gedmotranslatableconnector

Flow Framework Connector to Gedmo Translatable

by Sebastian Kurfürst, sandstorm|media. Thanks to Web Essentials for sponsoring this work initially. Currently maintained by @swisscomeventandmedia

Using Gedmo.Translatable in the Neos Flow framework proved a little harder than originally anticipated. This small package wraps up the necessary steps.

Getting started

Just include this package, and then use Gedmo Translatable as explained in their documentation (e.g. using the @Gedmo\Translatable annotation): https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md

Make sure to clear the code cache completely in Data/Temporary after installing this package!

Furthermore, make sure to create a doctrine migration which creates the ext_translations SQL table; e.g. run ./flow doctrine:migrationgenerate

Check out the example package at https://github.com/sandstorm/GedmoTest.

This connector supports all the advanced options provided by Gedmo Translatable.

Model Annotations

Just annotate your model properties which shall be localized with Gedmo\Mapping\Annotation\Translatable.

Translating a model (low-level)

Set current language

In order to set the current language for viewing, inject the Gedmo\Translatable\TranslatableListener class and set the current language on it: $translatableListener->setTranslatableLocale('de');.

Translation management

Editing multiple languages at the same time

Persist edited translations

With the by default enabled instantTranslation setting, the translations are updated and persisted through the Gedmo\Translatable\Entity\Repository\TranslationRepository immediately when calling the setTranslation method. Often, this might not be ideal because it persists the entity right away. Disable the setting and call the flush() method of the TranslatableManager to persist the changes according to your needs.

Fetching an object in another locale

If you have loaded an object in a specific locale, but later on need to change the object to be in another locale, the method reloadInLocale($locale) (which is defined inside the trait Sandstorm\GedmoTranslatableConnector\TranslatableTrait) can be called:

Translating associations

Warning: this feature is not yet 100% stable; please test it and give feedback!

Normally, associations towards other domain models such as images or assets are not translation-aware; but Translatable only works for simple properties.

The TranslatableConnector however contains some functionality to make translation of associations work; by using a little workaround: We store the identifier of the target object in the domain model, and manually load/store from this identifier.

This works as follows:

  1. Makes sure you have the TranslatableTrait added to your domain class

  2. e.g. to make an Asset reference translatable, create a new property assetIdentifer which is a string and will contain the asset identifier. This property should be marked as Gedmo\Translatable.

  3. Then, you need to configure the translationAssociationMapping, which tells the system that the (virtual) property should asset should internally be stored as assetIdentifier.

  4. Furthermore, create assetOnSave and assetOnLoad methods as outlined below, which convert the different representations

See the full example below:

Inner Workings

(as a further reference -- could also be reduced if we change Flow Framework a little on the relevant parts)

Further recommendation


All versions of gedmotranslatableconnector with dependencies

PHP Build Version
Package Version
Requires neos/flow Version ^7.0
gedmo/doctrine-extensions Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sandstorm/gedmotranslatableconnector contains the following files

Loading the files please wait ....