@@ -88,7 +88,7 @@ |
||
88 | 88 | /** |
89 | 89 | * Creates default mapping driver |
90 | 90 | * |
91 | - * @return \Doctrine\ORM\Mapping\Driver\Driver |
|
91 | + * @return AnnotationDriver |
|
92 | 92 | */ |
93 | 93 | protected function getMetadataDriverImplementation() { |
94 | 94 | return new AnnotationDriver($_ENV['annotation_reader']); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ); |
45 | 45 | $config = null === $config ? $this->getMockAnnotatedConfig() : $config; |
46 | 46 | $em = EntityManager::create($conn, $config, $evm ?: $this->getEventManager()); |
47 | - $schema = array_map(function ($class) use ($em) { |
|
47 | + $schema = array_map(function($class) use ($em) { |
|
48 | 48 | return $em->getClassMetadata($class); |
49 | 49 | }, (array)$this->getUsedEntityFixtures()); |
50 | 50 | $schemaTool = new SchemaTool($em); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $refl = new \ReflectionClass($configurationClass); |
66 | 66 | $methods = $refl->getMethods(); |
67 | 67 | $mockMethods = array(); |
68 | - foreach($methods as $method) { |
|
69 | - if($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') { |
|
68 | + foreach ($methods as $method) { |
|
69 | + if ($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') { |
|
70 | 70 | $mockMethods[] = $method->name; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | $config = $this->getMock($configurationClass, $mockMethods); |
74 | - $config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__ . '/../../temp')); |
|
74 | + $config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__.'/../../temp')); |
|
75 | 75 | $config->expects($this->once())->method('getProxyNamespace')->will($this->returnValue('Proxy')); |
76 | 76 | $config->expects($this->any())->method('getDefaultQueryHints')->will($this->returnValue(array())); |
77 | 77 | $config->expects($this->once())->method('getAutoGenerateProxyClasses')->will($this->returnValue(true)); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager() |
33 | 33 | */ |
34 | 34 | public function setObjectManager(ObjectManager $om) { |
35 | - if($this->objectManager) return; |
|
35 | + if ($this->objectManager) return; |
|
36 | 36 | $this->objectManager = $om; |
37 | 37 | } |
38 | 38 |
@@ -32,7 +32,9 @@ |
||
32 | 32 | * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager() |
33 | 33 | */ |
34 | 34 | public function setObjectManager(ObjectManager $om) { |
35 | - if($this->objectManager) return; |
|
35 | + if($this->objectManager) { |
|
36 | + return; |
|
37 | + } |
|
36 | 38 | $this->objectManager = $om; |
37 | 39 | } |
38 | 40 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $id = $document->getEntityClass(); |
23 | 23 | $id .= '#'; |
24 | 24 | $entityId = $document->getEntityId(); |
25 | - if(is_scalar($entityId)) { |
|
25 | + if (is_scalar($entityId)) { |
|
26 | 26 | $id .= $entityId; |
27 | 27 | } else { |
28 | 28 | $id .= md5(serialize($entityId)); |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @param object $entity |
83 | 83 | */ |
84 | 84 | protected function updateEntity($entity, ObjectManager $manager) { |
85 | - if(!($entity instanceof SearchableEntity)) |
|
85 | + if (!($entity instanceof SearchableEntity)) |
|
86 | 86 | return; |
87 | 87 | $document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($entity); |
88 | - if($entity->indexEntity($document) !== false) { |
|
88 | + if ($entity->indexEntity($document) !== false) { |
|
89 | 89 | $this->getSearchService($manager)->saveDocument($document); |
90 | 90 | } else { |
91 | 91 | $this->getSearchService($manager)->removeDocument($document); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param object $entity |
98 | 98 | */ |
99 | 99 | protected function removeEntity($entity, ObjectManager $manager) { |
100 | - if(!($entity instanceof SearchableEntity)) |
|
100 | + if (!($entity instanceof SearchableEntity)) |
|
101 | 101 | return; |
102 | 102 | $document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($entity); |
103 | 103 | $this->getSearchService($manager)->removeDocument($document); |
@@ -82,8 +82,9 @@ discard block |
||
82 | 82 | * @param object $entity |
83 | 83 | */ |
84 | 84 | protected function updateEntity($entity, ObjectManager $manager) { |
85 | - if(!($entity instanceof SearchableEntity)) |
|
86 | - return; |
|
85 | + if(!($entity instanceof SearchableEntity)) { |
|
86 | + return; |
|
87 | + } |
|
87 | 88 | $document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($entity); |
88 | 89 | if($entity->indexEntity($document) !== false) { |
89 | 90 | $this->getSearchService($manager)->saveDocument($document); |
@@ -97,8 +98,9 @@ discard block |
||
97 | 98 | * @param object $entity |
98 | 99 | */ |
99 | 100 | protected function removeEntity($entity, ObjectManager $manager) { |
100 | - if(!($entity instanceof SearchableEntity)) |
|
101 | - return; |
|
101 | + if(!($entity instanceof SearchableEntity)) { |
|
102 | + return; |
|
103 | + } |
|
102 | 104 | $document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($entity); |
103 | 105 | $this->getSearchService($manager)->removeDocument($document); |
104 | 106 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | * |
52 | 52 | * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity() |
53 | 53 | */ |
54 | - public function indexEntity(Document &$document) { |
|
54 | + public function indexEntity(Document&$document) { |
|
55 | 55 | $document->addField(Document::FIELD_TITLE, $this->getTitle()); |
56 | 56 | return true; |
57 | 57 | } |
@@ -9,12 +9,12 @@ |
||
9 | 9 | define('TESTS_TEMP_DIR', __DIR__.'/temp'); |
10 | 10 | define('VENDOR_PATH', realpath(__DIR__.'/../vendor')); |
11 | 11 | if (!class_exists('PHPUnit_Framework_TestCase') || |
12 | - version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0 |
|
12 | + version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0 |
|
13 | 13 | ) { |
14 | - die('PHPUnit framework is required, at least 3.5 version'); |
|
14 | + die('PHPUnit framework is required, at least 3.5 version'); |
|
15 | 15 | } |
16 | 16 | if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) { |
17 | - die('PHPUnit MockObject plugin is required, at least 1.0.8 version'); |
|
17 | + die('PHPUnit MockObject plugin is required, at least 1.0.8 version'); |
|
18 | 18 | } |
19 | 19 | /** @var $loader ClassLoader */ |
20 | 20 | $loader = require __DIR__.'/../vendor/autoload.php'; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $configuration = new Configuration(); |
32 | 32 | $this->processConfiguration($configuration, $configs); |
33 | 33 | |
34 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
34 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
35 | 35 | $loader->load('services.yml'); |
36 | 36 | } |
37 | 37 | } |
@@ -24,5 +24,5 @@ |
||
24 | 24 | * The document object to be filled with information |
25 | 25 | * @return bool If this entity returns <code>false</code> no information will be indexed |
26 | 26 | */ |
27 | - public function indexEntity(Document &$document); |
|
27 | + public function indexEntity(Document&$document); |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -55,11 +55,11 @@ |
||
55 | 55 | * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField() |
56 | 56 | */ |
57 | 57 | public function addMultiValueField($field, $value) { |
58 | - if(!array_key_exists($field, $this->fields)) { |
|
58 | + if (!array_key_exists($field, $this->fields)) { |
|
59 | 59 | $this->fields[$field] = array( |
60 | 60 | $value |
61 | 61 | ); |
62 | - } else if(!in_array($value, $this->fields[$field])) { |
|
62 | + } else if (!in_array($value, $this->fields[$field])) { |
|
63 | 63 | $this->fields[$field][] = $value; |
64 | 64 | } |
65 | 65 | } |