@@ -81,7 +81,7 @@ |
||
81 | 81 | /** |
82 | 82 | * Returns class cache configuration |
83 | 83 | * |
84 | - * @param $class |
|
84 | + * @param string $class |
|
85 | 85 | * |
86 | 86 | * @return array|null Null if cache is not enabled for this class (use implementation defaults) |
87 | 87 | */ |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Bankiru\Api\Doctrine\Proxy\ApiCollection; |
8 | 8 | use Bankiru\Api\Doctrine\Proxy\ProxyFactory; |
9 | 9 | use Bankiru\Api\Doctrine\Utility\IdentifierFixer; |
10 | -use Doctrine\Common\Collections\AbstractLazyCollection; |
|
11 | 10 | use Doctrine\Common\Persistence\ObjectRepository; |
12 | 11 | use Doctrine\Common\Proxy\Proxy; |
13 | 12 |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace Bankiru\Api\Doctrine; |
4 | 4 | |
5 | 5 | use Bankiru\Api\Doctrine\Mapping\ApiMetadata; |
6 | -use Bankiru\Api\Doctrine\Proxy\ApiCollection; |
|
7 | -use Doctrine\Common\Collections\Collection; |
|
8 | 6 | use Doctrine\Common\Persistence\ObjectRepository; |
9 | 7 | use ScayTrase\Api\Rpc\RpcClientInterface; |
10 | 8 |
@@ -125,6 +125,9 @@ discard block |
||
125 | 125 | return $this->identifier; |
126 | 126 | } |
127 | 127 | |
128 | + /** |
|
129 | + * @param string[] $identifier |
|
130 | + */ |
|
128 | 131 | public function setIdentifier($identifier) |
129 | 132 | { |
130 | 133 | $this->identifier = $identifier; |
@@ -345,6 +348,9 @@ discard block |
||
345 | 348 | return $this->associations[$fieldName]; |
346 | 349 | } |
347 | 350 | |
351 | + /** |
|
352 | + * @param string $customRepositoryClassName |
|
353 | + */ |
|
348 | 354 | public function setCustomRepositoryClass($customRepositoryClassName) |
349 | 355 | { |
350 | 356 | $this->repositoryClass = $customRepositoryClassName; |
@@ -491,7 +491,7 @@ |
||
491 | 491 | } |
492 | 492 | |
493 | 493 | // Fetch mode. Default fetch mode to LAZY, if not set. |
494 | - if ( ! isset($mapping['fetch'])) { |
|
494 | + if (!isset($mapping['fetch'])) { |
|
495 | 495 | $mapping['fetch'] = self::FETCH_LAZY; |
496 | 496 | } |
497 | 497 |
@@ -188,6 +188,9 @@ discard block |
||
188 | 188 | return $this->snapshot; |
189 | 189 | } |
190 | 190 | |
191 | + /** |
|
192 | + * @param boolean $state |
|
193 | + */ |
|
191 | 194 | public function setInitialized($state) |
192 | 195 | { |
193 | 196 | $this->initialized = (bool)$state; |
@@ -452,7 +455,7 @@ discard block |
||
452 | 455 | * Internal note: Tried to implement Serializable first but that did not work well |
453 | 456 | * with circular references. This solution seems simpler and works well. |
454 | 457 | * |
455 | - * @return array |
|
458 | + * @return string[] |
|
456 | 459 | */ |
457 | 460 | public function __sleep() |
458 | 461 | { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | return array_udiff_assoc( |
205 | 205 | $this->snapshot, |
206 | 206 | $this->collection->toArray(), |
207 | - function ($a, $b) { |
|
207 | + function($a, $b) { |
|
208 | 208 | return $a === $b ? 0 : 1; |
209 | 209 | } |
210 | 210 | ); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | return array_udiff_assoc( |
222 | 222 | $this->collection->toArray(), |
223 | 223 | $this->snapshot, |
224 | - function ($a, $b) { |
|
224 | + function($a, $b) { |
|
225 | 225 | return $a === $b ? 0 : 1; |
226 | 226 | } |
227 | 227 | ); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | private $clients = []; |
29 | 29 | |
30 | 30 | /** |
31 | - * @return mixed |
|
31 | + * @return ClientRegistryInterface |
|
32 | 32 | */ |
33 | 33 | public function getRegistry() |
34 | 34 | { |
@@ -101,14 +101,14 @@ |
||
101 | 101 | $configuration->setRegistry($this->registry); |
102 | 102 | $configuration->setTypeRegistry(new BaseTypeRegistry(new TypeRegistry())); |
103 | 103 | $configuration->setResolver(new ConstructorFactoryResolver()); |
104 | - $configuration->setProxyDir(CACHE_DIR.'/doctrine/proxy/'); |
|
104 | + $configuration->setProxyDir(CACHE_DIR . '/doctrine/proxy/'); |
|
105 | 105 | $configuration->setProxyNamespace('Bankiru\Api\Doctrine\Test\Proxy'); |
106 | 106 | $driver = new MappingDriverChain(); |
107 | 107 | $driver->addDriver( |
108 | 108 | new YmlMetadataDriver( |
109 | 109 | new SymfonyFileLocator( |
110 | 110 | [ |
111 | - __DIR__.'/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity', |
|
111 | + __DIR__ . '/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity', |
|
112 | 112 | ], |
113 | 113 | '.api.yml', |
114 | 114 | DIRECTORY_SEPARATOR |
@@ -167,7 +167,7 @@ |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
170 | - * @param $className |
|
170 | + * @param string $className |
|
171 | 171 | * @param \stdClass $data |
172 | 172 | * |
173 | 173 | * @return ObjectManagerAware|object |
@@ -1683,7 +1683,7 @@ discard block |
||
1683 | 1683 | $class = $this->em->getClassMetadata(get_class($entity)); |
1684 | 1684 | $associationMappings = array_filter( |
1685 | 1685 | $class->associationMappings, |
1686 | - function ($assoc) { |
|
1686 | + function($assoc) { |
|
1687 | 1687 | return $assoc['isCascadeRefresh']; |
1688 | 1688 | } |
1689 | 1689 | ); |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | $class = $this->em->getClassMetadata(get_class($entity)); |
1723 | 1723 | $associationMappings = array_filter( |
1724 | 1724 | $class->associationMappings, |
1725 | - function ($assoc) { |
|
1725 | + function($assoc) { |
|
1726 | 1726 | return $assoc['isCascadeDetach']; |
1727 | 1727 | } |
1728 | 1728 | ); |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | $class = $this->manager->getClassMetadata(get_class($entity)); |
1763 | 1763 | $associationMappings = array_filter( |
1764 | 1764 | $class->getAssociationMappings(), |
1765 | - function ($assoc) { |
|
1765 | + function($assoc) { |
|
1766 | 1766 | return $assoc['isCascadeMerge']; |
1767 | 1767 | } |
1768 | 1768 | ); |
@@ -1800,11 +1800,11 @@ discard block |
||
1800 | 1800 | $class = $this->em->getClassMetadata(get_class($entity)); |
1801 | 1801 | $associationMappings = array_filter( |
1802 | 1802 | $class->associationMappings, |
1803 | - function ($assoc) { |
|
1803 | + function($assoc) { |
|
1804 | 1804 | return $assoc['isCascadeRemove']; |
1805 | 1805 | } |
1806 | 1806 | ); |
1807 | - $entitiesToCascade = []; |
|
1807 | + $entitiesToCascade = []; |
|
1808 | 1808 | foreach ($associationMappings as $assoc) { |
1809 | 1809 | if ($entity instanceof Proxy && !$entity->__isInitialized__) { |
1810 | 1810 | $entity->__load(); |
@@ -24,5 +24,5 @@ |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - public function getEntityKey(ApiMetadata $metadata,array $identifier); |
|
27 | + public function getEntityKey(ApiMetadata $metadata, array $identifier); |
|
28 | 28 | } |
@@ -155,9 +155,9 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | if ($property->isProtected()) { |
158 | - return "\0*\0".$propertyName; |
|
158 | + return "\0*\0" . $propertyName; |
|
159 | 159 | } |
160 | 160 | |
161 | - return "\0".$property->getDeclaringClass()->getName()."\0".$propertyName; |
|
161 | + return "\0" . $property->getDeclaringClass()->getName() . "\0" . $propertyName; |
|
162 | 162 | } |
163 | 163 | } |