Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Step by step :</p> <h1>loading :</h1> <pre><code>require_once('forms.php'); require_once('members.php'); require_once('messages.php'); </code></pre> <p>should be handled by an autoload script given to <code>spl_autoload_register</code> :</p> <pre><code>spl_autoload_register(function($class){ require($class.'.php');}); </code></pre> <p>A <em>very</em> good practice can be to respect the <code>PSR-0</code> norm and using <code>composer</code> as autoloader. To be allowed to use <code>PSR-0</code> be sure you have at least PHP 5.3</p> <h2>What is PSR-0?</h2> <p>It is a recommendation of the PHPFIG to make standard modules which can be included in every php framework easily. It makes a list of rules to follow to be sure your code can be autoloaded in a standard way. So you will use namespaces in sync with the directory architecture.</p> <p>Composer is a powerful tool which rely on PSR-0 to autoload your class. What's more it has the ability to make a dependency tree to load every component that respect PSR-0, for example every Symfony2 bundle can be loaded independantly from Symfony itself, you will just have to load Symfony components the bundle relies on (example the HTTPFundation or the YamlComponent). If your project depends on the Symfony Yaml Component, in a configuration file called <code>composer.json</code> you will add in the <code>require</code> section </p> <pre><code>'Symfony\Component\Yaml': *; </code></pre> <p>and each time you use <code>php composer.phar update</code> it will get the latest version of it and include it to your project.</p> <h1>about dependencies and cycles :</h1> <p>Never use global ! it is a pain to maintain. It has to be used only on despair cases. For yours, you can break the cycle in construction by splitting on assignation in two :</p> <pre><code>class members() { function __construct($forms) { $this-&gt;forms = $forms; $form-&gt;setMembers($this);// here is the trick } } class forms(){ public function __construct($members = null){ $this-&gt;members = $members; } public function setMembers(Members $m){ $this-&gt;members = $members; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload