Skip to content

Commit

Permalink
Update database.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleš committed Apr 8, 2019
1 parent 0679b41 commit ba272eb
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .docs/database.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Database loaders
Package included database loader for **[Doctrine 2](https://www.doctrine-project.org/)**.
Package included database loader for **[Doctrine 2](https://www.doctrine-project.org/)** and **[Nette Database 3](https://doc.nette.org/cs/3.0/database)**.

## Content
- [Doctrine - how to configure](#doctrine)
- [Nette Database - how to configure](#doctrine)
- [Bugs - known bugs](#bugs)

## Doctrine
You must create a file with specific format in scanned dirs like as **MyEntity.en_US.doctrine**. All parameters are optional, but file must be created.
You must create a file with specific format in scanned dirs like as **messages.en_US.doctrine**. All parameters are optional, but file must be created.

```neon
entity: App\Entity\Translations # if you specify entity key, MyEntity from file name will be ignored
table: "My\Entity" # if you specify entity key, "messages" from file name will be ignored
id: "id" # id column name, default is "id"
locale: "locale" # locale column name, default is "locale"
message: "message" # message column name, default is "message"
timestamp: "timestamp" # timestamp column name, default is "timestamp"
```

Added loader to translation configuration.
Expand All @@ -40,12 +40,11 @@ use Nette;
* @property-read string $id
* @property-read string $locale
* @property-read string $message
* @property-read int $timestamp
*
* @ORM\Entity
* @ORM\Table(name="translations")
* @ORM\Table(name="messages")
*/
class Translations
class Messages
{
use Nette\SmartObject;

Expand Down Expand Up @@ -79,13 +78,6 @@ class Translations
*/
private $message;

/**
* @var int
*
* @ORM\Column(type="integer", nullable=false)
*/
private $timestamp;


/**
* @return int
Expand Down Expand Up @@ -121,17 +113,25 @@ class Translations
{
return $this->message;
}
}
```

## Nette Database
You must create a file with specific format in scanned dirs like as **messages.en_US.nettedatabase**. All parameters are optional, but file must be created.

/**
* @return int
*/
public function getTimestamp(): int
{
return $this->timestamp;
}
}
```neon
table: "my_table" # if you specify table key, "messages" from file name will be ignored
id: "id" # id column name, default is "id"
locale: "locale" # locale column name, default is "locale"
message: "message" # message column name, default is "message"
```

Added loader to translation configuration.
```neon
translation:
loaders:
nettedatabase: Contributte\Translation\Loaders\NetteDatabase
```

## Bugs
- refreshing cache, if you something change in database or in configuration file
- refreshing cache, if you something change in database

0 comments on commit ba272eb

Please sign in to comment.