XF 2.2 Where repository

Robert9

Well-known member
robert9/addon_name

c/p/mainclass

xf
/forum
/thread

all three classes should use a rep with a finder to write code one time, but where to put it?
under xf/repository
under addon_name/repository

I dont know it,
so i have now

xf/repository
and
c/p/mainclass has its own finder
 
Your repository classes should be in namespace robert9\addon_name\Repository.

If you extend a XenForo repository it should be in namespace robert9\addon_name\XF\Repository; if you extend a repository of another Add-on like XFMG it should be in namespace robert9\addon_name\XFMG\Repository
(Not necessarily, but this is common sense)

Btw: I'd use CamelCase for vendor and Add-on ID.
 
Yes, yes, but i have both.
This is why I have xf/rep for xf/c/p/thread and forum
and nothing for the /c/p/class (has finder itself.)

I could do another rep in /rep, but why, i have only one file now in c/p/

The question is, what I do in my case

/c/p/class
/rep

xf/c/p/classes
xf/rep

This would be the correct way, right? But it will not help me saving code.
 
It might be just me, but it it is really hard to understand your questions :(

Code:
xf/rep
xf/c/p/thread and forum
/c/p/class

[...]

/rep

[...]
c/p/

What does all that gibberish mean?
 
No, this is typical.
But same/same to me. :)

The addon has

Kirby/Name/
Kirby/Name/Pub/Controller/Kirby.php *
Kirby/Name/XF/Pub/Controller/Forum.php *
Kirby/Name/XF/Pub/Controller/Thread.php *

* In all three classes you ask: result = xf/finder find my something, same code!


Because you are lazy, you don't write your finder three times, instead, you add


Kirby/Name/
Kirby/Name/Pub/Controller/Kirby.php /1
Kirby/Name/Repository/Kirby.php *

Kirby/Name/XF/Pub/Controller/Forum.php /2
Kirby/Name/XF/Pub/Controller/Thread.php /3
Kirby/Name/XF/Repository/Kirby.php **

* has finder for 1
** has finder for /2 and /3

but you still have two times same code in

Kirby/Name/Repository/Kirby.php *
Kirby/Name/XF/Repository/Kirby.php **

Clear now?


To make that short, see above like
/c/p/class
/rep

/xf/c/p/classes
/xf/rep

starting from ... /addon/Kirby/Name
 
Top Bottom