| @@ -130,10 +130,18 @@ | ||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $editorDataArray->startSection = $startSection; |
| 133 | 133 | |
| 134 | + // make document model base on editor data | |
| 134 | 135 | $mapper = new Mapper(); |
| 135 | - return $mapper->hydrate( $editorDataArray, $documentId )->get(); | |
| 136 | + $documentModel = $mapper->hydrate( $editorDataArray, $documentId )->get(); | |
| 137 | + | |
| 138 | + // set document entity properties | |
| 139 | + $documentModel->setDocumentId( $documentId ); | |
| 140 | + $documentModel->setUnpublishedNotice( $documentId ); | |
| 141 | + $documentModel->setEntityProperty( 'status', $this->getStatus( $documentId ) ); | |
| 142 | + | |
| 143 | + return $documentModel; | |
| 136 | 144 | } |
| 137 | 145 | |
| 138 | 146 | /** |
| 139 | 147 | * Retrieves custom css file of a document if exists |
| @@ -162,12 +170,7 @@ | ||
| 162 | 170 | * @param int $documentID |
| 163 | 171 | * @return string |
| 164 | 172 | */ |
| 165 | 173 | public function getStatus( $documentID ) { |
| 166 | - if( $document = \Depicter::document()->repository()->findById( $documentID ) ){ | |
| 167 | - $document = $document->toArray(); | |
| 168 | - return $document['status']; | |
| 169 | - } | |
| 170 | - | |
| 171 | - return ''; | |
| 174 | + return \Depicter::document()->repository()->getStatus( $documentID ); | |
| 172 | 175 | } |
| 173 | 176 | } |