Skip to content

Commit

Permalink
Merge pull request #546 from doctrine/refactor-types
Browse files Browse the repository at this point in the history
Refactor types to be consistent with other Doctrine adapters
  • Loading branch information
jmikola committed May 30, 2013
2 parents 84ea729 + dda08d6 commit 2a2a5cf
Show file tree
Hide file tree
Showing 30 changed files with 101 additions and 73 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use Doctrine\ODM\MongoDB\Event\PreLoadEventArgs;
use Doctrine\ODM\MongoDB\Events;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Mapping\Types\Type;
use Doctrine\ODM\MongoDB\Proxy\Proxy;
use Doctrine\ODM\MongoDB\Types\Type;
use Doctrine\ODM\MongoDB\UnitOfWork;

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Doctrine\ODM\MongoDB\LockException;
use Doctrine\ODM\MongoDB\Mapping\MappingException;
use Doctrine\ODM\MongoDB\Proxy\Proxy;
use Doctrine\ODM\MongoDB\Types\Type;
use InvalidArgumentException;

/**
Expand Down Expand Up @@ -1290,7 +1291,7 @@ public function setIdGenerator($generator)
public function getPHPIdentifierValue($id)
{
$idType = $this->fieldMappings[$this->identifier]['type'];
return Types\Type::getType($idType)->convertToPHPValue($id);
return Type::getType($idType)->convertToPHPValue($id);
}

/**
Expand All @@ -1302,7 +1303,7 @@ public function getPHPIdentifierValue($id)
public function getDatabaseIdentifierValue($id)
{
$idType = $this->fieldMappings[$this->identifier]['type'];
return Types\Type::getType($idType)->convertToDatabaseValue($id);
return Type::getType($idType)->convertToDatabaseValue($id);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
use Doctrine\ODM\MongoDB\LockException;
use Doctrine\ODM\MongoDB\LockMode;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Mapping\Types\Type;
use Doctrine\ODM\MongoDB\MongoDBException;
use Doctrine\ODM\MongoDB\PersistentCollection;
use Doctrine\ODM\MongoDB\Proxy\Proxy;
use Doctrine\ODM\MongoDB\Query\Query;
use Doctrine\ODM\MongoDB\Types\Type;
use Doctrine\ODM\MongoDB\UnitOfWork;

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Mapping\Types\Type;
use Doctrine\ODM\MongoDB\Types\Type;
use Doctrine\ODM\MongoDB\UnitOfWork;

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Tools/DocumentGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ private function generateDocumentStubMethod(ClassMetadataInfo $metadata, $type,

$variableType = $typeHint ? $typeHint . ' ' : null;

$types = \Doctrine\ODM\MongoDB\Mapping\Types\Type::getTypesMap();
$types = \Doctrine\ODM\MongoDB\Types\Type::getTypesMap();
$methodTypeHint = $typeHint && ! isset($types[$typeHint]) ? '\\' . $typeHint . ' ' : null;

$replacements = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The BinDataCustom type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The BinDataFunc type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The BinDataMD5 type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The BinData type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The BinDataUUID type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Boolean type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Collection type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Id type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Date type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The File type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Float type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Array type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Id type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Increment type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Integer Id type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Int type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Key type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The ObjectId type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* Raw data type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The String type.
Expand All @@ -26,7 +26,7 @@
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class StringType extends Type
class StringType extends Type
{
public function convertToDatabaseValue($value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\ODM\MongoDB\Mapping\Types;
namespace Doctrine\ODM\MongoDB\Types;

/**
* The Timestamp type.
Expand All @@ -26,7 +26,7 @@
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class TimestampType extends Type
class TimestampType extends Type
{
public function convertToDatabaseValue($value)
{
Expand Down
Loading

0 comments on commit 2a2a5cf

Please sign in to comment.