本文整理汇总了PHP中Repository::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::find方法的具体用法?PHP Repository::find怎么用?PHP Repository::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract
/**
* Removes an object relation from the aggregation.
*
* @see KObjectSet::extract()
*/
public function extract($target)
{
$relation = $this->_child->find(array($this->_property => $this->_root, $this->_target_property => $target));
if ($relation) {
$relation->delete();
}
return $relation;
}
示例2: find
/**
* @return Permission[]
*/
public function find()
{
$result = parent::find();
$permissions = array();
foreach ($result as $row) {
$permissions[] = new Permission($row);
}
return $permissions;
}
示例3: find
/**
* @return Author[]
*/
public function find()
{
$result = parent::find();
$authors = array();
foreach ($result as $row) {
$authors[] = new Author($row);
}
return $authors;
}
示例4: find
/**
* @return Keyword[]
*/
public function find()
{
$result = parent::find();
$keywords = array();
foreach ($result as $row) {
$keywords[] = new Keyword($row);
}
return $keywords;
}
示例5: find
/**
* @return File[]
*/
public function find()
{
$result = parent::find();
$files = array();
foreach ($result as $row) {
$files[] = new File($row);
}
return $files;
}
示例6: find
/**
* @return Url[]
*/
public function find()
{
$result = parent::find();
$urls = array();
foreach ($result as $row) {
$urls[] = new Url($row);
}
return $urls;
}
示例7: find
/**
* @return Type[]
*/
public function find()
{
$result = parent::find();
$types = array();
foreach ($result as $row) {
$types[] = new Type($row);
}
return $types;
}
示例8: users
function users($id = null)
{
if (is_null($id)) {
$this->e404();
}
$this->paginate['Expert']['conditions'] = array('Expert.repository_id' => $id);
$this->data = $this->paginate('Expert');
$repo = $this->Repository->find('first', array('conditions' => compact('id'), 'recursive' => -1));
$data = array('current' => 'repositories', 'repo' => $repo, 'menu' => 'menu_admin', 'title' => "Collaborators of '{$repo['Repository']['name']}' Repository", 'cond' => 'owner', 'footnotes' => array('Repository owner (only 1)'));
$this->set($data);
$this->render('../admin_usuarios/listar');
}
示例9: find
/**
* @return Citation[]
*/
public function find()
{
$result = parent::find();
$citations = array();
foreach ($result as $row) {
$citation = new Citation($row);
$repo = new PublicationRepository($this->db);
$citation->setCitationPublication($repo->where('id', '=', $citation->getCitationId())->findSingle());
$citations[] = $citation;
}
return $citations;
}
示例10: find
/**
* @param bool $full
*
* @return Role[]
*/
public function find($full = false)
{
$result = parent::find();
$roles = array();
foreach ($result as $row) {
$role = new Role($row);
if ($full === true) {
$repo = new PermissionRepository($this->db);
$role->setPermissions($repo->where('role_id', '=', $role->getId())->order('name', 'ASC')->find());
}
$roles[] = $role;
}
return $roles;
}
示例11: find
/**
* @param bool $full
*
* @return User[]
*/
public function find($full = false)
{
$result = parent::find();
$users = array();
foreach ($result as $row) {
$user = new User($row);
if ($full === true) {
$repo = new RoleRepository($this->db);
$user->setRoles($repo->where('user_id', '=', $user->getId())->order('name', 'ASC')->find());
$repo = new PermissionRepository($this->db);
$user->setPermissions($repo->where('user_id', '=', $user->getId())->order('name', 'ASC')->find());
}
$users[] = $user;
}
return $users;
}
示例12: array
/**
*
* set repository data in session, by id or url, if exists
* @param array $data
* @return array array( boolean: status, array: data | null)
*/
function _set_repo($data = array())
{
if (empty($data)) {
return array(false, null);
}
if (isset($data['repo_url'])) {
$repo = $this->Repository->find('first', array('conditions' => array('Repository.url' => $data['repo_url']), 'recursive' => -1));
} elseif (isset($data['repo_id'])) {
$repo = $this->Repository->find('first', array('conditions' => array('Repository.id' => $data['repo_id']), 'recursive' => -1));
}
if (!empty($repo)) {
$this->setRepositorySession($repo);
return array(true, $repo);
} else {
return array(false, null);
}
}
示例13: find
/**
* @param bool $full
*
* @return Publication[]
*/
public function find($full = false)
{
$result = parent::find();
$publications = array();
foreach ($result as $row) {
$publication = new Publication($row);
$repo = new AuthorRepository($this->db);
$publication->setAuthors($repo->where('publication_id', '=', $publication->getId())->order('priority', 'ASC')->find());
$repo = new FileRepository($this->db);
$publication->setFiles($repo->where('publication_id', '=', $publication->getId())->find());
$repo = new UrlRepository($this->db);
$publication->setUrls($repo->where('publication_id', '=', $publication->getId())->find());
if ($full === true) {
$repo = new KeywordRepository($this->db);
$publication->setKeywords($repo->where('publication_id', '=', $publication->getId())->order('name', 'ASC')->find());
}
$publications[] = $publication;
}
return $publications;
}
示例14: getCurrentRepository
/**
* returns current repository data as array
* note: if host is localhost, it just reads from the session var
* which means to have an expiration time
*/
function getCurrentRepository()
{
$repo = null;
if (Configure::read('App.subdomains')) {
$url = explode('.', $_SERVER['HTTP_HOST'], 3);
if (count($url) === 2 or $url[0] === 'www') {
$repo = null;
} else {
$repo = $url[0];
}
} elseif ($this->Session->check('Repository.current')) {
$repo = $this->Session->read('Repository.current');
}
if (!is_null($repo)) {
$data = $this->Repository->find('first', array('conditions' => array('Repository.url' => $repo)));
if (!is_null($data) && !empty($data)) {
return $data;
}
}
return null;
}
示例15: testAutoEagerLoading
public function testAutoEagerLoading()
{
$person = new Person();
// We expect a new person to contain the
// relations defined with the ResourceInterface 'unit'.
$person = $this->repository->create($person);
$this->assertEquals(0, $person->roles->count());
$this->assertEquals(0, $person->children->count());
// Check auto-eager-loading.
$homer = $this->repository->find(1);
$this->assertEquals(1, $homer->roles->count());
$this->assertEquals(3, $homer->children->count());
$simpsons = $this->repository->all();
$simpsons = json_decode(json_encode($simpsons));
$this->assertEquals(1, count($simpsons[0]->roles));
$this->assertFalse(property_exists($simpsons[0], 'children'));
// Check that repository with() method override default settings.
$simpsons = $this->repository->with(['roles', 'children'])->all();
$simpsons = json_decode(json_encode($simpsons));
$this->assertEquals(1, count($simpsons[0]->roles));
$this->assertEquals(3, count($simpsons[0]->children));
}