Jelajahi Sumber

Se agrego la propiedad capacity a los NAP

Se agrego la migración para el alter de las tablas
gabriel 7 tahun lalu
induk
melakukan
387a8abc83

+ 36 - 0
app/DoctrineMigrations/Version20180321184546.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use MigrationsBundle\Migrations\MigrationsBase;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+class Version20180321184546 extends MigrationsBase
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        if (!$this->existFieldInTable("nap", "capacity")) {
+            $this->addSql("ALTER TABLE nap ADD capacity INT NOT NULL;");
+        }
+        if (!$this->existFieldInTable("nap_audit", "capacity")) {
+            $this->addSql("ALTER TABLE nap_audit ADD capacity INT DEFAULT NULL;");
+        }
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        // this down() migration is auto-generated, please modify it to your needs
+
+    }
+}

+ 1 - 1
composer.json

@@ -145,7 +145,7 @@
         "ik/auth-bundle": "dev-master",
         "ik/base-admin-bundle": "dev-master",
         "ik/device-bundle": "dev-master",
-        "ik/extra-data-bundle": "dev-master",
+        "ik/extra-data-bundle": "dev-FD3-505",
         "ik/leaflet-bundle": "dev-master",
         "ik/map-bundle": "dev-master",
         "ik/migrations-bundle": "dev-master",

+ 97 - 120
composer.lock

@@ -4,29 +4,28 @@
         "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": "9b31b4228d27af3a18f18aa525037fbb",
+    "content-hash": "fcbd13ca73fa10dbb3b83febccc2f3f2",
     "packages": [
         {
             "name": "behat/gherkin",
-            "version": "v4.5.1",
+            "version": "v4.4.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Behat/Gherkin.git",
-                "reference": "74ac03d52c5e23ad8abd5c5cce4ab0e8dc1b530a"
+                "reference": "6b3f8cf3560dc4909c4cddd4f1af3e1f6e9d80af"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/behat/gherkin/behat-gherkin-74ac03d52c5e23ad8abd5c5cce4ab0e8dc1b530a-zip-8001a5.zip",
-                "reference": "74ac03d52c5e23ad8abd5c5cce4ab0e8dc1b530a",
-                "shasum": "70d092a9ccc486973e758185544ec58388726cc0"
+                "url": "https://satis.infra.flowdat.com/dist/behat/gherkin/behat-gherkin-6b3f8cf3560dc4909c4cddd4f1af3e1f6e9d80af-zip-e97b78.zip",
+                "reference": "6b3f8cf3560dc4909c4cddd4f1af3e1f6e9d80af",
+                "shasum": "d3b04e1a949a6d70d5cf99414c13c99c61c4b70b"
             },
             "require": {
                 "php": ">=5.3.1"
             },
             "require-dev": {
-                "phpunit/phpunit": "~4.5|~5",
-                "symfony/phpunit-bridge": "~2.7|~3",
-                "symfony/yaml": "~2.3|~3"
+                "phpunit/phpunit": "~4.0",
+                "symfony/yaml": "~2.1"
             },
             "suggest": {
                 "symfony/yaml": "If you want to parse features, represented in YAML files"
@@ -63,7 +62,7 @@
                 "gherkin",
                 "parser"
             ],
-            "time": "2017-08-30T11:04:43+00:00"
+            "time": "2015-09-29T13:41:19+00:00"
         },
         {
             "name": "behat/transliterator",
@@ -261,16 +260,16 @@
         },
         {
             "name": "codeception/phpunit-wrapper",
-            "version": "6.0.8",
+            "version": "6.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Codeception/phpunit-wrapper.git",
-                "reference": "e18f3ea1f841bfd2cecaf6e183e584127b9d467b"
+                "reference": "412645f52bf67bb2b8e2282e3fe71e526e7af7e9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/e18f3ea1f841bfd2cecaf6e183e584127b9d467b",
-                "reference": "e18f3ea1f841bfd2cecaf6e183e584127b9d467b",
+                "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/412645f52bf67bb2b8e2282e3fe71e526e7af7e9",
+                "reference": "412645f52bf67bb2b8e2282e3fe71e526e7af7e9",
                 "shasum": ""
             },
             "require": {
@@ -279,13 +278,6 @@
                 "sebastian/comparator": ">1.1 <3.0",
                 "sebastian/diff": ">=1.4 <4.0"
             },
