forked from php-tmdb/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fd7485
commit 207e403
Showing
3 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Repository; | ||
|
||
use Tmdb\Factory\CompanyFactory; | ||
use Tmdb\Model\Common\Collection; | ||
use Tmdb\Model\Company; | ||
|
||
class CompanyRepository extends AbstractRepository { | ||
/** | ||
* Load a company with the given identifier | ||
* | ||
* @param $id | ||
* @param array $parameters | ||
* @param array $headers | ||
* @return Company | ||
*/ | ||
public function load($id, array $parameters = array(), array $headers = array()) { | ||
$data = $this->getApi()->getCompany($id, $this->parseQueryParameters($parameters), $this->parseHeaders($headers)); | ||
|
||
return CompanyFactory::create($data); | ||
} | ||
|
||
/** | ||
* If you obtained an person model which is not completely hydrated, you can use this function. | ||
* | ||
* @param Company $company | ||
* @param array $parameters | ||
* @param array $headers | ||
* @return Company | ||
*/ | ||
public function refresh(Company $company, array $parameters = array(), array $headers = array()) { | ||
return $this->load($company->getId(), $parameters, $headers); | ||
} | ||
|
||
/** | ||
* Return the related API class | ||
* | ||
* @return \Tmdb\Api\Companies | ||
*/ | ||
public function getApi() | ||
{ | ||
return $this->getClient()->getCompaniesApi(); | ||
} | ||
} |