@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | $this->container = $container; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - private function checkOptions(array $object, $field){ |
|
| 37 | - if(!isset($object['fields']) || !isset($object['fields'][$field])){ |
|
| 36 | + private function checkOptions(array $object, $field) { |
|
| 37 | + if (!isset($object['fields']) || !isset($object['fields'][$field])) { |
|
| 38 | 38 | return false; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $fields = ['class', 'type']; |
| 42 | - foreach($fields as $type){ |
|
| 43 | - if(!isset($object['fields'][$field][$type])){ |
|
| 42 | + foreach ($fields as $type) { |
|
| 43 | + if (!isset($object['fields'][$field][$type])) { |
|
| 44 | 44 | $object['ields'][$field][$type] = constant('self::DEFAULT_'.strtoupper($type)); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -55,20 +55,20 @@ discard block |
||
| 55 | 55 | $entities = $this->container->getParameter('sludio_helper.translatable.entities'); |
| 56 | 56 | $entity = null; |
| 57 | 57 | $className = $admin->getClass(); |
| 58 | - foreach($entities as $entity){ |
|
| 59 | - if($entity['entity'] === $className){ |
|
| 58 | + foreach ($entities as $entity) { |
|
| 59 | + if ($entity['entity'] === $className) { |
|
| 60 | 60 | break; |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($entity === null){ |
|
| 64 | + if ($entity === null) { |
|
| 65 | 65 | throw new \Exception('No entities defined'); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $id = $admin->getSubject()->getId(); |
| 69 | 69 | $fieldName = $builder->getName(); |
| 70 | 70 | |
| 71 | - if(!$this->checkOptions($entity, $fieldName)){ |
|
| 71 | + if (!$this->checkOptions($entity, $fieldName)) { |
|
| 72 | 72 | throw new \Exception('No fields defined for this entity'); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -33,14 +33,15 @@ discard block |
||
| 33 | 33 | $this->container = $container; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - private function checkOptions(array $object, $field){ |
|
| 37 | - if(!isset($object['fields']) || !isset($object['fields'][$field])){ |
|
| 36 | + private function checkOptions(array $object, $field) |
|
| 37 | + { |
|
| 38 | + if(!isset($object['fields']) || !isset($object['fields'][$field])) { |
|
| 38 | 39 | return false; |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | $fields = ['class', 'type']; |
| 42 | - foreach($fields as $type){ |
|
| 43 | - if(!isset($object['fields'][$field][$type])){ |
|
| 43 | + foreach($fields as $type) { |
|
| 44 | + if(!isset($object['fields'][$field][$type])) { |
|
| 44 | 45 | $object['ields'][$field][$type] = constant('self::DEFAULT_'.strtoupper($type)); |
| 45 | 46 | } |
| 46 | 47 | } |
@@ -55,20 +56,20 @@ discard block |
||
| 55 | 56 | $entities = $this->container->getParameter('sludio_helper.translatable.entities'); |
| 56 | 57 | $entity = null; |
| 57 | 58 | $className = $admin->getClass(); |
| 58 | - foreach($entities as $entity){ |
|
| 59 | - if($entity['entity'] === $className){ |
|
| 59 | + foreach($entities as $entity) { |
|
| 60 | + if($entity['entity'] === $className) { |
|
| 60 | 61 | break; |
| 61 | 62 | } |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | - if($entity === null){ |
|
| 65 | + if($entity === null) { |
|
| 65 | 66 | throw new \Exception('No entities defined'); |
| 66 | 67 | } |
| 67 | 68 | |
| 68 | 69 | $id = $admin->getSubject()->getId(); |
| 69 | 70 | $fieldName = $builder->getName(); |
| 70 | 71 | |
| 71 | - if(!$this->checkOptions($entity, $fieldName)){ |
|
| 72 | + if(!$this->checkOptions($entity, $fieldName)) { |
|
| 72 | 73 | throw new \Exception('No fields defined for this entity'); |
| 73 | 74 | } |
| 74 | 75 | |