-            "replace": {
-                "codeception/phpunit-wrapper": "*"
-            },
-            "require-dev": {
-                "codeception/specify": "*",
-                "vlucas/phpdotenv": "^2.4"
-            },
             "type": "library",
             "autoload": {
                 "psr-4": {
@@ -303,7 +295,7 @@
                 }
             ],
             "description": "PHPUnit classes used by Codeception",
-            "time": "2018-03-16T10:17:47+00:00"
+            "time": "2018-02-18T20:05:08+00:00"
         },
         {
             "name": "codeception/stub",
@@ -1320,40 +1312,31 @@
         },
         {
             "name": "facebook/webdriver",
-            "version": "1.5.0",
+            "version": "1.1.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/facebook/php-webdriver.git",
-                "reference": "86b5ca2f67173c9d34340845dd690149c886a605"
+                "reference": "b7186fb1bcfda956d237f59face250d06ef47253"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/facebook/webdriver/facebook-webdriver-86b5ca2f67173c9d34340845dd690149c886a605-zip-8aac28.zip",
-                "reference": "86b5ca2f67173c9d34340845dd690149c886a605",
-                "shasum": "8f5578414cf465a7dbc9941ee40c503a31a2b447"
+                "url": "https://satis.infra.flowdat.com/dist/facebook/webdriver/facebook-webdriver-b7186fb1bcfda956d237f59face250d06ef47253-zip-18ca05.zip",
+                "reference": "b7186fb1bcfda956d237f59face250d06ef47253",
+                "shasum": "133a9febdb36e2b0ba1216264f96c9db38124d72"
             },
             "require": {
                 "ext-curl": "*",
-                "ext-zip": "*",
-                "php": "^5.6 || ~7.0",
-                "symfony/process": "^2.8 || ^3.1 || ^4.0"
+                "php": ">=5.3.19"
             },
             "require-dev": {
-                "friendsofphp/php-cs-fixer": "^2.0",
-                "guzzle/guzzle": "^3.4.1",
-                "php-coveralls/php-coveralls": "^1.0.2",
-                "php-mock/php-mock-phpunit": "^1.1",
-                "phpunit/phpunit": "^5.7",
-                "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0",
-                "squizlabs/php_codesniffer": "^2.6",
-                "symfony/var-dumper": "^3.3 || ^4.0"
+                "friendsofphp/php-cs-fixer": "^1.11",
+                "phpunit/phpunit": "4.6.* || ~5.0",
+                "squizlabs/php_codesniffer": "^2.6"
             },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-community": "1.5-dev"
-                }
+            "suggest": {
+                "phpdocumentor/phpdocumentor": "2.*"
             },
+            "type": "library",
             "autoload": {
                 "psr-4": {
                     "Facebook\\WebDriver\\": "lib/"
@@ -1363,7 +1346,7 @@
             "license": [
                 "Apache-2.0"
             ],
-            "description": "A PHP client for Selenium WebDriver",
+            "description": "A PHP client for WebDriver",
             "homepage": "https://github.com/facebook/php-webdriver",
             "keywords": [
                 "facebook",
@@ -1371,7 +1354,7 @@
                 "selenium",
                 "webdriver"
             ],
-            "time": "2017-11-15T11:08:09+00:00"
+            "time": "2016-08-10T00:44:08+00:00"
         },
         {
             "name": "fig/link-util",
@@ -1594,44 +1577,44 @@
         },
         {
             "name": "guzzlehttp/guzzle",
-            "version": "6.3.0",
+            "version": "4.1.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
+                "reference": "5ae164dae6e65784286a698800190bc094407f7c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/guzzle/guzzlehttp-guzzle-f4db5a78a5ea468d4831de7f0bf9d9415e348699-zip-0545a4.zip",
-                "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
-                "shasum": "e2abcab669e2c13b23774519d8148c6959747495"
+                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/guzzle/guzzlehttp-guzzle-5ae164dae6e65784286a698800190bc094407f7c-zip-b5b34c.zip",
+                "reference": "5ae164dae6e65784286a698800190bc094407f7c",
+                "shasum": "4125b21b6434edcbe1b06d7d73103c2b40f88e39"
             },
             "require": {
-                "guzzlehttp/promises": "^1.0",
-                "guzzlehttp/psr7": "^1.4",
-                "php": ">=5.5"
+                "ext-json": "*",
+                "guzzlehttp/streams": "~1.4",
+                "php": ">=5.4.0"
             },
             "require-dev": {
                 "ext-curl": "*",
-                "phpunit/phpunit": "^4.0 || ^5.0",
-                "psr/log": "^1.0"
+                "phpunit/phpunit": "~4.0",
+                "psr/log": "~1.0"
             },
             "suggest": {
-                "psr/log": "Required for using the Log middleware"
+                "ext-curl": "Guzzle will use specific adapters if cURL is present"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "6.2-dev"
+                    "dev-master": "4.1.x-dev"
                 }
             },
             "autoload": {
-                "files": [
-                    "src/functions_include.php"
-                ],
                 "psr-4": {
                     "GuzzleHttp\\": "src/"
-                }
+                },
+                "files": [
+                    "src/functions.php"
+                ]
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
@@ -1644,7 +1627,7 @@
                     "homepage": "https://github.com/mtdowling"
                 }
             ],
