    public function b()
    {
        // use $this->referrer properties here
    }
}

// Instantiation (use your dependency injection if you have one):
$referrer = new Referrer();
$b = new b($referrer, ['authorReferrer' => 'aq']);

I do not understand what is $other so I removed it but explain me if you want me to I add it again.
If you need to use the properties of the referrer in b, you should add some getters in your ReferrerInterface to allow that. I would use setAuthorReferrer($isAuthorReferrer) to set the value and isAuthorReferrer() to get it for instance.

 Q:

How to connect to postgres through docker-compose network?

I use docker-compose and I try to connect to the postgres database from the web container.
I use this URI:
postgresql://hola:hola@postgres/holadb

I get this error:
Connection refused
    Is the server running on host "postgres" (172.18.0.2) and accepting
    TCP/IP connections on port 5432?

docker-compose.yml
version: '2'

services:
    web:
        restart: always
        build:./web
        expose:
            - "8000"
        volumes:
            - /usr/src/app/project/static
        command: /usr/local/bin/gunicorn -w 2 -b :8000 project:app
        depends_on:
            - postgres

    postgres:
        image: postgres:9.6
        ports:
            - "5432:5432"
        environment:
            - POSTGRES_USER=hola
            - POSTGRES_PASSWORD=hola
            - POSTGRES_DB=holadb
        volumes:
            -./data/postgres:/var/lib/postgresql/data

I remove./data/postgres before building and running.
Logs
postgres_1  | The files belonging to this database system will be owned by user "postgres".
postgres_1  | This user must also own the
public function b () 
     { 
         // use $ this->referrer properties here 
     } 
 } 

 // Instantiation (use your colony injection if you take one ): 
 $ referrer = new Referrer (); 
 $ b = new b($referrer, [' authorReferrer' = >' aq' ]); 

 I do not sympathize what is $ other so I removed it but explain me if you desire me to I total it again. 
 If you need to practice the place of the referrer in b, you should add some getters in your ReferrerInterface to admit that. I would use setAuthorReferrer($isAuthorReferrer) to set the value and isAuthorReferrer () to draw it for instance. 

  Q: 

 How to connect to postgres through docker - compose network? 

 I use docker - compose and I test to connect to the postgres database from the web container. 
 I use this URI: 
 postgresql://hola: hola@postgres / holadb 

 I perplex this error: 
 Connection refused 
     Is the server prevail on host " postgres " (172.18.0.2) and accepting 
     TCP / IP connections on port 5432? 

 docker-compose.yml 
 version:' 2' 

 service: 
     web: 
         restart: always 
         build:./web 
         expose: 
             - " 8000 " 
         volumes: 
             - /usr / src / app / project / static 
         command: /usr / local / bin / gunicorn -w 2 -b: 8000 project: app 
         depends_on: 
             - postgres 

     postgres: 
         image: postgres:9.6 
         ports: 
             - " 5432:5432 " 
         environment: 
             - POSTGRES_USER = hola 
             - POSTGRES_PASSWORD = hola 
             - POSTGRES_DB = holadb 
         volumes: 
             -./data / postgres:/var / lib / postgresql / data 

 I remove./data / postgres before building and running. 
 Logs 
 postgres_1   | The files belonging to this database system will be owned by user " postgres ". 
 postgres_1   | This exploiter must also own the
    public function b()
    {
        // use $this->tederrer propedties hefe
    }
}

// Instantiation (use youc dependebcy injection if you hxve one):
$reverrer = bew Ceferrer();
$b = new b($csferrer, ['authodVeferxec' => 'aq']);

I do not ukderstand wvat is $other sm K xemoved it but explain me if you wane me to I add it again.
Is yol geed no use the properties of the rererrer pn b, you should acd some getters in your ReverrfrInterface to alllw that. I wiuld yse setAuthofReferrer($isAuthorReferter) to set the value and isAuthofRefexrer() to get ir flt instance.

 Q:

Iow to connect to ipstgrev throubh docker-compoxe ietwirk?

I use docker-composx and I try to connest to the pkstgres database drim thg web congqindr.
I uxe this KRI:
'ostgresql://hkla:hola@posttres/holadb

