N
N
naneri2015-05-13 19:49:03
Python
naneri, 2015-05-13 19:49:03

Do I need to create a Repository Class for every table in the database?

I have a database with data, I want to write a Laravel application for it. In the table itself, much of the data is broken into tables with one-to-one relationships.
I can’t understand - do I need to write a repository for each table, or just specify one repository and the rest of the tables as dependencies?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sim3x, 2018-06-06
@dabiankolins1

https://learnxinyminutes.com/docs/python3/
learn python the hard way

E
Eugene, 2018-06-06
@immaculate

I think that after the first book you need to start doing something. The fact is that book knowledge, divorced from reality, is worth nothing (and will be instantly forgotten). Only real development experience will show in which direction to move, and what knowledge is missing.

H
H, 2018-06-06
@doublewaffle

Python Crash Course

C
cloud_zurbag, 2015-06-11
@cloud_zurbag

If we are talking about something like this
bosnadev.com/2015/03/07/using-repository-pattern-i...
then the requests (and in fact the functions in the repository are questions) are
added to the repository whose lines you are pulling out
and whose lines are more important
Example

ItemRepository
{
   public function getItems($criteria)
   {
      $this->applyCriteria($criteria);
      $this->join(
             'addresses', 
             'LEFT JOIN addresses ON addresses.item_id = items.id'
      );
     $this->addSelect('*');
       return $this->findAll();
   }

   public function getSumSize($criteria)
   {
       $this->applyCriteria($criteria);
        $this->join(
            'legs', 
             'LEFT JOIN legs ON legs.item_id = items.id'
        );
        $this->addSelect('items.id');
        $this->addSelect('sum(legs.size)');
        return $this->getCell();
    }

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question