Esempio n. 1
0
 public function add($orgId, $data)
 {
     $organization = $this->orgRepo->organizationOfId($orgId);
     $name = new Name($data['name']);
     $url = new URL($data['url']);
     $description = isset($data['description']) ? $data['description'] : null;
     /** @var Blog $blog */
     $blog = Blog::register($name, $url, $organization);
     $blog->setDescription($description);
     $this->blogRepo->add($blog);
 }
Esempio n. 2
0
 public function add($orgId, $data)
 {
     $organization = $this->orgRepo->organizationOfId($orgId);
     if (!$organization) {
         throw new OrganizationNotFoundException($orgId);
     }
     $name = $this->nameIsRequired($data);
     $group = Group::register($name);
     $this->setDescription($data, $group);
     $this->setKind($data, $group);
     //TODO: set avatar
     $this->groupRepo->add($group);
     $this->setParent($data, $group);
     return $group;
 }
Esempio n. 3
0
 /**
  * @param $orgId
  * @return \Bakgat\Notos\Domain\Model\Identity\Organization
  * @throws OrganizationNotFoundException
  */
 private function organizationOfId($orgId)
 {
     $organization = $this->orgRepo->organizationOfId($orgId);
     if (!$organization) {
         throw new OrganizationNotFoundException($orgId);
     }
     return $organization;
 }
Esempio n. 4
0
 /**
  * Adds a new book
  *
  * @param $orgId
  * @param $data
  * @return Book
  * @throws OrganizationNotFoundException
  * @throws UnprocessableEntityException
  */
 public function add($orgId, $data)
 {
     $organization = $this->orgRepo->organizationOfId($orgId);
     if (!$organization) {
         throw new OrganizationNotFoundException($orgId);
     }
     $name = $this->nameIsRequired($data);
     $isbn = $this->isbnIsRequired($data);
     $book = Book::register($name, $isbn);
     $book->setOrganization($organization);
     $this->setDescription($data, $book);
     $this->addImage($data, $book);
     $this->setAgeRange($data, $book);
     $this->syncAuthors($data, $book);
     $this->syncPublishers($data, $book);
     $this->syncTags($data, $book);
     $this->bookRepo->add($book);
     return $book;
 }
Esempio n. 5
0
 /**
  * @param $orgId
  * @return \Bakgat\Notos\Domain\Model\Identity\Organization
  */
 public function edit($orgId)
 {
     $org = $this->orgRepo->organizationOfId($orgId);
     return $this->json($org, ['detail']);
 }
Esempio n. 6
0
 public function eventsBetween($orgId, $start, $end)
 {
     $organization = $this->orgRepo->organizationOfId($orgId);
     return $this->calendarRepo->eventsBetween($organization, $start, $end);
 }
 /**
  * @test
  * @group orgrepo
  */
 public function should_return_org_null_when_not_found_by_id()
 {
     $organization = $this->orgRepo->organizationOfId(999999999);
     $this->assertNull($organization);
 }