Skip to content

Commit

Permalink
add findbyname method, use in multisite_domain_data
Browse files Browse the repository at this point in the history
  • Loading branch information
nigel lundsten committed May 7, 2013
1 parent 6584f78 commit 08f1370
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Module.php
Expand Up @@ -99,7 +99,7 @@ public function getServiceConfig()
return array('website_id' => 1);
}

$site = $sm->get('multisite_admin_service')->find($domain->toArray()) ?: array('website_id' => 1);
$site = $sm->get('multisite_admin_service')->findByName($domain['name']) ?: array('website_id' => 1);

return array_merge($site, $domain->toArray());
},
Expand Down
7 changes: 7 additions & 0 deletions src/SpeckMultisite/Service/AdminService.php
Expand Up @@ -22,6 +22,13 @@ public function find(array $data)
return $this->getMapper()->find($where);
}

public function findByName($name)
{
$result = $this->getMapper()->find(array('name' => $name));
return isset($result[0]) ? $result[0] : null;
}


public function getAllSites()
{
return $this->getMapper()->getAllSites();
Expand Down

0 comments on commit 08f1370

Please sign in to comment.