1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-04 15:24:35 +01:00

Rename $this->tagMgr to $this->tags as that's what they are.

They're instances of OCP\ITags, not of OCP\ITagManager.
This commit is contained in:
Bernhard Reiter 2014-08-19 14:24:17 +02:00
parent 822f4f1083
commit a9405d43e8
2 changed files with 13 additions and 13 deletions

View File

@ -25,25 +25,25 @@ class GroupController extends Controller {
public function __construct($appName, IRequest $request, App $app, ITags $tags) { public function __construct($appName, IRequest $request, App $app, ITags $tags) {
parent::__construct($appName, $request, $app); parent::__construct($appName, $request, $app);
$this->app = $app; $this->app = $app;
$this->tagMgr = $tags; $this->tags = $tags;
} }
/** /**
* @NoAdminRequired * @NoAdminRequired
*/ */
public function getGroups() { public function getGroups() {
$tags = $this->tagMgr->getTags(); $tags = $this->tags->getTags();
foreach ($tags as &$tag) { foreach ($tags as &$tag) {
try { try {
$ids = $this->tagMgr->getIdsForTag($tag['name']); $ids = $this->tags->getIdsForTag($tag['name']);
$tag['contacts'] = $ids; $tag['contacts'] = $ids;
} catch(\Exception $e) { } catch(\Exception $e) {
$this->api->log(__METHOD__ . ' ' . $e->getMessage()); $this->api->log(__METHOD__ . ' ' . $e->getMessage());
} }
} }
$favorites = $this->tagMgr->getFavorites(); $favorites = $this->tags->getFavorites();
$groups = array( $groups = array(
'categories' => $tags, 'categories' => $tags,
@ -68,7 +68,7 @@ class GroupController extends Controller {
$response->bailOut(App::$l10n->t('No group name given.')); $response->bailOut(App::$l10n->t('No group name given.'));
} }
$id = $this->tagMgr->add($name); $id = $this->tags->add($name);
if ($id === false) { if ($id === false) {
$response->bailOut(App::$l10n->t('Error adding group.')); $response->bailOut(App::$l10n->t('Error adding group.'));
@ -92,7 +92,7 @@ class GroupController extends Controller {
} }
try { try {
$ids = $this->tagMgr->getIdsForTag($name); $ids = $this->tags->getIdsForTag($name);
} catch(\Exception $e) { } catch(\Exception $e) {
$response->setErrorMessage($e->getMessage()); $response->setErrorMessage($e->getMessage());
\OCP\Util::writeLog('contacts', __METHOD__.', ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', ' . $e->getMessage(), \OCP\Util::ERROR);
@ -128,7 +128,7 @@ class GroupController extends Controller {
} }
try { try {
$this->tagMgr->delete($name); $this->tags->delete($name);
} catch(\Exception $e) { } catch(\Exception $e) {
$response->setErrorMessage($e->getMessage()); $response->setErrorMessage($e->getMessage());
\OCP\Util::writeLog('contacts', __METHOD__.', ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', ' . $e->getMessage(), \OCP\Util::ERROR);
@ -156,12 +156,12 @@ class GroupController extends Controller {
return $response; return $response;
} }
if (!$this->tagMgr->rename($from, $to)) { if (!$this->tags->rename($from, $to)) {
$response->bailOut(App::$l10n->t('Error renaming group.')); $response->bailOut(App::$l10n->t('Error renaming group.'));
return $response; return $response;
} }
$ids = $this->tagMgr->getIdsForTag($to); $ids = $this->tags->getIdsForTag($to);
if ($ids !== false) { if ($ids !== false) {
@ -245,7 +245,7 @@ class GroupController extends Controller {
} }
$response->debug('contactId: ' . $contactId . ', categoryId: ' . $categoryId); $response->debug('contactId: ' . $contactId . ', categoryId: ' . $categoryId);
$this->tagMgr->tagAs($contactId, $categoryId); $this->tags->tagAs($contactId, $categoryId);
} }
return $response; return $response;
@ -314,7 +314,7 @@ class GroupController extends Controller {
} }
$response->debug('contactId: ' . $contactId . ', categoryId: ' . $categoryId); $response->debug('contactId: ' . $contactId . ', categoryId: ' . $categoryId);
$this->tagMgr->unTag($contactId, $categoryId); $this->tags->unTag($contactId, $categoryId);
} }
return $response; return $response;

View File

@ -28,7 +28,7 @@ class ImportController extends Controller {
public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) { public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) {
parent::__construct($appName, $request, $app); parent::__construct($appName, $request, $app);
$this->cache = $cache; $this->cache = $cache;
$this->tagMgr = $tags; $this->tags = $tags;
} }
/** /**
@ -247,7 +247,7 @@ class ImportController extends Controller {
$favourites = $part->select('X-FAVOURITES'); $favourites = $part->select('X-FAVOURITES');
foreach ($favourites as $favourite) { foreach ($favourites as $favourite) {
if ($favourite->getValue() == 'yes') { if ($favourite->getValue() == 'yes') {
$this->tagMgr->addToFavorites($id); $this->tags->addToFavorites($id);
} }
} }
} else { } else {