-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-70: Resource CRUD prototypes #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* @param string $databaseName | ||
* @return Result | ||
*/ | ||
public function dropDatabase($databaseName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the Database object have __toString() method and this code explicitly do (string)$databaseName ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we did that and allowed the argument to be either a string or a Database instance, would we get into trouble with dropCollection()
? I would expect a Collection's __toString()
method to return its full namespace, as we do in the 1.x driver. I'd rather not invite the inconsistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proto should definetly not be string|Database, it should be string - but if it does (string) casting inside the method it implicitly allows the Database object to work seamlessly.
as for dropCollection() returning fully qualified namespace...... mmmmh.....
We can move this to a separate, pedantic test class later.
* @return Result | ||
*/ | ||
public function drop() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to this instance after calling drop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec('halt -f');
exit(0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But really, we don't need to do anything. A Collection instance doesn't require anything to actually exist in the database, so there's nothing to clean up in PHP. If we started doing stuff like caching index enumeration class, perhaps, but not now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$collection = $db->createCollection("foo", array("storageEngineOptions" => array("xyz"));
$collection->insert(array("foo" => "bar"));
$collection->drop();
$collection->insert(array("foo" => "bar")); // This will create different configured collection then above
lgtm |
Do we now how stubs for the entire API we want before the alpha release? |
@bjori: I left out |
https://jira.mongodb.org/browse/PHPLIB-70