Преглед изворни кода

FD3-747 campo updated para forzar los eventos pre/post update.

Maximiliano Schvindt пре 6 година
родитељ
комит
fd26a26500
2 измењених фајлова са 30 додато и 1 уклоњено
  1. 3 1
      src/HostBundle/Admin/HostAdmin.php
  2. 27 0
      src/HostBundle/Entity/Host.php

+ 3 - 1
src/HostBundle/Admin/HostAdmin.php

@@ -69,10 +69,12 @@ class HostAdmin extends BaseAdmin
     protected function configureFormFields(FormMapper $formMapper)
     {
         $subject = $this->getSubject();
-        
+        $updated = (int) time();
+
         $formMapper
             ->tab('Host')
             ->with('Host')
+            ->add('updated', 'hidden', ['attr'=> ["hidden" => true],'data' => $updated])
             ->add('mac')
             ->add('hostType', null, [
                 'required' => true,

+ 27 - 0
src/HostBundle/Entity/Host.php

@@ -110,6 +110,13 @@ class Host implements WorkflowInterface
      */
     protected $ipv4Address;
 
+    /**
+     * @var integer $updated
+     *
+     * @ORM\Column(name="updated", type="integer", nullable=true)
+     */
+    protected $updated;
+
 
     public function __construct() 
     {
@@ -317,4 +324,24 @@ class Host implements WorkflowInterface
         }
     }
 
+    /**
+     * @return integer
+     */
+    public function getUpdated()
+    {
+        return $this->updated;
+    }
+    
+    /**
+     * @param integer $updated
+     *
+     * @return Host
+     */
+    public function setUpdated($updated)
+    {
+        $this->updated = $updated;
+
+        return $this;
+    }
+
 }