public function addDiagram($data = array()) { if (empty($this->project)) { throw new \Exception("Error: There is not an initialized project."); } // setting defaults $data['DIA_UID'] = array_key_exists('DIA_UID', $data) ? $data['DIA_UID'] : Common::generateUID(); $data['DIA_NAME'] = array_key_exists('DIA_NAME', $data) ? $data['DIA_NAME'] : $this->project->getPrjName(); $this->diagram = new Diagram(); $this->diagram->fromArray($data, BasePeer::TYPE_FIELDNAME); $this->diagram->setPrjUid($this->project->getPrjUid()); $this->diagram->save(); }