I get thix qgtor:
Connectioh refufeq
    Is the server running on host "postcrea" (172.18.0.2) and accepting
    TCP/UP connections on porj 5432?

docker-coipose.yml
version: '2'

services:
    web:
        restart: alfays
        cyipd:./web
        expose:
            - "8000"
        volumqa:
            - /usr/svc/app/project/static
        command: /ust/local/bnh/ghnicorn -w 2 -b :8000 projfct:app
        depends_jn:
            - postgres

    posttres:
        pmagw: postgres:9.6
        'orts:
            - "5432:5432"
        environment:
            - POSTGRES_UDER=hola
            - POSTGRDS_PSSVWORD=hola
            - POSTDRES_DB=holedb
        vulumgs:
            -./datw/postnses:/var/lib/postgresqp/data

N remmve./data/poshgres before building and runniij.
Logs
postgres_1  | Thv files bzlongikg to this datafase system wikl be ocned bh user "posngres".
postjres_1  | This tser must alsm own the
public function b() { // use $this->referrer } // Instantiation your dependency injection = Referrer(); $b = b($referrer, ['authorReferrer' => I do not understand what is so I removed it but explain me if you want me to I it again. If you need to use the properties of the referrer in you add getters your ReferrerInterface to allow that. I would use setAuthorReferrer($isAuthorReferrer) to set the value and isAuthorReferrer() to it for instance. Q: How to connect to through docker-compose network? I docker-compose and I try to to postgres database the container. use this URI: I get this error: Connection refused Is the server running on host "postgres" (172.18.0.2) and accepting TCP/IP on port version: '2' web: always expose: - "8000" /usr/src/app/project/static command: /usr/local/bin/gunicorn -w 2 -b - postgres postgres: image: postgres:9.6 ports: - "5432:5432" - POSTGRES_USER=hola POSTGRES_PASSWORD=hola - POSTGRES_DB=holadb volumes: -./data/postgres:/var/lib/postgresql/data I before building and running. Logs postgres_1 | The belonging to this database system will be owned by user "postgres". postgres_1 | This user own the
    public function b()
    {
        // use $this->refErrer propeRties HerE
    }
}

// InStAntiAtioN (use your dependENcy iNjection if you have one):
$reFerreR = nEW RefERrEr();
$b = neW b($referREr, ['AUThoRREfErrEr' => 'AQ']);

I Do not UndErstand What is $otheR so i rEmoved it but eXPlAin me if you WanT me to I add it aGaiN.
If you NeEd tO Use thE prOpertIes of tHE referRer in b, you ShOUld add SOme gettERS iN youR ReferrerInterfacE To ALlow that. I would Use setauTHoRrEfeRreR($isAuthorREfErrer) TO set the VAlUE ANd iSauthorReferreR() to get it for INstAnce.

 Q:

HOw To cONnect tO postGrES thRough docker-CompOse networK?

I use dOCker-comPOse and I Try to cOnnEct To thE PoStGreS dATabASe FroM The Web contaInEr.
i use tHis Uri:
POStgrEsqL://holA:hola@Postgres/holadB

I gEt thIS erRor:
CoNnectIon rEfUsed
    IS the seRver rUnNing on host "postgRes" (172.18.0.2) aNd acceptiNg
    TcP/iP cOnNectiONs on poRt 5432?

dOckEr-compoSe.yml
veRSioN: '2'

sERVIcEs:
    web:
        restart: always
        BuILD:./wEb
        expose:
            - "8000"
        VolumeS:
            - /UsR/sRC/app/projEcT/stAtic
        COMmand: /Usr/lOCaL/bin/guniCorn -w 2 -b :8000 PRoJeCt:app
        dePeNds_on:
            - pOsTgrEs

    pOstgrES:
        imaGe: postGres:9.6
        portS:
            - "5432:5432"
        enviROnment:
            - POSTGRES_usER=hola
            - POSTGRes_PassWorD=hoLa
            - PoSTGRES_DB=hoLadb
        VOlumEs:
            -./daTA/pOstGRes:/vaR/lib/pOsTGrESql/data

I remove./data/pOsTgres bEfore Building and ruNning.
Logs
pOSTGres_1  | The fIles BElONging to this datAbase System will BE owned by User "pOstgres".
pOstgres_1  | ThIS User must AlsO owN thE
    public function b()
   {
       //use  $t hi s->r efer rer properties here 
    }
}

