Forum

> > Off Topic > MVC & Prototype pattern.
ForenübersichtOff Topic-ÜbersichtEinloggen, um zu antworten

Englisch MVC & Prototype pattern.

1 Antwort
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt MVC & Prototype pattern.

Gaios
Reviewer Off Offline

Zitieren
Hello, I have a question. How to write MVC structure if I need to add Prototype pattern in Controller class yet? Where and how to name new directory (for the Message class)?

1
2
3
4
5
6
7
public function __construct($connection. array $spec)
{
	$this->_prototype = new Message($connection);
	$this->_connection = $connection;
	$this->_spec = $spec;
	$this->_currentMailbox = $spec['mailbox'];
}

In this code,
$this->_prototype = new Message($connection);
creates prototype of Message instance. Where should I put the class file if I have Model, View and Controller directories only? Where and how to name new directory?

Another question - MVC
Can I insert controller of Class2 into controller of Class1? Won't be it a mess afterwards? Or should I make prototype patterns for that only? Eg.:
1
2
3
4
public function __construct()
{
	$this->class2 = new Class2Controller;
}
1× editiert, zuletzt 07.11.17 09:11:21

alt Re: MVC & Prototype pattern.

Yates
Reviewer Off Offline

Zitieren
Messaging would be a service provider which should be injected into your controller whenever you need it or be wrapped with a bootstrapper.

At least that's how I would structure it.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenOff Topic-ÜbersichtForenübersicht