/** * @expectedException Nette\InvalidArgumentException */ public function testCreateInvalidValues() { $this->service->create(NULL); }
/** * @param array|\Traversable * @param bool * @return \Nella\Models\IEntity * @throws \Nette\InvalidArgumentException * @throws \Nella\Models\Exception * @throws \Nella\Models\EmptyValueException * @throws \Nella\Models\DuplicateEntryException */ public function create($values, $withoutFlush = FALSE) { try { $entity = parent::create($values); $em = $this->getEntityManager(); $em->persist($entity); if (!$withoutFlush) { $em->flush(); } return $entity; } catch (\PDOException $e) { $this->processPDOException($e); } }