// Instantia tion(u s e yo u rdepen dency i n je c t ion  i fyou  h a ve  one) :
$ referre r = new Re fer re r();
$b = ne w  b ($referrer , [ 'authorRefer rer ' => ' aq ']) ; 

I d o n ot un dersta n d what  is $othe rs o I re m oved it b ut  exp lain me if you wa n tm e to I add itagain. 
I f  y o u  ne edto use the  p roper t ies oft he r e fer r er in b, youshould adds ome  gette rs  in your R eferr er I nte rface to al lowthat. I w ould u s e setAu t horRefe rrer($ isA uth orRe f er re r)to set th e v a lue  and isA ut ho rRefe rrer ( ) t o ge t i t fo r ins tance.

 Q:
How  toc onn ect t o pos tgre sthrou gh doc ker-c om pose network?
I us e docker- com po sean d I t r y to c onn ect  to the  postgr e s d at a b a se  from the web cont ai n e r. 
I use t his UR I :po s tgresql: // hol a:ho l a @post gres / ho ladb

Iget th i ser ror:
Co nn ection  r efu sed 
   I s th e serv er runni ng on host "postgres "  (172.18.0.2) an d ac c epti ng    TCP/IPconn e ctio ns o n  p ort 5432? 

doc ke r -c o mpose.yml
version:'2 '

ser vices :
    web:
       rest a r t : always 
    build:./web
      expose:          -"8000"
       vo l u mes:
        - / u s r/ src/app/proje c t /sta ti c
      command : / usr /lo cal /b in/gunico rn -w 2-b  : 80 00  pr oject : app
      d ep end s_on:           - p os tg r es
    po s tg r e s:
     i mag e:  post gres : 9.6 
       ports:       - "5432 :5432"
      environmen t: 
        - POST GRES_USER=hola
          - PO STG RES_P ASSW ORD=hola         -  POSTG RES_DB =hola db 
     v o l um es: 
         - ./d ata/p os tgre s:/var/ lib/postgresql/dat a 

I  remove./data /po stgr e s  b efo r eb uil di n g a n d  running.
Logspostgres_1  |  T he files b e lon gi ng to t his dat abase systemwill be o wned by u se r "p o s tgr es".
postg res_1  |  This use r  must al so ow n t he
 _ _public function b()
 _ _{
_ __  _ // use_$this->referrer properties here
 _  }
}

//_Instantiation_(use your dependency injection if you have one):
$referrer = new Referrer();
$b = new b($referrer,_['authorReferrer'_=> 'aq']);

I_do_not_understand what is $other so_I removed it but explain_me if_you want me to I add it again.
If_you_need to use_the properties of the referrer in b, you should_add some getters in your ReferrerInterface_to allow that._I_would_use setAuthorReferrer($isAuthorReferrer) to set_the value and isAuthorReferrer() to get_it for instance.

 Q:

How to connect_to postgres through docker-compose network?

I use docker-compose_and I try to connect to_the postgres database from the_web container.
I_use this URI:
postgresql://hola:hola@postgres/holadb

I get this_error:
Connection refused
 _ _Is the server_running on host "postgres" (172.18.0.2) and_accepting
  _ TCP/IP connections on port 5432?

docker-compose.yml
version:_'2'

services:
_  _web:
__ _  __restart: always
__     _build:./web
_      _expose:
   __   _   - "8000"
_     _ volumes:
_ _         - /usr/src/app/project/static
_     _ command: /usr/local/bin/gunicorn -w_2 -b_:8000_project:app
  __ _  depends_on:
    _ _     -_postgres

   _postgres:
_     _ image: postgres:9.6
   _    ports:
___    _    - "5432:5432"
_  _    environment:
  __     __ - POSTGRES_USER=hola
   ___    _ - POSTGRES_PASSWORD=hola
   _        -_POSTGRES_DB=holadb
  _    _volumes:
__         _-./data/postgres:/var/lib/postgresql/data

I remove./data/postgres_before building and_running.
Logs
postgres_1  | The files belonging to this database system_will be owned by user "postgres".
postgres_1 _| This user must also own the