Skip to content

Commit 0013fbe

Browse files
committed
fixed readme
1 parent f7e8efb commit 0013fbe

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,27 +288,27 @@ If you want you can specify classes to use for repository and entity instances.
288288
Entity and repository class implementation are ommited, but you should just extend base classes.
289289
```php
290290
$userClasses = $mapper->addPlugin(Tarantool\Mapper\Plugin\UserClasses::class);
291-
$userClasses->mapEntity('person', Application\Models\Person::class);
292-
$userClasses->mapRepository('person', Application\Repositories\Person::class);
291+
$userClasses->mapEntity('person', Application\Entity\Person::class);
292+
$userClasses->mapRepository('person', Application\Repository\Person::class);
293293

294294
$nekufa = $mapper->create('person', [
295295
'email' => '[email protected]'
296296
]);
297297

298-
get_class($nekufa); // Application\Models\Person;
298+
get_class($nekufa); // Application\Entity\Person;
299299

300-
$mapper->getSchema()->getSpace('person')->getRepository(); // will be instance of Application\Repositories\Person
300+
$mapper->getSchema()->getSpace('person')->getRepository(); // will be instance of Application\Repository\Person
301301
```
302302

303303
## Annotation plugin
304304
You can describe your entities using dobclock. Mapper will create space, format and indexes for you.
305305

306306
```php
307-
namespace Entities;
307+
namespace Entity;
308308

309-
use Tarantool\Mapper\Entity;
309+
use Tarantool\Mapper\Entity as MapperEntity;
310310

311-
class Person extends Entity
311+
class Person extends MapperEntity
312312
{
313313
/**
314314
* @var integer
@@ -321,7 +321,7 @@ class Person extends Entity
321321
public $name;
322322
}
323323

324-
class Post extends Entity
324+
class Post extends MapperEntity
325325
{
326326
/**
327327
* @var integer
@@ -351,11 +351,11 @@ class Post extends Entity
351351
```
352352
If you want to index fields, extend repository and define indexes property
353353
```php
354-
namespace Repositories;
354+
namespace Repository;
355355

356-
use Tarantool\Mapper\Repository;
356+
use Tarantool\Mapper\Repository as MapperRepository;
357357

358-
class Post extends Repository
358+
class Post extends MapperRepository
359359
{
360360
public $indexes = [
361361
['id'],
@@ -372,9 +372,9 @@ Register plugin and all your classes:
372372
```php
373373
$mapper->addPlugin(Tarantool\Mapper\Plugin\Sequence::class); // just not to fill id manually
374374
$mapper->addPlugin(Tarantool\Mapper\Plugin\Annotation::class)
375-
->register(Entities\Person::class)
376-
->register(Entities\Post::class)
377-
->register(Repositories\Person::class)
375+
->register(Entity\Person::class)
376+
->register(Entity\Post::class)
377+
->register(Repository\Person::class)
378378
->migrate(); // sync database schema with code
379379

380380
$nekufa = $mapper->create('person', ['name' => 'dmitry']);

0 commit comments

Comments
 (0)