-            "description": "Guzzle is a PHP HTTP client library",
+            "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
             "homepage": "http://guzzlephp.org/",
             "keywords": [
                 "client",
@@ -1655,24 +1638,28 @@
                 "rest",
                 "web service"
             ],
-            "time": "2017-06-22T18:50:49+00:00"
+            "time": "2014-07-23T00:52:39+00:00"
         },
         {
-            "name": "guzzlehttp/promises",
-            "version": "v1.3.1",
+            "name": "guzzlehttp/psr7",
+            "version": "1.0.0",
             "source": {
                 "type": "git",
-                "url": "https://github.com/guzzle/promises.git",
-                "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
+                "url": "https://github.com/guzzle/psr7.git",
+                "reference": "19e510056d8d671d9d9e25dc16937b3dd3802ae6"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/promises/guzzlehttp-promises-a59da6cf61d80060647ff4d3eb2c03a2bc694646-zip-081b1f.zip",
-                "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
-                "shasum": "912c139f6ee6058525d198a1a23237c61607f2f3"
+                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/psr7/guzzlehttp-psr7-19e510056d8d671d9d9e25dc16937b3dd3802ae6-zip-60dd1c.zip",
+                "reference": "19e510056d8d671d9d9e25dc16937b3dd3802ae6",
+                "shasum": "b1b0a8d2050ba150a216cac5402b4fa53c0f030e"
             },
             "require": {
-                "php": ">=5.5.0"
+                "php": ">=5.4.0",
+                "psr/http-message": "^1.0"
+            },
+            "provide": {
+                "psr/http-message-implementation": "1.0"
             },
             "require-dev": {
                 "phpunit/phpunit": "^4.0"
@@ -1680,15 +1667,15 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.4-dev"
+                    "dev-master": "1.0-dev"
                 }
             },
             "autoload": {
                 "psr-4": {
-                    "GuzzleHttp\\Promise\\": "src/"
+                    "GuzzleHttp\\Psr7\\": "src/"
                 },
                 "files": [
-                    "src/functions_include.php"
+                    "src/functions.php"
                 ]
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1702,32 +1689,31 @@
                     "homepage": "https://github.com/mtdowling"
                 }
             ],
-            "description": "Guzzle promises library",
+            "description": "PSR-7 message implementation",
             "keywords": [
-                "promise"
+                "http",
+                "message",
+                "stream",
+                "uri"
             ],
