Beispiel #1
0
 public function setUp()
 {
     parent::setUp();
     $repo = new PostRepository(PostPostType::TYPE);
     $repo->registerEntityMapper(function () use($repo) {
         return new PostEntityMapper($repo);
     });
     $this->repo = $repo;
 }
Beispiel #2
0
<?php

namespace Fire\Model\Post;

use Fire\Model\AbstractPost\AbstractPostEntityMapper;
add_action('fire/services/core', function ($fire) {
    $fire->singleton('post.repository', function ($fire) {
        $repo = new PostRepository(PostPostType::TYPE);
        $repo->registerEntityMapper($fire['abstractpost.entitymapper']);
        $repo->registerEntityMapper(function () use($fire) {
            return new PostEntityMapper($fire['post.repository'], $fire['category.repository'], $fire['tag.repository']);
        });
        return $repo;
    });
});