Files
doc-fr/reference/yaf/yaf_application/bootstrap.xml
2022-04-06 12:58:32 +01:00

123 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 73fae4ee51b644b72028e610abefefced57c18ad Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="yaf-application.bootstrap" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Application::bootstrap</refname>
<refpurpose>Appelle bootstrap</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Yaf_Application::bootstrap</methodname>
<methodparam choice="opt"><type>Yaf_Bootstrap_Abstract</type><parameter>bootstrap</parameter></methodparam>
</methodsynopsis>
<para>
Exécute un Bootstrap, toutes les méthodes définies dans le Bootstrap et
nommées avec un préfixe "_init" seront appelées dans l'ordre
de leurs déclarations si le paramètre bootstrap n'est pas fourni,
Yaf recherchera un Bootstrap dans le dossier de l'application.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>bootstrap</parameter></term>
<listitem>
<para>
Une instance <classname>Yaf_Bootstrap_Abstract</classname>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Une instance de la classe <classname>Yaf_Application</classname>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Exemple avec <function>A Bootstrap</function></title>
<programlisting role="php">
<![CDATA[
<?php
/**
* Ce fichier doit être dans le APPLICATION_PATH . "/application/"(qui a été défini dans la configuration passée à Yaf_Application).
* et être nommé Bootstrap.php, aussi, Yaf_Application peut le trouver
*/
class Bootstrap extends Yaf_Bootstrap_Abstract {
function _initConfig(Yaf_Dispatcher $dispatcher) {
echo "1er appel\n";
}
function _initPlugin($dispatcher) {
echo "2ème appel\n";
}
}
?>
]]>
</programlisting>
</example>
<example>
<title>Exemple avec <function>Yaf_Application::bootstrap</function></title>
<programlisting role="php">
<![CDATA[
<?php
defined('APPLICATION_PATH') // APPLICATION_PATH sera utilisé dans le fichier de configuration ini
|| define('APPLICATION_PATH', __DIR__);
$application = new Yaf_Application(APPLICATION_PATH.'/conf/application.ini');
$application->bootstrap();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
1st called
2nd called
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><classname>Yaf_Bootstrap_Abstract</classname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->