Answer the question
In order to leave comments, you need to log in
Do I need to use an additional interface for repositories?
In Laravel, to use the Domain architecture, I saw how they use an additional implementation of the Entity Entity repository interface in the DoctrineEntityRepository.
That is, DoctrineUserRepository implements UserRepositoy, which contains all the methods that should be in the Doctrine Repository.
Why, for what and why?
Using the basic maker generator in Symphony, we have an Entity and its repository, that's all, no additional interfaces. Why?
Answer the question
In order to leave comments, you need to log in
You can help with the answer, and not turn on your wit, the hint is small.
#include<iostream> #include<string> #include<vector> #include<iterator> #include<memory> #include<sstream> #include<Windows.h> using namespace std; enum class spType {ALL, SP, TH}; class Policlinic { public: Policlinic(); ~Policlinic(); // ... void addSpecialists(const string& s); void addTherapists(const string& s); void printPersonnel(spType = spType::ALL); // ... // Геттеры Сеттеры сам по шаблону // ... private: struct Personnel; unique_ptr<Personnel> m_personnel; string desk; string type; unsigned pharmacy = 0; friend istream& operator>>(istream& is, vector<string>& values); friend ostream& operator<<(ostream& os, const vector<string>& values); }; struct Policlinic::Personnel { vector<string> specialists; vector<string> therapists; }; Policlinic::Policlinic() : m_personnel(make_unique<Personnel>()) { } Policlinic::~Policlinic() { } istream& operator>>(istream& is, vector<string>& values) { copy(istream_iterator<string>{is}, {}, back_inserter(values)); return is; } ostream& operator<<(ostream& os, const vector<string>& values) { copy(values.begin(), values.end(), ostream_iterator<string>{os, "\n"}); return os; } void Policlinic::addSpecialists(const string& s) { istringstream is(s); is >> m_personnel->specialists; } void Policlinic::addTherapists(const string& s) { istringstream is(s); is >> m_personnel->therapists; } void Policlinic::printPersonnel(spType stype) { switch(stype) { case spType::SP: cout << "Специалисты:\n" << m_personnel->specialists; break; case spType::TH: cout << "Терапевты:\n" << m_personnel->therapists; break; default: cout << "[Весь персонал]\n"; printPersonnel(spType::SP); printPersonnel(spType::TH); break; } } int main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); setlocale(LC_ALL, "ru"); Policlinic ply; // Для простоты string value; cout << "Введите врачей специалистов через пробел \n$: "; getline(cin, value); ply.addSpecialists(value); cout << "\nВведите врачей терапевтов через пробел\n$: "; getline(cin, value); ply.addTherapists(value); ply.printPersonnel(spType::ALL); system("pause"); }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question