@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function validation() |
| 64 | 64 | { |
| 65 | - $validator = new Validation(); |
|
| 66 | - $validator->add('slug', new UniquenessValidator( |
|
| 67 | - [ |
|
| 68 | - "model" => $this, |
|
| 69 | - "message" => $this->getDi()->get('helper')->translate("Publishcation with slug is already exists") |
|
| 70 | - ] |
|
| 71 | - )); |
|
| 72 | - return $this->validate($validator); |
|
| 65 | + $validator = new Validation(); |
|
| 66 | + $validator->add('slug', new UniquenessValidator( |
|
| 67 | + [ |
|
| 68 | + "model" => $this, |
|
| 69 | + "message" => $this->getDi()->get('helper')->translate("Publishcation with slug is already exists") |
|
| 70 | + ] |
|
| 71 | + )); |
|
| 72 | + return $this->validate($validator); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function afterValidation() |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | public static function findCachedBySlug($slug) |
| 94 | 94 | { |
| 95 | 95 | $slugRecord = Translate\PublicationTranslate::findFirst([ |
| 96 | - "key = 'slug' and value = '$slug'", |
|
| 97 | - 'cache' => [ |
|
| 96 | + "key = 'slug' and value = '$slug'", |
|
| 97 | + 'cache' => [ |
|
| 98 | 98 | 'key' => self::cacheSlugKey($slug), |
| 99 | 99 | 'lifetime' => 60 |
| 100 | 100 | ]]); |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | 'conditions' => 'id = :idPost:', |
| 104 | 104 | 'bind' => ['idPost' => $slugRecord->foreign_id], |
| 105 | 105 | 'cache' => [ |
| 106 | - 'key' => self::cacheSlugKey($slug . 'original'), |
|
| 107 | - 'lifetime' => 60 |
|
| 106 | + 'key' => self::cacheSlugKey($slug . 'original'), |
|
| 107 | + 'lifetime' => 60 |
|
| 108 | 108 | ] |
| 109 | 109 | ]); |
| 110 | 110 | |
@@ -82,8 +82,8 @@ |
||
| 82 | 82 | // query moudle entity id. |
| 83 | 83 | $query = "key = 'slug' and value = '$curSLug'"; |
| 84 | 84 | $modelName = \Phalcon\Text::camelize($module); |
| 85 | - $modelTranslateName = "{$modelName}Translate"; |
|
| 86 | - $translateModel = "{$modelName}\Model\Translate\\{$modelName}Translate"; |
|
| 85 | + $modelTranslateName = "{$modelName}translate"; |
|
| 86 | + $translateModel = "{$modelName}\Model\Translate\\{$modelName}translate"; |
|
| 87 | 87 | $slugRecord = $translateModel::findFirst([$query]); |
| 88 | 88 | // query all slug. |
| 89 | 89 | $mlSlug = $translateModel::findFirst([ |
@@ -54,14 +54,14 @@ |
||
| 54 | 54 | |
| 55 | 55 | public function validation() |
| 56 | 56 | { |
| 57 | - $validator = new Validation(); |
|
| 58 | - $validator->add('slug', new UniquenessValidator( |
|
| 59 | - [ |
|
| 60 | - "model" => $this, |
|
| 61 | - "message" => $this->getDi()->get('helper')->translate("Page with slug is already exists") |
|
| 62 | - ] |
|
| 63 | - )); |
|
| 64 | - return $this->validate($validator); |
|
| 57 | + $validator = new Validation(); |
|
| 58 | + $validator->add('slug', new UniquenessValidator( |
|
| 59 | + [ |
|
| 60 | + "model" => $this, |
|
| 61 | + "message" => $this->getDi()->get('helper')->translate("Page with slug is already exists") |
|
| 62 | + ] |
|
| 63 | + )); |
|
| 64 | + return $this->validate($validator); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public static function findCachedBySlug($slug) |