-            "time": "2016-12-20T10:07:11+00:00"
+            "time": "2015-05-19T17:58:45+00:00"
         },
         {
-            "name": "guzzlehttp/psr7",
-            "version": "1.4.2",
+            "name": "guzzlehttp/streams",
+            "version": "1.4.0",
             "source": {
                 "type": "git",
-                "url": "https://github.com/guzzle/psr7.git",
-                "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
+                "url": "https://github.com/guzzle/streams.git",
+                "reference": "3b761a328e5ed6ed519e960aded95d7acbe77894"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/psr7/guzzlehttp-psr7-f5b8a8512e2b58b0071a7280e39f14f72e05d87c-zip-307522.zip",
-                "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
-                "shasum": "c101637ad3b7d78d92c10fa94a24978faba7b94e"
+                "url": "https://satis.infra.flowdat.com/dist/guzzlehttp/streams/guzzlehttp-streams-3b761a328e5ed6ed519e960aded95d7acbe77894-zip-32558a.zip",
+                "reference": "3b761a328e5ed6ed519e960aded95d7acbe77894",
+                "shasum": "0838c2739bcf02cba9649b00c275a02e523bb41d"
             },
             "require": {
-                "php": ">=5.4.0",
-                "psr/http-message": "~1.0"
-            },
-            "provide": {
-                "psr/http-message-implementation": "1.0"
+                "php": ">=5.4.0"
             },
             "require-dev": {
                 "phpunit/phpunit": "~4.0"
@@ -1735,15 +1721,15 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.4-dev"
+                    "dev-master": "1.4.x-dev"
                 }
             },
             "autoload": {
                 "psr-4": {
-                    "GuzzleHttp\\Psr7\\": "src/"
+                    "GuzzleHttp\\Stream\\": "src/"
                 },
                 "files": [
-                    "src/functions_include.php"
+                    "src/functions.php"
                 ]
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1755,23 +1741,15 @@
                     "name": "Michael Dowling",
                     "email": "mtdowling@gmail.com",
                     "homepage": "https://github.com/mtdowling"
-                },
-                {
-                    "name": "Tobias Schultze",
-                    "homepage": "https://github.com/Tobion"
                 }
             ],
-            "description": "PSR-7 message implementation that also provides common utility methods",
+            "description": "Provides a simple abstraction over streams of data (Guzzle 4+)",
+            "homepage": "http://guzzlephp.org/",
             "keywords": [
-                "http",
-                "message",
-                "request",
-                "response",
-                "stream",
-                "uri",
-                "url"
+                "Guzzle",
+                "stream"
             ],
-            "time": "2017-03-20T17:10:46+00:00"
+            "time": "2014-07-19T18:43:42+00:00"
         },
         {
             "name": "hwi/oauth-bundle",
@@ -2018,11 +1996,11 @@
         },
         {
             "name": "ik/extra-data-bundle",
-            "version": "dev-master",
+            "version": "dev-FD3-505",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
-                "reference": "06741a4abbe823cc750f3b1d746745a1ab934a60"
+                "reference": "3edde915ed7f3a02a10640913c3a33bda72aaa2b"
             },
             "type": "library",
             "autoload": {
@@ -2037,7 +2015,7 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2018-03-15T12:49:20+00:00"
+            "time": "2018-03-22T18:09:25+00:00"
         },
         {
             "name": "ik/leaflet-bundle",
@@ -2188,7 +2166,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/TR069Bundle.git",
-                "reference": "94876950bd48fc135fd1522fc36a0d60e5b2ca1b"
+                "reference": "1fcb1a4a4b59eb9940d6ba5e2531337ee48cc559"
             },
             "require": {
                 "ext-curl": "*"
@@ -2200,7 +2178,7 @@
                 }
             },
             "description": "The Flowdat3 TR069",
-            "time": "2018-03-20T18:24:45+00:00"
+            "time": "2018-03-22T13:10:11+00:00"
         },
         {
             "name": "ik/webservice-bundle",
@@ -2229,7 +2207,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
-                "reference": "9c70562562d4513c38873c958d588f5bedf5fda0"
+                "reference": "d868429d372fbf3e3498816187efb1e864f9bbf9"
             },
             "require": {
                 "php-amqplib/rabbitmq-bundle": "^1.12"
@@ -2259,7 +2237,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2018-02-19T13:50:00+00:00"
+            "time": "2018-03-22T13:09:04+00:00"
         },
         {
             "name": "incenteev/composer-parameter-handler",
@@ -4004,17 +3982,17 @@
         },
         {
             "name": "psr/http-message",
-            "version": "1.0.1",
+            "version": "1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/php-fig/http-message.git",
-                "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/psr/http-message/psr-http-message-f6561bf28d520154e4b0ec72be95418abe6d9363-zip-7ab320.zip",
-                "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
-                "shasum": "a1f215f8ada1efa09c9b308e52301c1f55ee67d9"
+                "url": "https://satis.infra.flowdat.com/dist/psr/http-message/psr-http-message-85d63699f0dbedb190bbd4b0d2b9dc707ea4c298-zip-13c6c1.zip",
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+                "shasum": "7e0ce25498614088664b8146e4671af374bdb31a"
             },
             "require": {
                 "php": ">=5.3.0"
@@ -4041,7 +4019,6 @@
                 }
             ],
             "description": "Common interface for HTTP messages",
