Skip to content
Newer
Older
100644 60 lines (52 sloc) 2.58 KB
433fa91 @schmittjoh initial commit
authored Apr 28, 2011
1 <?php
2
3 /*
4 * Copyright 2011 Johannes M. Schmitt <schmittjoh@gmail.com>
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
52bc34a @schmittjoh renamed bundle to SerializerBundle
authored Apr 28, 2011
19 namespace JMS\SerializerBundle;
433fa91 @schmittjoh initial commit
authored Apr 27, 2011
20
12583b1 @lsmith77 added support for PHPCR
lsmith77 authored Nov 25, 2013
21 use JMS\SerializerBundle\DependencyInjection\Compiler\DoctrinePass;
c263aba @schmittjoh made internals more flexible, and powerful
authored Oct 8, 2012
22 use Symfony\Component\DependencyInjection\Compiler\PassConfig;
23 use JMS\SerializerBundle\DependencyInjection\Compiler\CustomHandlersPass;
47a404e @schmittjoh added an event system
authored Oct 5, 2012
24 use JMS\SerializerBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
2864acd @lsmith77 make JMSDiExtraBundle dependency optional
lsmith77 authored Jul 29, 2013
25 use JMS\SerializerBundle\DependencyInjection\Compiler\ServiceMapPass;
b3118f0 @schmittjoh many improvements, see the updated docs
authored May 3, 2011
26 use Symfony\Component\DependencyInjection\ContainerBuilder;
433fa91 @schmittjoh initial commit
authored Apr 27, 2011
27 use Symfony\Component\HttpKernel\Bundle\Bundle;
3e37d88 @schmittjoh made lazy-loading more generic
authored Nov 30, 2012
28 use JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass;
29 use Symfony\Component\DependencyInjection\Definition;
433fa91 @schmittjoh initial commit
authored Apr 27, 2011
30
52bc34a @schmittjoh renamed bundle to SerializerBundle
authored Apr 28, 2011
31 class JMSSerializerBundle extends Bundle
433fa91 @schmittjoh initial commit
authored Apr 27, 2011
32 {
4880923 @schmittjoh cleaned up some code to make use of Symfony 2.1 features
authored Sep 20, 2012
33 public function build(ContainerBuilder $builder)
f4e7664 @schmittjoh backwards compatible config refactoring (fixes #30)
authored Oct 6, 2011
34 {
2864acd @lsmith77 make JMSDiExtraBundle dependency optional
lsmith77 authored Jul 29, 2013
35 $builder->addCompilerPass($this->getServiceMapPass('jms_serializer.serialization_visitor', 'format',
3e37d88 @schmittjoh made lazy-loading more generic
authored Nov 30, 2012
36 function(ContainerBuilder $container, Definition $def) {
37 $container->getDefinition('jms_serializer.serializer')->replaceArgument(3, $def);
38 }
39 ));
2864acd @lsmith77 make JMSDiExtraBundle dependency optional
lsmith77 authored Jul 29, 2013
40 $builder->addCompilerPass($this->getServiceMapPass('jms_serializer.deserialization_visitor', 'format',
3e37d88 @schmittjoh made lazy-loading more generic
authored Nov 30, 2012
41 function(ContainerBuilder $container, Definition $def) {
42 $container->getDefinition('jms_serializer.serializer')->replaceArgument(4, $def);
43 }
44 ));
45
c263aba @schmittjoh made internals more flexible, and powerful
authored Oct 8, 2012
46 $builder->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_REMOVING);
47 $builder->addCompilerPass(new CustomHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING);
12583b1 @lsmith77 added support for PHPCR
lsmith77 authored Nov 25, 2013
48 $builder->addCompilerPass(new DoctrinePass(), PassConfig::TYPE_BEFORE_REMOVING);
f4e7664 @schmittjoh backwards compatible config refactoring (fixes #30)
authored Oct 6, 2011
49 }
2864acd @lsmith77 make JMSDiExtraBundle dependency optional
lsmith77 authored Jul 29, 2013
50
51 private function getServiceMapPass($tagName, $keyAttributeName, $callable)
52 {
53 if (class_exists('JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass')) {
54 return new LazyServiceMapPass($tagName, $keyAttributeName, $callable);
55 }
56
57 return new ServiceMapPass($tagName, $keyAttributeName, $callable);
58 }
730ad94 @lsmith77 made the handling of Doctrine proxies generic
lsmith77 authored Dec 12, 2011
59 }
Something went wrong with that request. Please try again.