array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'mysql-xdevapi-schema.getcollection.php', 1 => 'Schema::getCollection', ), 'up' => array ( 0 => 'class.mysql-xdevapi-schema.php', 1 => 'mysql_xdevapi\\Schema', ), 'prev' => array ( 0 => 'mysql-xdevapi-schema.existsindatabase.php', 1 => 'Schema::existsInDatabase', ), 'next' => array ( 0 => 'mysql-xdevapi-schema.getcollectionastable.php', 1 => 'Schema::getCollectionAsTable', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysql_xdevapi/mysql_xdevapi/schema/getcollection.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(No version information available, might only be in Git)
Schema::getCollection — Get collection from schema
Get a collection from the schema.
name
Collection name to retrieve.
The Collection object for the selected collection.
Exemplo #1 mysql_xdevapi\Schema::getCollection() example
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS food")->execute();
$session->sql("CREATE DATABASE food")->execute();
$schema = $session->getSchema("food");
$schema->createCollection("trees");
// ...
$trees = $schema->getCollection("trees");
var_dump($trees);
O exemplo acima produzirá algo semelhante a:
object(mysql_xdevapi\Collection)#3 (1) { ["name"]=> string(5) "trees" }