@@ 16-115 (lines=100) @@ | ||
13 | * @Iterations(10) |
|
14 | * @OutputTimeUnit("milliseconds", precision=2) |
|
15 | */ |
|
16 | class DoctrineOrmBench extends OrmTestCase |
|
17 | { |
|
18 | private $entityManager; |
|
19 | ||
20 | public function setUp() |
|
21 | { |
|
22 | $container = $this->getContainer([ |
|
23 | 'mapping' => [ |
|
24 | Article::class => [ |
|
25 | 'properties' => [ |
|
26 | 'title' => [ |
|
27 | 'type' => 'text', |
|
28 | 'role' => 'title', |
|
29 | ], |
|
30 | 'image' => [ |
|
31 | 'type' => 'image', |
|
32 | 'role' => 'image', |
|
33 | ], |
|
34 | 'slideshow' => [ |
|
35 | 'type' => 'collection', |
|
36 | 'options' => [ |
|
37 | 'field_type' => 'image', |
|
38 | ], |
|
39 | ], |
|
40 | 'date' => [ |
|
41 | 'type' => 'datetime', |
|
42 | ], |
|
43 | 'referencedImage' => [ |
|
44 | 'type' => 'object_reference', |
|
45 | ], |
|
46 | 'paragraphs' => [ |
|
47 | 'type' => 'collection', |
|
48 | 'options' => [ |
|
49 | 'field_type' => 'text', |
|
50 | 'field_options' => [], |
|
51 | ], |
|
52 | ], |
|
53 | 'numbers' => [ |
|
54 | 'type' => 'collection', |
|
55 | 'options' => [ |
|
56 | 'field_type' => 'integer', |
|
57 | ], |
|
58 | ], |
|
59 | ], |
|
60 | ], |
|
61 | ], |
|
62 | ]); |
|
63 | $this->entityManager = $container->get('doctrine.entity_manager'); |
|
64 | $this->initOrm($this->entityManager); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * @Subject() |
|
69 | */ |
|
70 | public function image_phpcr_odm_only() |
|
71 | { |
|
72 | static $id; |
|
73 | $image = new Image( |
|
74 | '/path/to/image', 100, 200, 'image/jpeg' |
|
75 | ); |
|
76 | $image->id = '/test/image' . $id++; |
|
77 | ||
78 | $this->entityManager->persist($image); |
|
79 | $this->entityManager->flush(); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @Subject() |
|
84 | */ |
|
85 | public function ct_article() |
|
86 | { |
|
87 | static $id; |
|
88 | $article = new Article(); |
|
89 | $article->id = '/test/article' . $id++; |
|
90 | $article->title = 'Hello'; |
|
91 | $article->date = new \DateTime('2016-01-01 00:00:00'); |
|
92 | ||
93 | $this->entityManager->persist($article); |
|
94 | $this->entityManager->flush(); |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * @Subject() |
|
99 | */ |
|
100 | public function ct_article_with_image() |
|
101 | { |
|
102 | static $id; |
|
103 | $article = new Article(); |
|
104 | $article->id = '/test/article' . $id++; |
|
105 | $article->title = 'Hello'; |
|
106 | $article->date = new \DateTime('2016-01-01 00:00:00'); |
|
107 | ||
108 | $article->image = new Image( |
|
109 | '/path/to/image', 100, 200, 'image/jpeg' |
|
110 | ); |
|
111 | ||
112 | $this->entityManager->persist($article); |
|
113 | $this->entityManager->flush(); |
|
114 | } |
|
115 | } |
|
116 |
@@ 15-114 (lines=100) @@ | ||
12 | * @Iterations(10) |
|
13 | * @OutputTimeUnit("milliseconds", precision=2) |
|
14 | */ |
|
15 | class DoctrinePhpcrBench extends PhpcrOdmTestCase |
|
16 | { |
|
17 | private $documentManager; |
|
18 | ||
19 | public function setUp() |
|
20 | { |
|
21 | $container = $this->getContainer([ |
|
22 | 'mapping' => [ |
|
23 | Article::class => [ |
|
24 | 'properties' => [ |
|
25 | 'title' => [ |
|
26 | 'type' => 'text', |
|
27 | 'role' => 'title', |
|
28 | ], |
|
29 | 'image' => [ |
|
30 | 'type' => 'image', |
|
31 | 'role' => 'image', |
|
32 | ], |
|
33 | 'slideshow' => [ |
|
34 | 'type' => 'collection', |
|
35 | 'options' => [ |
|
36 | 'field_type' => 'image', |
|
37 | ], |
|
38 | ], |
|
39 | 'date' => [ |
|
40 | 'type' => 'datetime', |
|
41 | ], |
|
42 | 'referencedImage' => [ |
|
43 | 'type' => 'object_reference', |
|
44 | ], |
|
45 | 'paragraphs' => [ |
|
46 | 'type' => 'collection', |
|
47 | 'options' => [ |
|
48 | 'field_type' => 'text', |
|
49 | 'field_options' => [], |
|
50 | ], |
|
51 | ], |
|
52 | 'numbers' => [ |
|
53 | 'type' => 'collection', |
|
54 | 'options' => [ |
|
55 | 'field_type' => 'integer', |
|
56 | ], |
|
57 | ], |
|
58 | ], |
|
59 | ], |
|
60 | ], |
|
61 | ]); |
|
62 | $this->documentManager = $container->get('doctrine_phpcr.document_manager'); |
|
63 | $this->initPhpcr($this->documentManager); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @Subject() |
|
68 | */ |
|
69 | public function image_phpcr_odm_only() |
|
70 | { |
|
71 | static $id; |
|
72 | $image = new Image( |
|
73 | '/path/to/image', 100, 200, 'image/jpeg' |
|
74 | ); |
|
75 | $image->id = '/test/image' . $id++; |
|
76 | ||
77 | $this->documentManager->persist($image); |
|
78 | $this->documentManager->flush(); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @Subject() |
|
83 | */ |
|
84 | public function ct_article() |
|
85 | { |
|
86 | static $id; |
|
87 | $article = new Article(); |
|
88 | $article->id = '/test/article' . $id++; |
|
89 | $article->title = 'Hello'; |
|
90 | $article->date = new \DateTime('2016-01-01 00:00:00'); |
|
91 | ||
92 | $this->documentManager->persist($article); |
|
93 | $this->documentManager->flush(); |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * @Subject() |
|
98 | */ |
|
99 | public function ct_article_with_image() |
|
100 | { |
|
101 | static $id; |
|
102 | $article = new Article(); |
|
103 | $article->id = '/test/article' . $id++; |
|
104 | $article->title = 'Hello'; |
|
105 | $article->date = new \DateTime('2016-01-01 00:00:00'); |
|
106 | ||
107 | $article->image = new Image( |
|
108 | '/path/to/image', 100, 200, 'image/jpeg' |
|
109 | ); |
|
110 | ||
111 | $this->documentManager->persist($article); |
|
112 | $this->documentManager->flush(); |
|
113 | } |
|
114 | } |
|
115 |