예제 #1
0
파일: Group.php 프로젝트: zyxist/cantiga
 public function insert(Connection $conn)
 {
     $this->slug = DataMappers::generateSlug($conn, CoreTables::GROUP_TBL);
     $this->entity = new Entity();
     $this->entity->setType('Group');
     $this->entity->setName($this->name);
     $this->entity->insert($conn);
     $conn->insert(CoreTables::GROUP_TBL, DataMappers::pick($this, ['name', 'slug', 'project', 'category', 'notes', 'entity']));
     return $conn->lastInsertId();
 }
예제 #2
0
파일: Area.php 프로젝트: zyxist/cantiga
 public function insert(Connection $conn)
 {
     $this->status = AreaStatus::fetchDefault($conn, $this->project);
     $groupName = null;
     if (null !== $this->group) {
         $groupName = $this->group->getName();
     }
     if (null !== $this->group) {
         DataMappers::recount($conn, CoreTables::GROUP_TBL, null, $this->group, 'areaNum', 'id');
     }
     DataMappers::recount($conn, CoreTables::AREA_STATUS_TBL, null, $this->status, 'areaNum', 'id');
     DataMappers::recount($conn, CoreTables::TERRITORY_TBL, null, $this->territory, 'areaNum', 'id');
     $this->entity = new Entity();
     $this->entity->setType('Area');
     $this->entity->setName($this->name);
     $this->entity->insert($conn);
     $this->createdAt = $this->lastUpdatedAt = time();
     $this->percentCompleteness = 0;
     $this->slug = DataMappers::generateSlug($conn, CoreTables::GROUP_TBL);
     $conn->insert(CoreTables::AREA_TBL, DataMappers::pick($this, ['name', 'slug', 'project', 'group', 'territory', 'status', 'reporter', 'entity', 'createdAt', 'lastUpdatedAt', 'percentCompleteness'], ['customData' => json_encode($this->customData), 'groupName' => $groupName]));
     return $this->id = $conn->lastInsertId();
 }
예제 #3
0
파일: Project.php 프로젝트: zyxist/cantiga
 public function insert(Connection $conn)
 {
     $this->slug = DataMappers::generateSlug($conn, CoreTables::PROJECT_TBL);
     $this->entity = new Entity();
     $this->entity->setType('Project');
     $this->entity->setName($this->name);
     $this->entity->insert($conn);
     $conn->insert(CoreTables::PROJECT_TBL, DataMappers::pick($this, ['name', 'slug', 'description', 'parentProject', 'areasAllowed', 'areaRegistrationAllowed', 'entity'], ['modules' => implode(',', $this->getModules()), 'archived' => false, 'createdAt' => time(), 'archivedAt' => null]));
     return $this->id = $conn->lastInsertId();
 }