Forum

> > Off Topic > MVC & Prototype pattern.
Forums overviewOff Topic overviewLog in to reply

English MVC & Prototype pattern.

1 reply
To the start Previous 1 Next To the start

old MVC & Prototype pattern.

Gaios
Reviewer Off Offline

Quote
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;
}
edited 1×, last 07.11.17 09:11:21 am

old Re: MVC & Prototype pattern.

Yates
Reviewer Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview