Ver Fonte

Se agrega el campor extraData a los dispositivos

Guillermo Espinoza há 8 anos atrás
pai
commit
dec95fc1fe

+ 1 - 0
app/AppKernel.php

@@ -32,6 +32,7 @@ class AppKernel extends Kernel
             new Base\AdminBundle\BaseAdminBundle(),
             new Base\OAuthClientBundle\BaseOAuthClientBundle(),
             new DeviceBundle\DeviceBundle(),
+            new ExtraDataBundle\ExtraDataBundle(),
             
             new StatsBundle\StatsBundle(),
         ];

+ 1 - 0
app/config/config.yml

@@ -10,6 +10,7 @@ imports:
     - { resource: "@BaseOAuthClientBundle/Resources/config/hwioauthbundle/services.yml" }
     - { resource: "@BaseOAuthClientBundle/Resources/config/hwioauthbundle/config.yml" }
     - { resource: "@WebserviceBundle/Resources/config/services.yml" }
+    - { resource: "@ExtraDataBundle/Resources/config/services.yml" }
     
     - { resource: "@StatsBundle/Resources/config/services.yml" }
 

+ 9 - 1
composer.json

@@ -47,6 +47,13 @@
             "options": {
                     "local_pk": "./keys/bitbucket.id_rsa"
             }
+        },
+        {
+            "type": "vcs",
+            "url":  "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
+            "options": {
+                    "local_pk": "./keys/bitbucket.id_rsa"
+            }
         }
     ],
     "require": {
@@ -72,7 +79,8 @@
         "ik/base-admin-bundle": "dev-master",
         "ik/oauthclient-bundle": "dev-master",
         "ik/webservice-bundle": "dev-master",
-        "ik/device-bundle": "dev-master"
+        "ik/device-bundle": "dev-master",
+        "ik/extra-data-bundle": "dev-master"
     },
     "require-dev": {
         "sensio/generator-bundle": "^3.0",

+ 26 - 2
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "85cafc69f977f2b38ce922b9e76ca6b3",
+    "content-hash": "d437b2d7dd14efe56b03f5c0967da8de",
     "packages": [
         {
             "name": "behat/transliterator",
@@ -1302,6 +1302,29 @@
             ],
             "time": "2017-05-30 18:33:01"
         },
+        {
+            "name": "ik/extra-data-bundle",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
+                "reference": "a5a6158cd382490cafd6510334cc63fc50865a58"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "ExtraDataBundle\\": ""
+                }
+            },
+            "description": "Flowdat 3 Extra Data Bundle",
+            "keywords": [
+                "Admin Generator",
+                "admin",
+                "bundle",
+                "extra-data"
+            ],
+            "time": "2017-05-29 15:02:46"
+        },
         {
             "name": "ik/oauthclient-bundle",
             "version": "dev-master",
@@ -5418,7 +5441,8 @@
         "ik/base-admin-bundle": 20,
         "ik/oauthclient-bundle": 20,
         "ik/webservice-bundle": 20,
-        "ik/device-bundle": 20
+        "ik/device-bundle": 20,
+        "ik/extra-data-bundle": 20
     },
     "prefer-stable": false,
     "prefer-lowest": false,

+ 3 - 0
src/StatsBundle/Admin/StatsDeviceAdmin.php

@@ -34,6 +34,7 @@ class StatsDeviceAdmin extends BaseAdmin
                 ->add('deviceId')
                 ->add('deviceType')
                 ->add('ip')
+                ->add('extraData')
                 ->add('_action', null, array(
                     'actions' => array(
                         'show' => array(),
@@ -57,6 +58,7 @@ class StatsDeviceAdmin extends BaseAdmin
                     'help' => $this->trans('help.deviceTypes'),
                 ))
                 ->add('ip')
+                ->add('extraData')
         ;
     }
 
@@ -69,6 +71,7 @@ class StatsDeviceAdmin extends BaseAdmin
                 ->add('deviceId')
                 ->add('deviceType')
                 ->add('ip')
+                ->add('extraData')
         ;
     }
 

+ 1 - 1
src/StatsBundle/Command/StatsDevicesCommand.php

@@ -31,7 +31,7 @@ class StatsDevicesCommand extends ContainerAwareCommand
         if (count($devices)) {
             $output->writeln('Nuevos StatsDevice:');
             foreach ($devices as $device) {
-                $output->writeln(sprintf('<info>DeviceType:</info> %s <info>DeviceIp:</info> %s', $device->getDeviceType(), $device->getIp()));
+                $output->writeln(sprintf('<info>DeviceType:</info> %s <info>DeviceId:</info> %s <info>Ip:</info> %s', $device->getDeviceType(), $device->getDeviceId(), $device->getIp()));
             }
         } else {
             $output->writeln('No hay nuevos StatsDevice');

+ 3 - 0
src/StatsBundle/Entity/StatsDevice.php

@@ -3,6 +3,7 @@
 namespace StatsBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
+use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 use Symfony\Component\Validator\Constraints as Assert;
 
@@ -15,6 +16,8 @@ use Symfony\Component\Validator\Constraints as Assert;
 class StatsDevice
 {
 
+    use ExtraDataTrait;
+    
     /**
      * @var int
      *

+ 4 - 2
src/StatsBundle/Services/DeviceManager.php

@@ -101,8 +101,10 @@ class DeviceManager
             $device->setDeviceType($deviceType);
             $device->setDeviceId($deviceId);
             foreach ($data as $column => $value) {
-                $method = 'set'.ucfirst($column);  
-                $device->$method($value);
+                $method = 'set'.ucfirst($column);
+                if (method_exists($device, $method)) {
+                    $device->$method($value);
+                }
             }
 
             if ($this->validator->validate($device)->count() == 0) {