-            "homepage": "https://github.com/php-fig/http-message",
             "keywords": [
                 "http",
                 "http-message",
@@ -4050,7 +4027,7 @@
                 "request",
                 "response"
             ],
-            "time": "2016-08-06T14:39:51+00:00"
+            "time": "2015-05-04T20:22:00+00:00"
         },
         {
             "name": "psr/link",
@@ -6769,7 +6746,7 @@
         "voryx/restgeneratorbundle": 20
     },
     "prefer-stable": false,
-    "prefer-lowest": false,
+    "prefer-lowest": true,
     "platform": {
         "php": ">=5.5.9"
     },

+ 30 - 20
src/FTTHBundle/Admin/NAPAdmin.php

@@ -23,7 +23,7 @@ class NAPAdmin extends BaseAdmin
             ->add('slot')
             ->add('link')
             ->add('address')
-                ;
+            ->add('capacity');
     }
 
     /**
@@ -38,6 +38,7 @@ class NAPAdmin extends BaseAdmin
             ->add('slot')
             ->add('link')
             ->add('address')
+            ->add('capacity')
             ->add('onus')
             ->add('extraData')
             ->add('_action', null, array(
@@ -55,24 +56,24 @@ class NAPAdmin extends BaseAdmin
     protected function configureFormFields(FormMapper $formMapper)
     {
         $formMapper
-        ->tab('default')
-        ->with('')
-        ->add('name')
-        ->add('parent')
-        ->add('olt')
-        ->add('slot')
-        ->add('link')
-        ->add('address', 'text', [
-            'required' => false,
-        ])
-        ->end()
-        ->end()
-        ->tab('Avanzado')
-        ->with('Config')
-        ->add('extraData')
-        ->end()
-        ->end()
-            ;
+            ->tab('default')
+            ->with('')
+            ->add('name')
+            ->add('parent')
+            ->add('olt')
+            ->add('slot')
+            ->add('capacity')
+            ->add('link')
+            ->add('address', 'text', [
+                'required' => false,
+            ])
+            ->end()
+            ->end()
+            ->tab('Avanzado')
+            ->with('Config')
+            ->add('extraData')
+            ->end()
+            ->end();
     }
 
     /**
@@ -81,14 +82,23 @@ class NAPAdmin extends BaseAdmin
     protected function configureShowFields(ShowMapper $showMapper)
     {
         $showMapper
+            ->tab('default')
+            ->with('')
             ->add('name')
             ->add('parent')
             ->add('olt')
             ->add('slot')
+            ->add('capacity')
             ->add('link')
             ->add('address')
             ->add('onus')
-            ->add('extraData');
+            ->end()
+            ->end()
+            ->tab('Avanzado')
+            ->with('Config')
+            ->add('extraData')
+            ->end()
+            ->end();
     }
 
 }

+ 81 - 26
src/FTTHBundle/Entity/NAP.php

@@ -4,7 +4,9 @@ namespace FTTHBundle\Entity;
 
 use Base\AdminBundle\Traits\TenancyIdTrait;
 use Base\AdminBundle\Traits\TenancyIdTraitInterface;
+use Doctrine\ORM\Event\PreUpdateEventArgs;
 use Doctrine\ORM\Mapping as ORM;
+use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
 use ExtraDataBundle\Entity\Traits\ExtraDataWithParentTrait;
 use JMS\Serializer\Annotation as JMS;
 use MapBundle\Entity\Interfaces\LocationInterface;
@@ -15,6 +17,7 @@ use Symfony\Component\Validator\Constraints as Assert;
 /**
  * @ORM\Table
  * @ORM\Entity
+ * @HasLifecycleCallbacks
  */
 class NAP implements TenancyIdTraitInterface, LocationInterface
 {
@@ -96,7 +99,12 @@ class NAP implements TenancyIdTraitInterface, LocationInterface
      * @ORM\Column(type="string", length=255, nullable=true)
      */
     protected $address;
-
+    /**
+     * @var int
+     *
+     * @ORM\Column(type="integer")
+     */
+    protected $capacity;
 
     /**
      * @return string
@@ -196,9 +204,31 @@ class NAP implements TenancyIdTraitInterface, LocationInterface
      */
     public function getCapacity()
     {
-        return $this->getData('capacity') ? $this->getData('capacity') : self::MAX_NUMBER_ONU;
+
+        if ($this->capacity) {
+            $capacity = $this->capacity;
+        } else {
+            if ($this->getData('capacity')) {
+                $capacity = $this->getData('capacity');
+            } else {
+                $capacity = self::MAX_NUMBER_ONU;
+            }
+        }
+        $this->setCapacity($capacity);
+        return $capacity;
     }
 
+    /**
+     * @param int $capacity
+     * @return NAP
+     */
+    public function setCapacity($capacity)
+    {
+        $this->capacity = $capacity;
+        return $this;
+    }
+
+
     /**
      * @return OLT
      */
@@ -258,41 +288,43 @@ class NAP implements TenancyIdTraitInterface, LocationInterface
         return $this;
     }
 
