1 | <?php |
||
23 | class EntityToDocumentMapper implements EntityToDocumentMapperInterface { |
||
24 | |||
25 | /** |
||
26 | * |
||
27 | * @var SearchService |
||
28 | */ |
||
29 | protected $searchService; |
||
30 | |||
31 | /** |
||
32 | * |
||
33 | * @var string[string] |
||
34 | */ |
||
35 | protected $mapping = array(); |
||
36 | |||
37 | /** |
||
38 | * |
||
39 | * @var string[string] |
||
40 | */ |
||
41 | protected $cachedMapping = array(); |
||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * |
||
46 | * @param SearchService $searchService |
||
47 | */ |
||
48 | public function __construct(SearchService $searchService, array $mapping = array()) { |
||
68 | |||
69 | /** |
||
70 | * |
||
71 | * {@inheritDoc} |
||
72 | * |
||
73 | * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::isIndexable() |
||
74 | */ |
||
75 | public function isIndexable($object) { |
||
84 | |||
85 | /** |
||
86 | * |
||
87 | * {@inheritDoc} |
||
88 | * |
||
89 | * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::isClassIndexable() |
||
90 | */ |
||
91 | public function isClassIndexable($clazz) { |
||
101 | |||
102 | |||
103 | /** |
||
104 | * {@inheritDoc} |
||
105 | * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::createDocument() |
||
106 | */ |
||
107 | public function createDocument(ObjectManager $manager, $object) { |
||
117 | |||
118 | /** |
||
119 | * Fills the given document based on the object |
||
120 | * |
||
121 | * @param Document $document |
||
122 | * @param object $object |
||
123 | * @return boolean |
||
124 | */ |
||
125 | protected function fillDocument(Document &$document, $object) { |
||
136 | |||
137 | /** |
||
138 | * Fetches the mapping for the given object including the mapping of superclasses |
||
139 | * |
||
140 | * @param object $object |
||
141 | * @return \StingerSoft\EntitySearchBundle\Services\string[string] |
||
142 | */ |
||
143 | protected function getMapping($clazz) { |
||
161 | |||
162 | /** |
||
163 | * Returns the search service |
||
164 | * |
||
165 | * @return SearchService |
||
166 | */ |
||
167 | protected function getSearchService(ObjectManager $manager) { |
||
171 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.