Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
c9ebbbdf
Commit
c9ebbbdf
authored
Apr 30, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-89: String getters for Database and Collection classes
parent
76d62e2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
Collection.php
src/Collection.php
+23
-2
Database.php
src/Database.php
+20
-0
No files found.
src/Collection.php
View file @
c9ebbbdf
...
@@ -69,6 +69,16 @@ class Collection
...
@@ -69,6 +69,16 @@ class Collection
list
(
$this
->
dbname
,
$this
->
collname
)
=
explode
(
"."
,
$namespace
,
2
);
list
(
$this
->
dbname
,
$this
->
collname
)
=
explode
(
"."
,
$namespace
,
2
);
}
}
/**
* Return the collection namespace.
*
* @param string
*/
public
function
__toString
()
{
return
$this
->
ns
;
}
/**
/**
* Runs an aggregation framework pipeline
* Runs an aggregation framework pipeline
*
*
...
@@ -629,7 +639,7 @@ class Collection
...
@@ -629,7 +639,7 @@ class Collection
}
}
/**
/**
* Return
s the CollectionName this object operates on
* Return
the collection name.
*
*
* @return string
* @return string
*/
*/
...
@@ -677,7 +687,7 @@ class Collection
...
@@ -677,7 +687,7 @@ class Collection
}
}
/**
/**
* Return
s the DatabaseName this object operates on
* Return
the database name.
*
*
* @return string
* @return string
*/
*/
...
@@ -931,6 +941,17 @@ class Collection
...
@@ -931,6 +941,17 @@ class Collection
);
);
}
}
/**
* Return the collection namespace.
*
* @see http://docs.mongodb.org/manual/faq/developers/#faq-dev-namespace
* @return string
*/
public
function
getNamespace
()
{
return
$this
->
ns
;
}
/**
/**
* Retrieves all Write options with their default values.
* Retrieves all Write options with their default values.
*
*
...
...
src/Database.php
View file @
c9ebbbdf
...
@@ -41,6 +41,16 @@ class Database
...
@@ -41,6 +41,16 @@ class Database
$this
->
readPreference
=
$readPreference
;
$this
->
readPreference
=
$readPreference
;
}
}
/**
* Return the database name.
*
* @param string
*/
public
function
__toString
()
{
return
$this
->
databaseName
;
}
/**
/**
* Create a new collection explicitly.
* Create a new collection explicitly.
*
*
...
@@ -89,6 +99,16 @@ class Database
...
@@ -89,6 +99,16 @@ class Database
return
$this
->
manager
->
executeCommand
(
$this
->
databaseName
,
$command
,
$readPreference
);
return
$this
->
manager
->
executeCommand
(
$this
->
databaseName
,
$command
,
$readPreference
);
}
}
/**
* Returns the database name.
*
* @return string
*/
public
function
getDatabaseName
()
{
return
$this
->
databaseName
;
}
/**
/**
* Returns information for all collections in this database.
* Returns information for all collections in this database.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment