Skip to content

Commit 188aeeb

Browse files
authored
Merge pull request #124 from ticktackk/develop
1.4.3
2 parents 1b746d4 + 2b48423 commit 188aeeb

File tree

4 files changed

+38
-26
lines changed

4 files changed

+38
-26
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
==========================
33

4+
## 1.4.3 (`1040370`)
5+
6+
- **Fix:** Command `tck-dt:entity-class-properties` does not set getters and relations make use of `@property-read` tag as it should (#122)
7+
- **Fix:** Error: Call to undefined method `XF\Mvc\Reply\Error::getParam()` (#123)
8+
49
## 1.4.2 (`1040270`)
510

611
- **Fix:** Command `tck-dt:entity-class-properties` duplicates class hint for getters (#120)

Cli/Command/EntityClassProperties.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
262262
}
263263

264264
$getters[$getter] = [
265-
'type' => $type ? (is_array($type) ? $type : trim($type)) : 'mixed'
265+
'type' => $type ? (is_array($type) ? $type : trim($type)) : 'mixed',
266+
'readOnly' => true
266267
];
267268
}
268269

@@ -271,6 +272,8 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
271272
{
272273
if (isset($getters[$column]))
273274
{
275+
$getters[$column]['readOnly'] = false;
276+
274277
// There's an overlapping getter so this column
275278
// is only accessible via the bypass suffix.
276279
$column .= '_';
@@ -314,7 +317,8 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
314317

315318
$relations[$relation] = [
316319
'type' => $relationEntityClasses,
317-
'many' => ($def['type'] === Entity::TO_MANY)
320+
'many' => ($def['type'] === Entity::TO_MANY),
321+
'readOnly' => true
318322
];
319323
}
320324

@@ -349,7 +353,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
349353
$typeProp = '\XF\Mvc\Entity\AbstractCollection|' . $typeProp . '[]';
350354
}
351355

352-
$newComment .= "\n" . ' * @property ' . $typeProp . ' $' . $relation;
356+
$newComment .= "\n" . ' * @property' . ($type['readOnly'] ? '-read' : '') . ' ' . $typeProp . ' $' . $relation;
353357
}
354358
}
355359

@@ -371,7 +375,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
371375
$type['type'] = '\\' . implode('|\\', $type['type']);
372376
}
373377

374-
$newComment .= "\n" . ' * @property ' . $type['type'] . ' $' . $getter;
378+
$newComment .= "\n" . ' * @property' . ($type['readOnly'] ? '-read' : '') . ' ' . $type['type'] . ' $' . $getter;
375379
}
376380
}
377381

XF/Admin/Controller/Template.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,31 @@ public function actionEdit(ParameterBag $params)
2626
{
2727
$reply = parent::actionEdit($params);
2828

29-
$addModificationCount = true;
30-
$addOns = \XF::app()->container('addon.cache');
31-
if (isset($addOns['SV/StandardLib']) && $addOns['SV/StandardLib'] >= 1050000)
29+
if ($reply instanceof ViewReply)
3230
{
33-
$addModificationCount = false;
34-
}
31+
$addModificationCount = true;
32+
$addOns = \XF::app()->container('addon.cache');
33+
if (isset($addOns['SV/StandardLib']) && $addOns['SV/StandardLib'] >= 1050000)
34+
{
35+
$addModificationCount = false;
36+
}
3537

36-
/** @var TemplateEntity $template */
37-
$template = $reply->getParam('template');
38-
if ($addModificationCount && $reply instanceof ViewReply && $template)
39-
{
40-
$modifications = $this->finder('XF:TemplateModification')
41-
->where([
42-
'type' => $template->type,
43-
'template' => $template->title,
44-
//'enabled' => 1
45-
])
46-
->whereAddOnActive()
47-
->order('execution_order')
48-
->total();
49-
50-
$reply->setParam('modificationCount', $modifications);
38+
/** @var TemplateEntity $template */
39+
$template = $reply->getParam('template');
40+
if ($addModificationCount && $template)
41+
{
42+
$modifications = $this->finder('XF:TemplateModification')
43+
->where([
44+
'type' => $template->type,
45+
'template' => $template->title,
46+
//'enabled' => 1
47+
])
48+
->whereAddOnActive()
49+
->order('execution_order')
50+
->total();
51+
52+
$reply->setParam('modificationCount', $modifications);
53+
}
5154
}
5255

5356
return $reply;

addon.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"legacy_addon_id": "",
33
"title": "Developer Tools",
44
"description": "This add-on provides enhancements for add-on developers.",
5-
"version_id": 1040270,
6-
"version_string": "1.4.2",
5+
"version_id": 1040370,
6+
"version_string": "1.4.3",
77
"dev": "TickTackk",
88
"dev_url": "https://xenforo.com/community/members/90375/",
99
"faq_url": "",

0 commit comments

Comments
 (0)