add creation timestamp on document tag and document tag
authorymh <ymh.work@gmail.com>
Fri, 09 Dec 2011 06:43:49 +0100
changeset 62 10be6b9e55e7
parent 61 1bc0ec8ed05b
child 63 774ba82dca59
add creation timestamp on document tag and document tag
Model/Document.php
Model/DocumentInterface.php
Model/DocumentTag.php
Model/DocumentTagInterface.php
Model/Tag.php
Model/TagInterface.php
Resources/config/doctrine/Document.orm.yml
Resources/config/doctrine/DocumentTag.orm.yml
Resources/config/doctrine/Tag.orm.yml
Resources/public/images/arrow_refresh.png
--- a/Model/Document.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/Document.php	Fri Dec 09 06:43:49 2011 +0100
@@ -20,7 +20,6 @@
     */
     protected $id;
     
-    
     /**
      * @var boolean $manualOrder
      */
@@ -40,6 +39,11 @@
      * @var string tagsStr
      */
     protected $tagsStr;
+        
+   /**
+    * @var DateTime
+    */
+    protected $createdAt;
     
     
     /**
@@ -118,6 +122,25 @@
         return $this->tagsStr;
     }
     
+    /**
+     * (non-PHPdoc)
+     * @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::getCreatedAt()
+     */
+    function getCreatedAt()
+    {
+        return $this->createdAt;
+    }
+    
+    /**
+    *
+    * construct the class
+    */
+    function __construct()
+    {
+        $this->createdAt = new \DateTime("now", new \DateTimeZone('UTC'));
+    }
+    
+    
     public function __toString()
     {
         return print_r(Debug::export($this, 3),true);
--- a/Model/DocumentInterface.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/DocumentInterface.php	Fri Dec 09 06:43:49 2011 +0100
@@ -70,5 +70,11 @@
      * @param $tagsStr
      */
     function setTagsStr($tagsStr);
+    
+   /**
+    * return the utc time when this object has been created
+    */
+    function getCreatedAt();
+    
             
 }
--- a/Model/DocumentTag.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/DocumentTag.php	Fri Dec 09 06:43:49 2011 +0100
@@ -48,6 +48,21 @@
     protected $document;
     
     
+   /**
+    * @var DateTime
+    */
+    protected $createdAt;
+    
+    /**
+    *
+    * construct the class
+    */
+    function __construct()
+    {
+        $this->createdAt = new \DateTime("now", new \DateTimeZone('UTC'));
+    }
+    
+    
     /**
      * Get id
      *
@@ -178,6 +193,16 @@
         return $this->document;
     }
     
+   /**
+    * (non-PHPdoc)
+    * @see IRI\Bundle\WikiTagBundle\Model.DocumentTagInterface::getCreatedAt()
+    */
+    function getCreatedAt()
+    {
+        return $this->createdAt;
+    }
+    
+    
     /**
     * Get wikipedia_version_permalink
     *
--- a/Model/DocumentTagInterface.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/DocumentTagInterface.php	Fri Dec 09 06:43:49 2011 +0100
@@ -103,5 +103,11 @@
      */
     function getDocument();
     
+   /**
+    * return the utc time when this object has been created
+    */
+    function getCreatedAt();
+    
+    
 
 }
\ No newline at end of file
--- a/Model/Tag.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/Tag.php	Fri Dec 09 06:43:49 2011 +0100
@@ -56,8 +56,7 @@
     * @var string $alternativeWikipediaUrl
     */
     protected $alternativeWikipediaUrl;
-        
-    
+            
     /**
      * @var bigint $wikipediaPageId
      */
@@ -92,9 +91,23 @@
      * @var ArrayCollection $documents
      */
     protected $documents;
+    
+    /**
+     * @var DateTime
+     */
+    protected $createdAt;
 
 
     /**
+     *
+     * construct the class
+     */
+    function __construct()
+    {
+        $this->createdAt = new \DateTime("now", new \DateTimeZone('UTC'));
+    }
+    
+    /**
      * Get id
      *
      * @return integer
@@ -397,6 +410,15 @@
     {
         return $this->category;
     }
+    
+    /**
+     * (non-PHPdoc)
+     * @see IRI\Bundle\WikiTagBundle\Model.TagInterface::getCreatedAt()
+     */
+    function getCreatedAt()
+    {
+        return $this->createdAt;
+    }
 
     /**
      * Get Documents
--- a/Model/TagInterface.php	Fri Dec 09 04:53:56 2011 +0100
+++ b/Model/TagInterface.php	Fri Dec 09 06:43:49 2011 +0100
@@ -218,6 +218,11 @@
     function getCategory();
     
     /**
+     * return the utc time when this tag has been created
+     */
+    function getCreatedAt();
+    
+    /**
      * Get Documents
      *
      * @return ArrayCollection
@@ -236,5 +241,6 @@
      * @param $wikipedia_info
      */
     function setWikipediaInfo($wikipedia_info);
+        
     
 }
\ No newline at end of file
--- a/Resources/config/doctrine/Document.orm.yml	Fri Dec 09 04:53:56 2011 +0100
+++ b/Resources/config/doctrine/Document.orm.yml	Fri Dec 09 06:43:49 2011 +0100
@@ -14,9 +14,13 @@
       type: boolean
       column: manual_order
     tagsStr:
-        type: text
-        column: tags_str
-        nullable: true
+      type: text
+      column: tags_str
+      nullable: true
+    createdAt:
+      type: datetime
+      column: created_at
+      nullable: false
   oneToMany:
     tags:
       targetEntity: DocumentTag
--- a/Resources/config/doctrine/DocumentTag.orm.yml	Fri Dec 09 04:53:56 2011 +0100
+++ b/Resources/config/doctrine/DocumentTag.orm.yml	Fri Dec 09 06:43:49 2011 +0100
@@ -21,6 +21,10 @@
       type: bigint
       column: wikipedia_revision_id
       nullable: true
+    createdAt:
+      type: datetime
+      column: created_at
+      nullable: false      
   manyToOne:
     tag:
       targetEntity: Tag
--- a/Resources/config/doctrine/Tag.orm.yml	Fri Dec 09 04:53:56 2011 +0100
+++ b/Resources/config/doctrine/Tag.orm.yml	Fri Dec 09 06:43:49 2011 +0100
@@ -57,6 +57,11 @@
       nullable: true
     popularity:
       type: integer
+    createdAt:
+      type: datetime
+      column: created_at
+      nullable: false
+      
   manyToOne:
     category:
       targetEntity: Category
Binary file Resources/public/images/arrow_refresh.png has changed