aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/JsonApiIntegration/Factory.php
blob: 8cdc6e625800c07318032cd36b9fbed00377c726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

namespace JsonApi\JsonApiIntegration;

use Neomerx\JsonApi\Contracts\Parser\EditableContextInterface;
use Neomerx\JsonApi\Contracts\Parser\ParserInterface;
use Neomerx\JsonApi\Contracts\Representation\FieldSetFilterInterface;
use Neomerx\JsonApi\Contracts\Schema\LinkInterface;
use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
use Neomerx\JsonApi\Factories\Factory as NeomerxFactory;
use Neomerx\JsonApi\Schema\Link;

/**
 * Die "normale" \Neomerx\JsonApi\Factories\Factory stellt in
 * Factory::createParser einen \Neomerx\JsonApi\Encoder\Parser\Parser
 * her. Dieser hat aber Probleme mit Instanzen von \SimpleORMap,
 * sodass diese Factory einen speziellen EncoderParser herstellt, der
 * diese Probleme nicht hat.
 *
 * @see \Neomerx\JsonApi\Factories\Factory
 * @see \Neomerx\JsonApi\Encoder\Parser\Parser
 * @see EncoderParser
 */
class Factory extends NeomerxFactory
{
    /**
     * @inheritdoc
     */
    public function createFieldSetFilter(array $fieldSets): FieldSetFilterInterface
    {
        return new FieldsetFilter($fieldSets);
    }

    /**
     * @inheritdoc
     */
    public function createParser(
        SchemaContainerInterface $container,
        EditableContextInterface $context
    ): ParserInterface {
        return new Parser($this, $container, $context);
    }

    /**
     * @inheritdoc
     */
    public function createSchemaContainer(iterable $schemas): SchemaContainerInterface
    {
        return new SchemaContainer($this, $schemas);
    }
}