private function givenIHaveAStoredRecordWithARelatedRecordCollection() { $user = $this->createUser(); $author = $this->createAuthor(); $article = $this->createArticle(); $article->Author = $author; $author->User = $user; $this->rm->scheduleSave($author); $this->rm->commit(); $this->author = $author; $this->recordCollectionRecord = $article; }
/** * @param $refTableName * @param $refField * @param $id * @param $relatedKey * @throws RecordGeneratorException * @throws \Dive\Table\TableException */ private function updateRelatedRecord($refTableName, $refField, $id, $relatedKey) { $record = $this->rm->getTable($refTableName)->getFromRepository($this->getRecordIdFromMap($refTableName, $relatedKey)); if (!$record) { throw new RecordGeneratorException("record not found"); } $record->set($refField, $id); $this->rm->scheduleSave($record); $this->rm->commit(); }
/** * @param array $recordData */ private function whenITryToSaveRecordWithData(array $recordData) { $this->raisedException = null; try { $this->record = $this->createRecordWithRandomData($recordData); $this->rm->scheduleSave($this->record); $this->rm->commit(); } catch (RecordInvalidException $e) { $this->raisedException = $e; } }
/** * @param array $recordData */ private function givenIHaveARecordStoredWithData(array $recordData) { $this->storedRecord = self::getRecordWithRandomData($this->table, $recordData); $this->rm->scheduleSave($this->storedRecord)->commit(); }
private function whenISaveTheRecord() { $this->rm->scheduleSave($this->storedRecord); $this->rm->commit(); }