public function add() { if (!$this->checkRequiredAttribute()) { return false; } // this is not fully correct $connectorManager = new Connector($this->connector); if (!$connectorManager->checkExist($this->getConnector())) { $this->errors['connector'] = strtr('Connector :cid not found at db', [':cid' => $this->getConnector()]); return false; } unset($this->errors['filters']); // this is not fully correct $filterManager = new Filter($this->connector); foreach ($this->getFilters() as $filter) { if (!$filterManager->checkExist($filter)) { if (!isset($this->errors['filters'])) { $this->errors['filters'] = []; } $this->errors['filters'][] = strtr('Filter :fid not found at db', [':fid' => $filter]); } } if (isset($this->errors['filters'])) { return false; } return $this->save(); }
public function add() { if (!$this->checkRequiredAttribute()) { return false; } // this is not fully correct $userManager = new Connector($this->connector); if (!$userManager->checkExist($this->getCId())) { $this->errors['cid'] = strtr('Connector :cid not found at db', [':cid' => $this->getCId()]); return false; } return $this->save(); }