<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysql-xdevapi-schema.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'mysql-xdevapi-schema.getcollectionastable.php',
    1 => 'Schema::getCollectionAsTable',
    2 => 'Получает коллекцию как объект класса Table',
  ),
  'up' => 
  array (
    0 => 'class.mysql-xdevapi-schema.php',
    1 => 'mysql_xdevapi\\Schema',
  ),
  'prev' => 
  array (
    0 => 'mysql-xdevapi-schema.getcollection.php',
    1 => 'Schema::getCollection',
  ),
  'next' => 
  array (
    0 => 'mysql-xdevapi-schema.getcollections.php',
    1 => 'Schema::getCollections',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/mysql_xdevapi/mysql_xdevapi/schema/getcollectionastable.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysql-xdevapi-schema.getcollectionastable" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Schema::getCollectionAsTable</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">Schema::getCollectionAsTable</span> &mdash; <span class="dc-title">Получает коллекцию как объект класса Table</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysql-xdevapi-schema.getcollectionastable-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysql_xdevapi\Schema::getCollectionAsTable</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>): <span class="type"><a href="class.mysql-xdevapi-table.php" class="type mysql_xdevapi\Table">mysql_xdevapi\Table</a></span></div>

  <p class="para rdfs-comment">
   Получает коллекцию, но как объект Table вместо объекта Collection.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysql-xdevapi-schema.getcollectionastable-parameters">
  <h3 class="title">Список параметров</h3>
  <dl>
   
    <dt><code class="parameter">name</code></dt>
    <dd>
     <p class="para">
      Имя коллекции, из которой создаётся экземпляр объекта Table.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysql-xdevapi-schema.getcollectionastable-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Возвращает объект класса <span class="classname"><a href="class.mysql-xdevapi-table.php" class="classname">mysql_xdevapi\Table</a></span> для коллекции.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysql-xdevapi-schema.getcollectionastable-examples">
  <h3 class="title">Примеры</h3>
  <div class="example" id="example-1">
   <p><strong>Пример #1 Пример использования метода <span class="methodname"><strong>mysql_xdevapi\Schema::getCollectionAsTable()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$session </span><span style="color: #007700">= </span><span style="color: #0000BB">mysql_xdevapi\getSession</span><span style="color: #007700">(</span><span style="color: #DD0000">"mysqlx://user:password@localhost"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sql</span><span style="color: #007700">(</span><span style="color: #DD0000">"DROP DATABASE IF EXISTS addressbook"</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sql</span><span style="color: #007700">(</span><span style="color: #DD0000">"CREATE DATABASE addressbook"</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$schema  </span><span style="color: #007700">= </span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getSchema</span><span style="color: #007700">(</span><span style="color: #DD0000">"addressbook"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$collect </span><span style="color: #007700">= </span><span style="color: #0000BB">$schema</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createCollection</span><span style="color: #007700">(</span><span style="color: #DD0000">"people"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$collect</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #DD0000">'{"name": "Fred",  "age": 21, "job": "Construction"}'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$collect</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #DD0000">'{"name": "Wilma", "age": 23, "job": "Teacher"}'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$table      </span><span style="color: #007700">= </span><span style="color: #0000BB">$schema</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getCollectionAsTable</span><span style="color: #007700">(</span><span style="color: #DD0000">"people"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$collection </span><span style="color: #007700">= </span><span style="color: #0000BB">$schema</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getCollection</span><span style="color: #007700">(</span><span style="color: #DD0000">"people"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$table</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$collection</span><span style="color: #007700">);</span></span></code></div>
   </div>

   
<div class="example-contents"><p>
 Вывод приведённого примера будет похож на:
</p></div>

   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">object(mysql_xdevapi\Table)#4 (1) {
  [&quot;name&quot;]=&gt;
  string(6) &quot;people&quot;
}

object(mysql_xdevapi\Collection)#5 (1) {
  [&quot;name&quot;]=&gt;
  string(6) &quot;people&quot;
}</pre>
</div>
   </div>
  </div>
 </div>


</div><?php manual_footer($setup); ?>