10bet网址
MySQL PHP API
Download this Manual
PDF (US Ltr)- 2.4Mb
PDF (A4)- 2.4Mb


5.25.5Schema::getCollection

Copyright 1997-2021 the PHP Documentation Group.

  • Schema::getCollection

    Get collection from schema

Description

publicmysql_xdevapi\Collectionmysql_xdevapi\Schema::getCollection(stringname);

Get a collection from the schema.

Parameters

name

Collection name to retrieve.

Return Values

The Collection object for the selected collection.

Examples

Example 5.103 Schema::getCollection example

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);

The above example will output something similar to:

object(mysql_xdevapi\Collection)#3 (1) { ["name"]=> string(5) "trees" }