Commit e22fc8c5 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch '317-last_update_is_used_as_first_upload' into 'develop'

Resolve "Last update is used as first upload every time"

Closes #317

See merge request t3o/ter!310
parents 16913e6f 8005495c
Pipeline #3554 passed with stages
in 6 minutes and 7 seconds
...@@ -644,12 +644,14 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -644,12 +644,14 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/ */
public function getDateOfFirstUpload() public function getDateOfFirstUpload()
{ {
if ($this->versions->count() === 0) { $dateOfFirstUpload = null;
return null;
$versions = $this->getVersions()->toArray();
list ($firstVersion) = $versions;
if (!empty($firstVersion)) {
$dateOfFirstUpload = date('d-m-Y', $firstVersion->getUploadDate());
} }
$firstVersion = $this->getReverseVersionsByVersionNumber(1)[0];
$dateOfFirstUpload = new \DateTime();
$dateOfFirstUpload->setTimestamp($firstVersion->getUploadDate());
return $dateOfFirstUpload; return $dateOfFirstUpload;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment