forked from doctrine/mongodb-odm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
304 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
require '/Users/jwage/Sites/doctrine2git/lib/Doctrine/Common/ClassLoader.php'; | ||
|
||
use Doctrine\Common\ClassLoader, | ||
Doctrine\Common\Annotations\AnnotationReader, | ||
Doctrine\Common\Cache\ApcCache, | ||
Doctrine\ODM\MongoDB\DocumentManager, | ||
Doctrine\ODM\MongoDB\Mongo, | ||
Doctrine\ODM\MongoDB\Configuration, | ||
Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; | ||
|
||
$classLoader = new ClassLoader('Doctrine\ODM', __DIR__ . '/../lib'); | ||
$classLoader->register(); | ||
|
||
$classLoader = new ClassLoader('Doctrine', '/Users/jwage/Sites/doctrine2git/lib'); | ||
$classLoader->register(); | ||
|
||
$config = new Configuration(); | ||
$config->setMetadataCacheImpl(new ApcCache()); | ||
$config->setProxyDir(__DIR__ . '/Proxies'); | ||
$config->setProxyNamespace('Proxies'); | ||
|
||
$reader = new AnnotationReader(); | ||
$reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\'); | ||
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents')); | ||
|
||
$mongo = new Mongo(); | ||
$dm = DocumentManager::create($mongo, $config); | ||
|
||
/** @Document(db="performance", collection="users") */ | ||
class User | ||
{ | ||
/** @Id */ | ||
public $id; | ||
|
||
/** @String */ | ||
public $username; | ||
|
||
/** @String */ | ||
public $password; | ||
} | ||
|
||
$start = microtime(true); | ||
|
||
/* | ||
$user = new User(); | ||
$user->username = 'user'; | ||
$user->password = 'password'; | ||
$dm->persist($user); | ||
$dm->flush(); | ||
*/ | ||
|
||
$user = $dm->findOne('User', array('username' => 'user')); | ||
|
||
$end = microtime(true); | ||
$total = $end - $start; | ||
|
||
print_r($user); | ||
|
||
echo "Doctrine MongoDB ODM: " . $total."\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
$pdo = new PDO('mysql:host=localhost;dbname=performance', 'root', null); | ||
$stmt = $pdo->prepare('INSERT INTO user (username, password) VALUES (?, ?)'); | ||
$stmt->execute(array('user', 'password')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
$mongo = new Mongo(); | ||
|
||
$start = microtime(true); | ||
|
||
/* | ||
$user = array( | ||
'username' => 'user', | ||
'password' => 'password' | ||
); | ||
$mongo->performance->users->insert($user); | ||
*/ | ||
|
||
$user = $mongo->performance->users->findOne(array('username' => 'user')); | ||
|
||
$end = microtime(true); | ||
$total = $end - $start; | ||
|
||
print_r($user); | ||
|
||
echo "Raw MongoDB Extension: " . $total."\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BinDataCustomType implements Type | ||
class BinDataCustomType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BinDataFuncType implements Type | ||
class BinDataFuncType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BinDataMD5Type implements Type | ||
class BinDataMD5Type extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BinDataType implements Type | ||
class BinDataType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BinDataUUIDType implements Type | ||
class BinDataUUIDType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class BooleanType implements Type | ||
class BooleanType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class DateType implements Type | ||
class DateType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class FileType implements Type | ||
class FileType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class FloatType implements Type | ||
class FloatType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
* @version $Revision$ | ||
* @author Bulat Shakirzyanov <[email protected]> | ||
*/ | ||
class HashType implements Type | ||
class HashType extends Type | ||
{ | ||
public function convertToDatabaseValue($value) | ||
{ | ||
|
Oops, something went wrong.