-    public function getlat(){
-	   // if($this->location->lat) return $this->location->lat;
-	if($l = $this->getLocation()){
-		$le = $l->jsonExtraData();
-		if(isset($le["lat"])){
-			return $le["lat"];
-		}
-	}
-	return $this->lat;
+    public function getlat()
+    {
+        // if($this->location->lat) return $this->location->lat;
+        if ($l = $this->getLocation()) {
+            $le = $l->jsonExtraData();
+            if (isset($le["lat"])) {
+                return $le["lat"];
+            }
+        }
+        return $this->lat;
     }
 
-    public function getlng(){
-	    //if($this->location->lng) return $this->location->lng;
-	    if($l = $this->getLocation()){
-		    $le = $l->jsonExtraData();
-		    if(isset($le["lng"])){
-			    return $le["lng"];
-		    }
-	    }
-	    return $this->lng;
+    public function getlng()
+    {
+        //if($this->location->lng) return $this->location->lng;
+        if ($l = $this->getLocation()) {
+            $le = $l->jsonExtraData();
+            if (isset($le["lng"])) {
+                return $le["lng"];
+            }
+        }
+        return $this->lng;
     }
 
     /**
-    * @return string
-    */
+     * @return string
+     */
     public function getAddress()
     {
         return $this->address;
     }
 
     /**
-    * @param string $address
-    *
-    * @return Nap
-    */
+     * @param string $address
+     *
+     * @return Nap
+     */
     public function setAddress($address)
     {
         $this->address = $address;
@@ -300,4 +332,27 @@ class NAP implements TenancyIdTraitInterface, LocationInterface
         return $this;
     }
 
+    /**
+     * @ORM\PrePersist()
+     */
+    public function prePersist()
+    {
+        if ($this->capacity) {
+            $json = json_decode($this->getExtraData(), true);
+            $json['capacity'] = $this->getCapacity();
+            $this->setExtraData(json_encode($json));
+        }
+    }
+
+    /**
+     * @ORM\PreUpdate()
+     */
+    public function preUpdate()
+    {
+        if ($this->capacity) {
+            $json = json_decode($this->getExtraData(), true);
+            $json['capacity'] = $this->getCapacity();
+            $this->setExtraData(json_encode($json));
+        }
+    }
 }

+ 5 - 1
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml

@@ -46,7 +46,8 @@ filter:
     label_slot: Slot
     label_link: Link
     label_address: Dirección
-    
+    label_capacity: Capacidad
+
 breadcrumb:
     link_o_n_u_list: Listado ONU
     link_o_n_u_create: Crear ONU
@@ -125,6 +126,7 @@ form:
     label_tr069_ip: IP
     label_tr069_broadcast: Broadcast SSID
     label_tr069_status: Enable SSID
+    label_capacity: Capacidad
 
 list:
     label_id: Id
@@ -168,6 +170,7 @@ list:
     label_address: Dirección
     label_service_port: Service Port
     label_position: Posición
+    label_capacity: Capacidad
 
 show:
     label_id: Id
@@ -220,6 +223,7 @@ show:
     label_tr069_ip: IP
     label_tr069_broadcast: Broadcast SSID
     label_tr069_status: Enable SSID
+    label_capacity: Capacidad
     
 helps:
     check_address: Verifique la dirección para el cálculo de distancias.