Vendor update && Started using DoctrineMigrations
This commit is contained in:
32
vendor/doctrine/orm/tests/Doctrine/Tests/DbalFunctionalTestCase.php
vendored
Normal file
32
vendor/doctrine/orm/tests/Doctrine/Tests/DbalFunctionalTestCase.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
class DbalFunctionalTestCase extends DbalTestCase
|
||||
{
|
||||
/* Shared connection when a TestCase is run alone (outside of it's functional suite) */
|
||||
private static $_sharedConn;
|
||||
|
||||
/**
|
||||
* @var Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
protected function resetSharedConn()
|
||||
{
|
||||
$this->sharedFixture['conn'] = null;
|
||||
self::$_sharedConn = null;
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if (isset($this->sharedFixture['conn'])) {
|
||||
$this->_conn = $this->sharedFixture['conn'];
|
||||
} else {
|
||||
if ( ! isset(self::$_sharedConn)) {
|
||||
self::$_sharedConn = TestUtil::getConnection();
|
||||
}
|
||||
$this->_conn = self::$_sharedConn;
|
||||
}
|
||||
}
|
||||
}
|
10
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTestCase.php
vendored
Normal file
10
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTestCase.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
/**
|
||||
* Base testcase class for all dbal testcases.
|
||||
*/
|
||||
class DbalTestCase extends DoctrineTestCase
|
||||
{
|
||||
}
|
34
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
vendored
Normal file
34
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\DbalTypes;
|
||||
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
class NegativeToPositiveType extends Type
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'negative_to_positive';
|
||||
}
|
||||
|
||||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
|
||||
{
|
||||
return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
|
||||
}
|
||||
|
||||
public function canRequireSQLConversion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
|
||||
{
|
||||
return 'ABS(' . $sqlExpr . ')';
|
||||
}
|
||||
|
||||
public function convertToPHPValueSQL($sqlExpr, $platform)
|
||||
{
|
||||
return '-(' . $sqlExpr . ')';
|
||||
}
|
||||
}
|
29
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php
vendored
Normal file
29
vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/UpperCaseStringType.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\DbalTypes;
|
||||
|
||||
use Doctrine\DBAL\Types\StringType;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
class UpperCaseStringType extends StringType
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'upper_case_string';
|
||||
}
|
||||
|
||||
public function canRequireSQLConversion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
|
||||
{
|
||||
return 'UPPER(' . $sqlExpr . ')';
|
||||
}
|
||||
|
||||
public function convertToPHPValueSQL($sqlExpr, $platform)
|
||||
{
|
||||
return 'LOWER(' . $sqlExpr . ')';
|
||||
}
|
||||
}
|
10
vendor/doctrine/orm/tests/Doctrine/Tests/DoctrineTestCase.php
vendored
Normal file
10
vendor/doctrine/orm/tests/Doctrine/Tests/DoctrineTestCase.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
/**
|
||||
* Base testcase class for all Doctrine testcases.
|
||||
*/
|
||||
abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
}
|
14
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php
vendored
Normal file
14
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class ClassMetadataMock extends \Doctrine\ORM\Mapping\ClassMetadata
|
||||
{
|
||||
/* Mock API */
|
||||
|
||||
public function setIdGeneratorType($type)
|
||||
{
|
||||
$this->_generatorType = $type;
|
||||
}
|
||||
|
||||
}
|
106
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/ConnectionMock.php
vendored
Normal file
106
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/ConnectionMock.php
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class ConnectionMock extends \Doctrine\DBAL\Connection
|
||||
{
|
||||
private $_fetchOneResult;
|
||||
private $_platformMock;
|
||||
private $_lastInsertId = 0;
|
||||
private $_inserts = array();
|
||||
private $_executeUpdates = array();
|
||||
|
||||
public function __construct(array $params, $driver, $config = null, $eventManager = null)
|
||||
{
|
||||
$this->_platformMock = new DatabasePlatformMock();
|
||||
|
||||
parent::__construct($params, $driver, $config, $eventManager);
|
||||
|
||||
// Override possible assignment of platform to database platform mock
|
||||
$this->_platform = $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function insert($tableName, array $data, array $types = array())
|
||||
{
|
||||
$this->_inserts[$tableName][] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function executeUpdate($query, array $params = array(), array $types = array())
|
||||
{
|
||||
$this->_executeUpdates[] = array('query' => $query, 'params' => $params, 'types' => $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function lastInsertId($seqName = null)
|
||||
{
|
||||
return $this->_lastInsertId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function fetchColumn($statement, array $params = array(), $colnum = 0)
|
||||
{
|
||||
return $this->_fetchOneResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function quote($input, $type = null)
|
||||
{
|
||||
if (is_string($input)) {
|
||||
return "'" . $input . "'";
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
public function setFetchOneResult($fetchOneResult)
|
||||
{
|
||||
$this->_fetchOneResult = $fetchOneResult;
|
||||
}
|
||||
|
||||
public function setDatabasePlatform($platform)
|
||||
{
|
||||
$this->_platformMock = $platform;
|
||||
}
|
||||
|
||||
public function setLastInsertId($id)
|
||||
{
|
||||
$this->_lastInsertId = $id;
|
||||
}
|
||||
|
||||
public function getInserts()
|
||||
{
|
||||
return $this->_inserts;
|
||||
}
|
||||
|
||||
public function getExecuteUpdates()
|
||||
{
|
||||
return $this->_executeUpdates;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->_inserts = array();
|
||||
$this->_lastInsertId = 0;
|
||||
}
|
||||
}
|
97
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php
vendored
Normal file
97
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
{
|
||||
private $_sequenceNextValSql = "";
|
||||
private $_prefersIdentityColumns = true;
|
||||
private $_prefersSequences = false;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getNativeDeclaration(array $field) {}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getPortableDeclaration(array $field) {}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function prefersIdentityColumns()
|
||||
{
|
||||
return $this->_prefersIdentityColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function prefersSequences()
|
||||
{
|
||||
return $this->_prefersSequences;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
return $this->_sequenceNextValSql;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
public function getBooleanTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getIntegerTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getBigIntTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getSmallIntTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) {}
|
||||
|
||||
/** @override */
|
||||
public function getVarcharTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getClobTypeDeclarationSQL(array $field) {}
|
||||
|
||||
/* MOCK API */
|
||||
|
||||
public function setPrefersIdentityColumns($bool)
|
||||
{
|
||||
$this->_prefersIdentityColumns = $bool;
|
||||
}
|
||||
|
||||
public function setPrefersSequences($bool)
|
||||
{
|
||||
$this->_prefersSequences = $bool;
|
||||
}
|
||||
|
||||
public function setSequenceNextValSql($sql)
|
||||
{
|
||||
$this->_sequenceNextValSql = $sql;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'mock';
|
||||
}
|
||||
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* Gets the SQL Snippet used to declare a BLOB column type.
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
}
|
17
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
vendored
Normal file
17
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class DriverConnectionMock implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
public function prepare($prepareString) {}
|
||||
public function query() {}
|
||||
public function quote($input, $type=\PDO::PARAM_STR) {}
|
||||
public function exec($statement) {}
|
||||
public function lastInsertId($name = null) {}
|
||||
public function beginTransaction() {}
|
||||
public function commit() {}
|
||||
public function rollBack() {}
|
||||
public function errorCode() {}
|
||||
public function errorInfo() {}
|
||||
}
|
72
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DriverMock.php
vendored
Normal file
72
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/DriverMock.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
|
||||
class DriverMock implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
private $_platformMock;
|
||||
|
||||
private $_schemaManagerMock;
|
||||
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new DriverConnectionMock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Sqlite PDO DSN.
|
||||
*
|
||||
* @return string The DSN.
|
||||
* @override
|
||||
*/
|
||||
protected function _constructPdoDsn(array $params)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
if ( ! $this->_platformMock) {
|
||||
$this->_platformMock = new DatabasePlatformMock;
|
||||
}
|
||||
return $this->_platformMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
if($this->_schemaManagerMock == null) {
|
||||
return new SchemaManagerMock($conn);
|
||||
} else {
|
||||
return $this->_schemaManagerMock;
|
||||
}
|
||||
}
|
||||
|
||||
/* MOCK API */
|
||||
|
||||
public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
|
||||
{
|
||||
$this->_platformMock = $platform;
|
||||
}
|
||||
|
||||
public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm)
|
||||
{
|
||||
$this->_schemaManagerMock = $sm;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'mock';
|
||||
}
|
||||
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
106
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/EntityManagerMock.php
vendored
Normal file
106
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/EntityManagerMock.php
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
use Doctrine\ORM\Proxy\ProxyFactory;
|
||||
|
||||
/**
|
||||
* Special EntityManager mock used for testing purposes.
|
||||
*/
|
||||
class EntityManagerMock extends \Doctrine\ORM\EntityManager
|
||||
{
|
||||
private $_uowMock;
|
||||
private $_proxyFactoryMock;
|
||||
private $_idGenerators = array();
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getUnitOfWork()
|
||||
{
|
||||
return isset($this->_uowMock) ? $this->_uowMock : parent::getUnitOfWork();
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
/**
|
||||
* Sets a (mock) UnitOfWork that will be returned when getUnitOfWork() is called.
|
||||
*
|
||||
* @param <type> $uow
|
||||
*/
|
||||
public function setUnitOfWork($uow)
|
||||
{
|
||||
$this->_uowMock = $uow;
|
||||
}
|
||||
|
||||
public function setProxyFactory($proxyFactory)
|
||||
{
|
||||
$this->_proxyFactoryMock = $proxyFactory;
|
||||
}
|
||||
|
||||
public function getProxyFactory()
|
||||
{
|
||||
return isset($this->_proxyFactoryMock) ? $this->_proxyFactoryMock : parent::getProxyFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock factory method to create an EntityManager.
|
||||
*
|
||||
* @param unknown_type $conn
|
||||
* @param unknown_type $name
|
||||
* @param Doctrine_Configuration $config
|
||||
* @param Doctrine_EventManager $eventManager
|
||||
* @return Doctrine\ORM\EntityManager
|
||||
*/
|
||||
public static function create($conn, \Doctrine\ORM\Configuration $config = null,
|
||||
\Doctrine\Common\EventManager $eventManager = null)
|
||||
{
|
||||
if (is_null($config)) {
|
||||
$config = new \Doctrine\ORM\Configuration();
|
||||
$config->setProxyDir(__DIR__ . '/../Proxies');
|
||||
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
||||
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
|
||||
}
|
||||
if (is_null($eventManager)) {
|
||||
$eventManager = new \Doctrine\Common\EventManager();
|
||||
}
|
||||
|
||||
return new EntityManagerMock($conn, $config, $eventManager);
|
||||
}
|
||||
/*
|
||||
public function setIdGenerator($className, $generator)
|
||||
{
|
||||
$this->_idGenerators[$className] = $generator;
|
||||
}
|
||||
*/
|
||||
/** @override */
|
||||
/* public function getIdGenerator($className)
|
||||
{
|
||||
|
||||
if (isset($this->_idGenerators[$className])) {
|
||||
return $this->_idGenerators[$className];
|
||||
}
|
||||
|
||||
return parent::getIdGenerator($className);
|
||||
}
|
||||
*/
|
||||
}
|
100
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php
vendored
Normal file
100
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
/**
|
||||
* EntityPersister implementation used for mocking during tests.
|
||||
*/
|
||||
class EntityPersisterMock extends \Doctrine\ORM\Persisters\BasicEntityPersister
|
||||
{
|
||||
private $_inserts = array();
|
||||
private $_updates = array();
|
||||
private $_deletes = array();
|
||||
private $_identityColumnValueCounter = 0;
|
||||
private $_mockIdGeneratorType;
|
||||
private $_postInsertIds = array();
|
||||
private $existsCalled = false;
|
||||
|
||||
/**
|
||||
* @param <type> $entity
|
||||
* @return <type>
|
||||
* @override
|
||||
*/
|
||||
public function insert($entity)
|
||||
{
|
||||
$this->_inserts[] = $entity;
|
||||
if ( ! is_null($this->_mockIdGeneratorType) && $this->_mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY
|
||||
|| $this->_class->isIdGeneratorIdentity()) {
|
||||
$id = $this->_identityColumnValueCounter++;
|
||||
$this->_postInsertIds[$id] = $entity;
|
||||
return $id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function addInsert($entity)
|
||||
{
|
||||
$this->_inserts[] = $entity;
|
||||
if ( ! is_null($this->_mockIdGeneratorType) && $this->_mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY
|
||||
|| $this->_class->isIdGeneratorIdentity()) {
|
||||
$id = $this->_identityColumnValueCounter++;
|
||||
$this->_postInsertIds[$id] = $entity;
|
||||
return $id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function executeInserts()
|
||||
{
|
||||
return $this->_postInsertIds;
|
||||
}
|
||||
|
||||
public function setMockIdGeneratorType($genType)
|
||||
{
|
||||
$this->_mockIdGeneratorType = $genType;
|
||||
}
|
||||
|
||||
public function update($entity)
|
||||
{
|
||||
$this->_updates[] = $entity;
|
||||
}
|
||||
|
||||
public function exists($entity, array $extraConditions = array())
|
||||
{
|
||||
$this->existsCalled = true;
|
||||
}
|
||||
|
||||
public function delete($entity)
|
||||
{
|
||||
$this->_deletes[] = $entity;
|
||||
}
|
||||
|
||||
public function getInserts()
|
||||
{
|
||||
return $this->_inserts;
|
||||
}
|
||||
|
||||
public function getUpdates()
|
||||
{
|
||||
return $this->_updates;
|
||||
}
|
||||
|
||||
public function getDeletes()
|
||||
{
|
||||
return $this->_deletes;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->existsCalled = false;
|
||||
$this->_identityColumnValueCounter = 0;
|
||||
$this->_inserts = array();
|
||||
$this->_updates = array();
|
||||
$this->_deletes = array();
|
||||
}
|
||||
|
||||
public function isExistsCalled()
|
||||
{
|
||||
return $this->existsCalled;
|
||||
}
|
||||
}
|
111
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
vendored
Normal file
111
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
/**
|
||||
* This class is a mock of the Statement interface that can be passed in to the Hydrator
|
||||
* to test the hydration standalone with faked result sets.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
private $_resultSet;
|
||||
|
||||
/**
|
||||
* Creates a new mock statement that will serve the provided fake result set to clients.
|
||||
*
|
||||
* @param array $resultSet The faked SQL result set.
|
||||
*/
|
||||
public function __construct(array $resultSet)
|
||||
{
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all rows from the result set.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchAll($fetchStyle = null, $columnIndex = null, array $ctorArgs = null)
|
||||
{
|
||||
return $this->_resultSet;
|
||||
}
|
||||
|
||||
public function fetchColumn($columnNumber = 0)
|
||||
{
|
||||
$row = current($this->_resultSet);
|
||||
if ( ! is_array($row)) return false;
|
||||
$val = array_shift($row);
|
||||
return $val !== null ? $val : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the next row in the result set.
|
||||
*
|
||||
*/
|
||||
public function fetch($fetchStyle = null)
|
||||
{
|
||||
$current = current($this->_resultSet);
|
||||
next($this->_resultSet);
|
||||
return $current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setResultSet(array $resultSet)
|
||||
{
|
||||
reset($resultSet);
|
||||
$this->_resultSet = $resultSet;
|
||||
}
|
||||
|
||||
public function bindColumn($column, &$param, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array())
|
||||
{
|
||||
}
|
||||
|
||||
public function columnCount()
|
||||
{
|
||||
}
|
||||
|
||||
public function errorCode()
|
||||
{
|
||||
}
|
||||
|
||||
public function errorInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public function execute($params = array())
|
||||
{
|
||||
}
|
||||
|
||||
public function rowCount()
|
||||
{
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->_resultSet;
|
||||
}
|
||||
|
||||
public function setFetchMode($fetchMode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
12
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/IdentityIdGeneratorMock.php
vendored
Normal file
12
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/IdentityIdGeneratorMock.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator
|
||||
{
|
||||
private $_mockPostInsertId;
|
||||
|
||||
public function setMockPostInsertId($id) {
|
||||
$this->_mockPostInsertId = $id;
|
||||
}
|
||||
}
|
21
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php
vendored
Normal file
21
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class MetadataDriverMock implements \Doctrine\ORM\Mapping\Driver\Driver
|
||||
{
|
||||
public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function isTransient($className)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAllClassNames()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
17
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/MockTreeWalker.php
vendored
Normal file
17
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/MockTreeWalker.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class MockTreeWalker extends \Doctrine\ORM\Query\TreeWalkerAdapter
|
||||
{
|
||||
/**
|
||||
* Gets an executor that can be used to execute the result of this walker.
|
||||
*
|
||||
* @return AbstractExecutor
|
||||
*/
|
||||
public function getExecutor($AST)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
13
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
vendored
Normal file
13
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager
|
||||
{
|
||||
public function __construct(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
parent::__construct($conn);
|
||||
}
|
||||
|
||||
protected function _getPortableTableColumnDefinition($tableColumn) {}
|
||||
}
|
52
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/SequenceMock.php
vendored
Normal file
52
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/SequenceMock.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator
|
||||
{
|
||||
private $_sequenceNumber = 0;
|
||||
|
||||
public function generate(EntityManager $em, $entity)
|
||||
{
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function nextId($seqName, $ondemand = true)
|
||||
{
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function lastInsertId($table = null, $field = null)
|
||||
{
|
||||
return $this->_sequenceNumber - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function currId($seqName)
|
||||
{
|
||||
return $this->_sequenceNumber;
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->_sequenceNumber = 0;
|
||||
}
|
||||
|
||||
public function autoinc()
|
||||
{
|
||||
$this->_sequenceNumber++;
|
||||
}
|
||||
}
|
||||
|
81
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/TaskMock.php
vendored
Normal file
81
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/TaskMock.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
use Doctrine\Common\Cli\AbstractNamespace;
|
||||
|
||||
/**
|
||||
* TaskMock used for testing the CLI interface.
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class TaskMock extends \Doctrine\Common\Cli\Tasks\AbstractTask
|
||||
{
|
||||
/**
|
||||
* Since instances of this class can be created elsewhere all instances
|
||||
* register themselves in this array for later inspection.
|
||||
*
|
||||
* @var array(TaskMock)
|
||||
*/
|
||||
static public $instances = array();
|
||||
|
||||
private $runCounter = 0;
|
||||
|
||||
/**
|
||||
* Constructor of Task Mock Object.
|
||||
* Makes sure the object can be inspected later.
|
||||
*
|
||||
* @param AbstractNamespace CLI Namespace, passed to parent constructor
|
||||
*/
|
||||
function __construct(AbstractNamespace $namespace)
|
||||
{
|
||||
self::$instances[] = $this;
|
||||
|
||||
parent::__construct($namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of times run() was called on this object.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRunCounter()
|
||||
{
|
||||
return $this->runCounter;
|
||||
}
|
||||
|
||||
/* Mock API */
|
||||
|
||||
/**
|
||||
* Method invoked by CLI to run task.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->runCounter++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method supposed to generate the CLI Task Documentation
|
||||
*/
|
||||
public function buildDocumentation()
|
||||
{
|
||||
}
|
||||
}
|
58
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php
vendored
Normal file
58
vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Mocks;
|
||||
|
||||
class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork
|
||||
{
|
||||
private $_mockDataChangeSets = array();
|
||||
private $_persisterMock;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getEntityPersister($entityName)
|
||||
{
|
||||
return isset($this->_persisterMock[$entityName]) ?
|
||||
$this->_persisterMock[$entityName] : parent::getEntityPersister($entityName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param <type> $entity
|
||||
* @override
|
||||
*/
|
||||
public function getEntityChangeSet($entity)
|
||||
{
|
||||
$oid = spl_object_hash($entity);
|
||||
return isset($this->_mockDataChangeSets[$oid]) ?
|
||||
$this->_mockDataChangeSets[$oid] : parent::getEntityChangeSet($entity);
|
||||
}
|
||||
|
||||
/* MOCK API */
|
||||
|
||||
/**
|
||||
* Sets a (mock) persister for an entity class that will be returned when
|
||||
* getEntityPersister() is invoked for that class.
|
||||
*
|
||||
* @param <type> $entityName
|
||||
* @param <type> $persister
|
||||
*/
|
||||
public function setEntityPersister($entityName, $persister)
|
||||
{
|
||||
$this->_persisterMock[$entityName] = $persister;
|
||||
}
|
||||
|
||||
public function setDataChangeSet($entity, array $mockChangeSet)
|
||||
{
|
||||
$this->_mockDataChangeSets[spl_object_hash($entity)] = $mockChangeSet;
|
||||
}
|
||||
|
||||
public function setEntityState($entity, $state)
|
||||
{
|
||||
$this->_entityStates[spl_object_hash($entity)] = $state;
|
||||
}
|
||||
|
||||
public function setOriginalEntityData($entity, array $originalData)
|
||||
{
|
||||
$this->_originalEntityData[spl_object_hash($entity)] = $originalData;
|
||||
}
|
||||
}
|
72
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsAddress.php
vendored
Normal file
72
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsAddress.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* CmsAddress
|
||||
*
|
||||
* @author Roman S. Borschel
|
||||
* @Entity
|
||||
* @Table(name="cms_addresses")
|
||||
*/
|
||||
class CmsAddress
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(length=50)
|
||||
*/
|
||||
public $country;
|
||||
|
||||
/**
|
||||
* @Column(length=50)
|
||||
*/
|
||||
public $zip;
|
||||
|
||||
/**
|
||||
* @Column(length=50)
|
||||
*/
|
||||
public $city;
|
||||
|
||||
/**
|
||||
* Testfield for Schema Updating Tests.
|
||||
*/
|
||||
public $street;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="CmsUser", inversedBy="address")
|
||||
* @JoinColumn(referencedColumnName="id")
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getCountry() {
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function getZipCode() {
|
||||
return $this->zip;
|
||||
}
|
||||
|
||||
public function getCity() {
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
public function setUser(CmsUser $user) {
|
||||
if ($this->user !== $user) {
|
||||
$this->user = $user;
|
||||
$user->setAddress($this);
|
||||
}
|
||||
}
|
||||
}
|
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsArticle.php
vendored
Normal file
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsArticle.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="cms_articles")
|
||||
*/
|
||||
class CmsArticle
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
public $topic;
|
||||
/**
|
||||
* @Column(type="text")
|
||||
*/
|
||||
public $text;
|
||||
/**
|
||||
* @ManyToOne(targetEntity="CmsUser", inversedBy="articles")
|
||||
* @JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*/
|
||||
public $user;
|
||||
/**
|
||||
* @OneToMany(targetEntity="CmsComment", mappedBy="article")
|
||||
*/
|
||||
public $comments;
|
||||
|
||||
/**
|
||||
* @Version @column(type="integer")
|
||||
*/
|
||||
public $version;
|
||||
|
||||
public function setAuthor(CmsUser $author) {
|
||||
$this->user = $author;
|
||||
}
|
||||
|
||||
public function addComment(CmsComment $comment) {
|
||||
$this->comments[] = $comment;
|
||||
$comment->setArticle($this);
|
||||
}
|
||||
}
|
38
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsComment.php
vendored
Normal file
38
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsComment.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="cms_comments")
|
||||
*/
|
||||
class CmsComment
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
public $topic;
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
public $text;
|
||||
/**
|
||||
* @ManyToOne(targetEntity="CmsArticle", inversedBy="comments")
|
||||
* @JoinColumn(name="article_id", referencedColumnName="id")
|
||||
*/
|
||||
public $article;
|
||||
|
||||
public function setArticle(CmsArticle $article) {
|
||||
$this->article = $article;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return __CLASS__."[id=".$this->id."]";
|
||||
}
|
||||
}
|
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsEmail.php
vendored
Normal file
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsEmail.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* CmsEmail
|
||||
*
|
||||
* @Entity
|
||||
* @Table(name="cms_emails")
|
||||
*/
|
||||
class CmsEmail
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(length=250)
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="CmsUser", mappedBy="email")
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getEmail() {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail($email) {
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setUser(CmsUser $user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
44
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php
vendored
Normal file
44
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* Description of CmsEmployee
|
||||
*
|
||||
* @author robo
|
||||
* @Entity
|
||||
* @Table(name="cms_employees")
|
||||
*/
|
||||
class CmsEmployee
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="CmsEmployee")
|
||||
* @JoinColumn(name="spouse_id", referencedColumnName="id")
|
||||
*/
|
||||
private $spouse;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getSpouse() {
|
||||
return $this->spouse;
|
||||
}
|
||||
}
|
||||
|
49
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsGroup.php
vendored
Normal file
49
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsGroup.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* Description of CmsGroup
|
||||
*
|
||||
* @author robo
|
||||
* @Entity
|
||||
* @Table(name="cms_groups")
|
||||
*/
|
||||
class CmsGroup
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(length=50)
|
||||
*/
|
||||
public $name;
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CmsUser", mappedBy="groups")
|
||||
*/
|
||||
public $users;
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function addUser(CmsUser $user) {
|
||||
$this->users[] = $user;
|
||||
}
|
||||
|
||||
public function getUsers() {
|
||||
return $this->users;
|
||||
}
|
||||
}
|
||||
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="cms_phonenumbers")
|
||||
*/
|
||||
class CmsPhonenumber
|
||||
{
|
||||
/**
|
||||
* @Id @Column(length=50)
|
||||
*/
|
||||
public $phonenumber;
|
||||
/**
|
||||
* @ManyToOne(targetEntity="CmsUser", inversedBy="phonenumbers", cascade={"merge"})
|
||||
* @JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public function setUser(CmsUser $user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
}
|
139
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsUser.php
vendored
Normal file
139
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CMS/CmsUser.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CMS;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="cms_users")
|
||||
* @NamedQueries({
|
||||
* @NamedQuery(name="all", query="SELECT u FROM __CLASS__ u")
|
||||
* })
|
||||
*/
|
||||
class CmsUser
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
public $status;
|
||||
/**
|
||||
* @Column(type="string", length=255, unique=true)
|
||||
*/
|
||||
public $username;
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
public $name;
|
||||
/**
|
||||
* @OneToMany(targetEntity="CmsPhonenumber", mappedBy="user", cascade={"persist", "merge"}, orphanRemoval=true)
|
||||
*/
|
||||
public $phonenumbers;
|
||||
/**
|
||||
* @OneToMany(targetEntity="CmsArticle", mappedBy="user", cascade={"detach"})
|
||||
*/
|
||||
public $articles;
|
||||
/**
|
||||
* @OneToOne(targetEntity="CmsAddress", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
public $address;
|
||||
/**
|
||||
* @OneToOne(targetEntity="CmsEmail", inversedBy="user", cascade={"persist"}, orphanRemoval=true)
|
||||
* @JoinColumn(referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
public $email;
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CmsGroup", inversedBy="users", cascade={"persist", "merge", "detach"})
|
||||
* @JoinTable(name="cms_users_groups",
|
||||
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
public $groups;
|
||||
|
||||
public function __construct() {
|
||||
$this->phonenumbers = new ArrayCollection;
|
||||
$this->articles = new ArrayCollection;
|
||||
$this->groups = new ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a phonenumber to the user.
|
||||
*
|
||||
* @param CmsPhonenumber $phone
|
||||
*/
|
||||
public function addPhonenumber(CmsPhonenumber $phone) {
|
||||
$this->phonenumbers[] = $phone;
|
||||
$phone->setUser($this);
|
||||
}
|
||||
|
||||
public function getPhonenumbers() {
|
||||
return $this->phonenumbers;
|
||||
}
|
||||
|
||||
public function addArticle(CmsArticle $article) {
|
||||
$this->articles[] = $article;
|
||||
$article->setAuthor($this);
|
||||
}
|
||||
|
||||
public function addGroup(CmsGroup $group) {
|
||||
$this->groups[] = $group;
|
||||
$group->addUser($this);
|
||||
}
|
||||
|
||||
public function getGroups() {
|
||||
return $this->groups;
|
||||
}
|
||||
|
||||
public function removePhonenumber($index) {
|
||||
if (isset($this->phonenumbers[$index])) {
|
||||
$ph = $this->phonenumbers[$index];
|
||||
unset($this->phonenumbers[$index]);
|
||||
$ph->user = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAddress() { return $this->address; }
|
||||
|
||||
public function setAddress(CmsAddress $address) {
|
||||
if ($this->address !== $address) {
|
||||
$this->address = $address;
|
||||
$address->setUser($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmail() { return $this->email; }
|
||||
|
||||
public function setEmail(CmsEmail $email = null) {
|
||||
if ($this->email !== $email) {
|
||||
$this->email = $email;
|
||||
|
||||
if ($email) {
|
||||
$email->setUser($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyAuction.php
vendored
Normal file
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyAuction.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/** @Entity @Table(name="company_auctions") */
|
||||
class CompanyAuction extends CompanyEvent {
|
||||
/** @Column(type="string") */
|
||||
private $data;
|
||||
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
}
|
33
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyCar.php
vendored
Normal file
33
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyCar.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="company_cars")
|
||||
*/
|
||||
class CompanyCar
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string", length=50)
|
||||
*/
|
||||
private $brand;
|
||||
|
||||
public function __construct($brand = null) {
|
||||
$this->brand = $brand;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getBrand() {
|
||||
return $this->title;
|
||||
}
|
||||
}
|
89
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyContract.php
vendored
Normal file
89
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyContract.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="company_contracts")
|
||||
* @InheritanceType("SINGLE_TABLE")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({
|
||||
* "fix" = "CompanyFixContract",
|
||||
* "flexible" = "CompanyFlexContract",
|
||||
* "flexultra" = "CompanyFlexUltraContract"
|
||||
* })
|
||||
*/
|
||||
abstract class CompanyContract
|
||||
{
|
||||
/**
|
||||
* @Id @column(type="integer") @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="CompanyEmployee", inversedBy="soldContracts")
|
||||
*/
|
||||
private $salesPerson;
|
||||
|
||||
/**
|
||||
* @Column(type="boolean")
|
||||
* @var bool
|
||||
*/
|
||||
private $completed = false;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CompanyEmployee", inversedBy="contracts")
|
||||
* @JoinTable(name="company_contract_employees",
|
||||
* joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
|
||||
* inverseJoinColumns={@JoinColumn(name="employee_id", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
private $engineers;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->engineers = new \Doctrine\Common\Collections\ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function markCompleted()
|
||||
{
|
||||
$this->completed = true;
|
||||
}
|
||||
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->completed;
|
||||
}
|
||||
|
||||
public function getSalesPerson()
|
||||
{
|
||||
return $this->salesPerson;
|
||||
}
|
||||
|
||||
public function setSalesPerson(CompanyEmployee $salesPerson)
|
||||
{
|
||||
$this->salesPerson = $salesPerson;
|
||||
}
|
||||
|
||||
public function getEngineers()
|
||||
{
|
||||
return $this->engineers;
|
||||
}
|
||||
|
||||
public function addEngineer(CompanyEmployee $engineer)
|
||||
{
|
||||
$this->engineers[] = $engineer;
|
||||
}
|
||||
|
||||
public function removeEngineer(CompanyEmployee $engineer)
|
||||
{
|
||||
$this->engineers->removeElement($engineer);
|
||||
}
|
||||
|
||||
abstract public function calculatePrice();
|
||||
}
|
59
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php
vendored
Normal file
59
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="company_employees")
|
||||
*/
|
||||
class CompanyEmployee extends CompanyPerson
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
private $salary;
|
||||
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
private $department;
|
||||
|
||||
/**
|
||||
* @Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CompanyContract", mappedBy="engineers", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
public $contracts;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="CompanyFlexUltraContract", mappedBy="salesPerson", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
public $soldContracts;
|
||||
|
||||
public function getSalary() {
|
||||
return $this->salary;
|
||||
}
|
||||
|
||||
public function setSalary($salary) {
|
||||
$this->salary = $salary;
|
||||
}
|
||||
|
||||
public function getDepartment() {
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
public function setDepartment($dep) {
|
||||
$this->department = $dep;
|
||||
}
|
||||
|
||||
public function getStartDate() {
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
public function setStartDate($date) {
|
||||
$this->startDate = $date;
|
||||
}
|
||||
}
|
36
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyEvent.php
vendored
Normal file
36
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyEvent.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity @Table(name="company_events")
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="event_type", type="string")
|
||||
* @DiscriminatorMap({"auction"="CompanyAuction", "raffle"="CompanyRaffle"})
|
||||
*/
|
||||
abstract class CompanyEvent {
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="CompanyOrganization", inversedBy="events", cascade={"persist"})
|
||||
* @JoinColumn(name="org_id", referencedColumnName="id")
|
||||
*/
|
||||
private $organization;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOrganization() {
|
||||
return $this->organization;
|
||||
}
|
||||
|
||||
public function setOrganization(CompanyOrganization $org) {
|
||||
$this->organization = $org;
|
||||
}
|
||||
|
||||
}
|
30
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php
vendored
Normal file
30
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFixContract.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class CompanyFixContract extends CompanyContract
|
||||
{
|
||||
/**
|
||||
* @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $fixPrice = 0;
|
||||
|
||||
public function calculatePrice()
|
||||
{
|
||||
return $this->fixPrice;
|
||||
}
|
||||
|
||||
public function getFixPrice()
|
||||
{
|
||||
return $this->fixPrice;
|
||||
}
|
||||
|
||||
public function setFixPrice($fixPrice)
|
||||
{
|
||||
$this->fixPrice = $fixPrice;
|
||||
}
|
||||
}
|
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php
vendored
Normal file
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class CompanyFlexContract extends CompanyContract
|
||||
{
|
||||
/**
|
||||
* @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $hoursWorked = 0;
|
||||
|
||||
/**
|
||||
* @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $pricePerHour = 0;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CompanyManager", inversedBy="managedContracts", fetch="EXTRA_LAZY")
|
||||
* @JoinTable(name="company_contract_managers",
|
||||
* joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
|
||||
* inverseJoinColumns={@JoinColumn(name="employee_id", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
public $managers;
|
||||
|
||||
public function calculatePrice()
|
||||
{
|
||||
return $this->hoursWorked * $this->pricePerHour;
|
||||
}
|
||||
|
||||
public function getHoursWorked()
|
||||
{
|
||||
return $this->hoursWorked;
|
||||
}
|
||||
|
||||
public function setHoursWorked($hoursWorked)
|
||||
{
|
||||
$this->hoursWorked = $hoursWorked;
|
||||
}
|
||||
|
||||
public function getPricePerHour()
|
||||
{
|
||||
return $this->pricePerHour;
|
||||
}
|
||||
|
||||
public function setPricePerHour($pricePerHour)
|
||||
{
|
||||
$this->pricePerHour = $pricePerHour;
|
||||
}
|
||||
public function getManagers()
|
||||
{
|
||||
return $this->managers;
|
||||
}
|
||||
|
||||
public function addManager(CompanyManager $manager)
|
||||
{
|
||||
$this->managers[] = $manager;
|
||||
}
|
||||
|
||||
public function removeManager(CompanyManager $manager)
|
||||
{
|
||||
$this->managers->removeElement($manager);
|
||||
}
|
||||
}
|
30
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php
vendored
Normal file
30
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyFlexUltraContract.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class CompanyFlexUltraContract extends CompanyFlexContract
|
||||
{
|
||||
/**
|
||||
* @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $maxPrice = 0;
|
||||
|
||||
public function calculatePrice()
|
||||
{
|
||||
return max($this->maxPrice, parent::calculatePrice());
|
||||
}
|
||||
|
||||
public function getMaxPrice()
|
||||
{
|
||||
return $this->maxPrice;
|
||||
}
|
||||
|
||||
public function setMaxPrice($maxPrice)
|
||||
{
|
||||
$this->maxPrice = $maxPrice;
|
||||
}
|
||||
}
|
42
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyManager.php
vendored
Normal file
42
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyManager.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="company_managers")
|
||||
*/
|
||||
class CompanyManager extends CompanyEmployee
|
||||
{
|
||||
/**
|
||||
* @Column(type="string", length=250)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="CompanyCar", cascade={"persist"})
|
||||
* @JoinColumn(name="car_id", referencedColumnName="id")
|
||||
*/
|
||||
private $car;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CompanyFlexContract", mappedBy="managers", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
public $managedContracts;
|
||||
|
||||
public function getTitle() {
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle($title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getCar() {
|
||||
return $this->car;
|
||||
}
|
||||
|
||||
public function setCar(CompanyCar $car) {
|
||||
$this->car = $car;
|
||||
}
|
||||
}
|
44
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php
vendored
Normal file
44
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/** @Entity @Table(name="company_organizations") */
|
||||
class CompanyOrganization {
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="CompanyEvent", mappedBy="organization", cascade={"persist"}, fetch="EXTRA_LAZY")
|
||||
*/
|
||||
public $events;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getEvents() {
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
public function addEvent(CompanyEvent $event) {
|
||||
$this->events[] = $event;
|
||||
$event->setOrganization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="CompanyEvent", cascade={"persist"})
|
||||
* @JoinColumn(name="main_event_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private $mainevent;
|
||||
|
||||
public function getMainEvent() {
|
||||
return $this->mainevent;
|
||||
}
|
||||
|
||||
public function setMainEvent($event) {
|
||||
$this->mainevent = $event;
|
||||
}
|
||||
}
|
82
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyPerson.php
vendored
Normal file
82
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyPerson.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/**
|
||||
* Description of CompanyPerson
|
||||
*
|
||||
* @author robo
|
||||
* @Entity
|
||||
* @Table(name="company_persons")
|
||||
* @InheritanceType("JOINED")
|
||||
* @DiscriminatorColumn(name="discr", type="string")
|
||||
* @DiscriminatorMap({
|
||||
* "person" = "CompanyPerson",
|
||||
* "manager" = "CompanyManager",
|
||||
* "employee" = "CompanyEmployee"})
|
||||
*/
|
||||
class CompanyPerson
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
/**
|
||||
* @Column
|
||||
*/
|
||||
private $name;
|
||||
/**
|
||||
* @OneToOne(targetEntity="CompanyPerson")
|
||||
* @JoinColumn(name="spouse_id", referencedColumnName="id")
|
||||
*/
|
||||
private $spouse;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="CompanyPerson")
|
||||
* @JoinTable(name="company_persons_friends",
|
||||
joinColumns={@JoinColumn(name="person_id", referencedColumnName="id")},
|
||||
inverseJoinColumns={@JoinColumn(name="friend_id", referencedColumnName="id")})
|
||||
*/
|
||||
private $friends;
|
||||
|
||||
public function __construct() {
|
||||
$this->friends = new \Doctrine\Common\Collections\ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getSpouse() {
|
||||
return $this->spouse;
|
||||
}
|
||||
|
||||
public function getFriends() {
|
||||
return $this->friends;
|
||||
}
|
||||
|
||||
public function addFriend(CompanyPerson $friend) {
|
||||
if ( ! $this->friends->contains($friend)) {
|
||||
$this->friends->add($friend);
|
||||
$friend->addFriend($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function setSpouse(CompanyPerson $spouse) {
|
||||
if ($spouse !== $this->spouse) {
|
||||
$this->spouse = $spouse;
|
||||
$this->spouse->setSpouse($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php
vendored
Normal file
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Company/CompanyRaffle.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Company;
|
||||
|
||||
/** @Entity @Table(name="company_raffles") */
|
||||
class CompanyRaffle extends CompanyEvent {
|
||||
/** @Column */
|
||||
private $data;
|
||||
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
}
|
21
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php
vendored
Normal file
21
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CustomType;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="customtype_children")
|
||||
*/
|
||||
class CustomTypeChild
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="upper_case_string")
|
||||
*/
|
||||
public $lowerCaseString = 'foo';
|
||||
}
|
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php
vendored
Normal file
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CustomType;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="customtype_parents")
|
||||
*/
|
||||
class CustomTypeParent
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="negative_to_positive", nullable=true)
|
||||
*/
|
||||
public $customInteger;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeChild", cascade={"persist", "remove"})
|
||||
*/
|
||||
public $child;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeParent", mappedBy="myFriends")
|
||||
*/
|
||||
private $friendsWithMe;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeParent", inversedBy="friendsWithMe")
|
||||
* @JoinTable(
|
||||
* name="customtype_parent_friends",
|
||||
* joinColumns={@JoinColumn(name="customtypeparent_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="friend_customtypeparent_id", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
private $myFriends;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->friendsWithMe = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->myFriends = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
public function addMyFriend(CustomTypeParent $friend)
|
||||
{
|
||||
$this->getMyFriends()->add($friend);
|
||||
$friend->addFriendWithMe($this);
|
||||
}
|
||||
|
||||
public function getMyFriends()
|
||||
{
|
||||
return $this->myFriends;
|
||||
}
|
||||
|
||||
public function addFriendWithMe(CustomTypeParent $friend)
|
||||
{
|
||||
$this->getFriendsWithMe()->add($friend);
|
||||
}
|
||||
|
||||
public function getFriendsWithMe()
|
||||
{
|
||||
return $this->friendsWithMe;
|
||||
}
|
||||
}
|
21
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php
vendored
Normal file
21
vendor/doctrine/orm/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\CustomType;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="customtype_uppercases")
|
||||
*/
|
||||
class CustomTypeUpperCase
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="upper_case_string")
|
||||
*/
|
||||
public $lowerCaseString;
|
||||
}
|
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php
vendored
Normal file
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117ApproveChanges
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer") @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="DDC117ArticleDetails")
|
||||
* @JoinColumn(name="details_id", referencedColumnName="article_id")
|
||||
*/
|
||||
private $articleDetails;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="DDC117Reference")
|
||||
* @JoinColumns({
|
||||
* @JoinColumn(name="source_id", referencedColumnName="source_id"),
|
||||
* @JoinColumn(name="target_id", referencedColumnName="target_id")
|
||||
* })
|
||||
*/
|
||||
private $reference;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="DDC117Translation")
|
||||
* @JoinColumns({
|
||||
* @JoinColumn(name="trans_article_id", referencedColumnName="article_id"),
|
||||
* @JoinColumn(name="trans_language", referencedColumnName="language")
|
||||
* })
|
||||
*/
|
||||
private $translation;
|
||||
|
||||
public function __construct($details, $reference, $translation)
|
||||
{
|
||||
$this->articleDetails = $details;
|
||||
$this->reference = $reference;
|
||||
$this->translation = $translation;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getArticleDetails()
|
||||
{
|
||||
return $this->articleDetails;
|
||||
}
|
||||
|
||||
public function getReference()
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function getTranslation()
|
||||
{
|
||||
return $this->translation;
|
||||
}
|
||||
}
|
87
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php
vendored
Normal file
87
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117Article
|
||||
{
|
||||
/** @Id @Column(type="integer", name="article_id") @GeneratedValue */
|
||||
private $id;
|
||||
|
||||
/** @Column */
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC117Reference", mappedBy="source", cascade={"remove"})
|
||||
*/
|
||||
private $references;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="DDC117ArticleDetails", mappedBy="article", cascade={"persist", "remove"})
|
||||
*/
|
||||
private $details;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC117Translation", mappedBy="article", cascade={"persist", "remove"})
|
||||
*/
|
||||
private $translations;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC117Link", mappedBy="source")
|
||||
*/
|
||||
private $links;
|
||||
|
||||
public function __construct($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->references = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->translations = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
public function setDetails($details)
|
||||
{
|
||||
$this->details = $details;
|
||||
}
|
||||
|
||||
public function id()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function addReference($reference)
|
||||
{
|
||||
$this->references[] = $reference;
|
||||
}
|
||||
|
||||
public function references()
|
||||
{
|
||||
return $this->references;
|
||||
}
|
||||
|
||||
public function addTranslation($language, $title)
|
||||
{
|
||||
$this->translations[] = new DDC117Translation($this, $language, $title);
|
||||
}
|
||||
|
||||
public function getText()
|
||||
{
|
||||
return $this->details->getText();
|
||||
}
|
||||
|
||||
public function getDetails()
|
||||
{
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
public function resetText()
|
||||
{
|
||||
$this->details = null;
|
||||
}
|
||||
|
||||
public function getTranslations()
|
||||
{
|
||||
return $this->translations;
|
||||
}
|
||||
}
|
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117ArticleDetails.php
vendored
Normal file
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117ArticleDetails.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117ArticleDetails
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @OneToOne(targetEntity="DDC117Article", inversedBy="details")
|
||||
* @JoinColumn(name="article_id", referencedColumnName="article_id")
|
||||
*/
|
||||
private $article;
|
||||
|
||||
/**
|
||||
* @Column(type="text")
|
||||
*/
|
||||
private $text;
|
||||
|
||||
public function __construct($article, $text)
|
||||
{
|
||||
$this->article = $article;
|
||||
$article->setDetails($this);
|
||||
|
||||
$this->update($text);
|
||||
}
|
||||
|
||||
public function update($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
}
|
54
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php
vendored
Normal file
54
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117Editor
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer") @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="DDC117Translation", inversedBy="reviewedByEditors")
|
||||
* @JoinTable(
|
||||
* inverseJoinColumns={
|
||||
* @JoinColumn(name="article_id", referencedColumnName="article_id"),
|
||||
* @JoinColumn(name="language", referencedColumnName="language")
|
||||
* },
|
||||
* joinColumns={
|
||||
* @JoinColumn(name="editor_id", referencedColumnName="id")
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
public $reviewingTranslations;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="DDC117Translation", inversedBy="lastTranslatedBy")
|
||||
* @JoinColumns({
|
||||
* @JoinColumn(name="lt_article_id", referencedColumnName="article_id"),
|
||||
* @JoinColumn(name="lt_language", referencedColumnName="language")
|
||||
* })
|
||||
*/
|
||||
public $lastTranslation;
|
||||
|
||||
public function __construct($name = "")
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->reviewingTranslations = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
public function addLastTranslation(DDC117Translation $t)
|
||||
{
|
||||
$this->lastTranslation = $t;
|
||||
$t->lastTranslatedBy[] = $this;
|
||||
}
|
||||
}
|
31
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Link.php
vendored
Normal file
31
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Link.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* Foreign Key Entity without additional fields!
|
||||
*
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117Link
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="DDC117Article", inversedBy="links")
|
||||
* @JoinColumn(name="source_id", referencedColumnName="article_id")
|
||||
*/
|
||||
public $source;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="DDC117Article")
|
||||
* @JoinColumn(name="target_id", referencedColumnName="article_id")
|
||||
*/
|
||||
public $target;
|
||||
|
||||
public function __construct($source, $target, $description)
|
||||
{
|
||||
$this->source = $source;
|
||||
$this->target = $target;
|
||||
}
|
||||
}
|
64
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php
vendored
Normal file
64
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117Reference
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="DDC117Article", inversedBy="references")
|
||||
* @JoinColumn(name="source_id", referencedColumnName="article_id")
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="DDC117Article")
|
||||
* @JoinColumn(name="target_id", referencedColumnName="article_id")
|
||||
*/
|
||||
private $target;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @column(type="datetime")
|
||||
*/
|
||||
private $created;
|
||||
|
||||
public function __construct($source, $target, $description)
|
||||
{
|
||||
$source->addReference($this);
|
||||
$target->addReference($this);
|
||||
|
||||
$this->source = $source;
|
||||
$this->target = $target;
|
||||
$this->description = $description;
|
||||
$this->created = new \DateTime("now");
|
||||
}
|
||||
|
||||
public function source()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function target()
|
||||
{
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
public function setDescription($desc)
|
||||
{
|
||||
$this->description = $desc;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
}
|
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Translation.php
vendored
Normal file
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC117/DDC117Translation.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC117;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC117Translation
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="DDC117Article", inversedBy="translations")
|
||||
* @JoinColumn(name="article_id", referencedColumnName="article_id")
|
||||
*/
|
||||
private $article;
|
||||
|
||||
/**
|
||||
* @Id @column(type="string")
|
||||
*/
|
||||
private $language;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="DDC117Editor", mappedBy="reviewingTranslations")
|
||||
*/
|
||||
public $reviewedByEditors;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="DDC117Editor", mappedBy="lastTranslation")
|
||||
*/
|
||||
public $lastTranslatedBy;
|
||||
|
||||
public function __construct($article, $language, $title)
|
||||
{
|
||||
$this->article = $article;
|
||||
$this->language = $language;
|
||||
$this->title = $title;
|
||||
$this->reviewedByEditors = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->lastTranslatedBy = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
public function getArticleId()
|
||||
{
|
||||
return $this->article->id();
|
||||
}
|
||||
|
||||
public function getLanguage()
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
public function getLastTranslatedBy()
|
||||
{
|
||||
return $this->lastTranslatedBy;
|
||||
}
|
||||
|
||||
public function getReviewedByEditors()
|
||||
{
|
||||
return $this->reviewedByEditors;
|
||||
}
|
||||
}
|
76
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php
vendored
Normal file
76
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC1476/DDC1476EntityWithDefaultFieldType.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC1476;
|
||||
|
||||
/**
|
||||
* @Entity()
|
||||
*/
|
||||
class DDC1476EntityWithDefaultFieldType
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column()
|
||||
* @GeneratedValue("NONE")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/** @column() */
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
||||
{
|
||||
$metadata->mapField(array(
|
||||
'id' => true,
|
||||
'fieldName' => 'id',
|
||||
));
|
||||
$metadata->mapField(array(
|
||||
'fieldName' => 'name',
|
||||
));
|
||||
|
||||
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_NONE);
|
||||
}
|
||||
|
||||
}
|
36
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php
vendored
Normal file
36
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753CustomRepository.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class DDC753CustomRepository extends EntityRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCustomRepository()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
35
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php
vendored
Normal file
35
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753DefaultRepository.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class DDC753DefaultRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDefaultRepository()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php
vendored
Normal file
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
/**
|
||||
* @Entity(repositoryClass = "Doctrine\Tests\Models\DDC753\DDC753CustomRepository")
|
||||
*/
|
||||
class DDC753EntityWithCustomRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $name;
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
/**
|
||||
* @Entity()
|
||||
*/
|
||||
class DDC753EntityWithDefaultCustomRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $name;
|
||||
|
||||
}
|
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php
vendored
Normal file
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
/**
|
||||
* @Entity(repositoryClass = "\stdClass")
|
||||
*/
|
||||
class DDC753EntityWithInvalidRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $name;
|
||||
|
||||
}
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC753;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class DDC753InvalidRepository
|
||||
{
|
||||
|
||||
}
|
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php
vendored
Normal file
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC869;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC869ChequePayment extends DDC869Payment
|
||||
{
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $serialNumber;
|
||||
|
||||
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
||||
{
|
||||
$metadata->mapField(array(
|
||||
'fieldName' => 'serialNumber',
|
||||
'type' => 'string',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php
vendored
Normal file
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC869;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class DDC869CreditCardPayment extends DDC869Payment
|
||||
{
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $creditCardNumber;
|
||||
|
||||
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
||||
{
|
||||
$metadata->mapField(array(
|
||||
'fieldName' => 'creditCardNumber',
|
||||
'type' => 'string',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
57
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php
vendored
Normal file
57
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC869;
|
||||
|
||||
/**
|
||||
* @MappedSuperclass(repositoryClass = "Doctrine\Tests\Models\DDC869\DDC869PaymentRepository")
|
||||
*/
|
||||
class DDC869Payment
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/** @column(type="float") */
|
||||
protected $value;
|
||||
|
||||
|
||||
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
||||
{
|
||||
$metadata->mapField(array(
|
||||
'id' => true,
|
||||
'fieldName' => 'id',
|
||||
'type' => 'integer',
|
||||
'columnName' => 'id',
|
||||
));
|
||||
$metadata->mapField(array(
|
||||
'fieldName' => 'value',
|
||||
'type' => 'float',
|
||||
));
|
||||
$metadata->isMappedSuperclass = true;
|
||||
$metadata->setCustomRepositoryClass("Doctrine\Tests\Models\DDC869\DDC869PaymentRepository");
|
||||
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_AUTO);
|
||||
}
|
||||
|
||||
}
|
37
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php
vendored
Normal file
37
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC869/DDC869PaymentRepository.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC869;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class DDC869PaymentRepository extends EntityRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* Very complex method
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTrue()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
64
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php
vendored
Normal file
64
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DirectoryTree;
|
||||
|
||||
/**
|
||||
* @MappedSuperclass
|
||||
*/
|
||||
abstract class AbstractContentItem
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer") @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="Directory")
|
||||
*/
|
||||
protected $parentDirectory;
|
||||
|
||||
/** @column(type="string") */
|
||||
protected $name;
|
||||
|
||||
public function __construct(Directory $parentDir = null)
|
||||
{
|
||||
$this->parentDirectory = $parentDir;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parentDirectory;
|
||||
}
|
||||
}
|
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php
vendored
Normal file
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DirectoryTree;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class Directory extends AbstractContentItem
|
||||
{
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
}
|
46
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/File.php
vendored
Normal file
46
vendor/doctrine/orm/tests/Doctrine/Tests/Models/DirectoryTree/File.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Doctrine\Tests\Models\DirectoryTree;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="`file`")
|
||||
*/
|
||||
class File extends AbstractContentItem
|
||||
{
|
||||
/** @Column(type="string") */
|
||||
protected $extension = "html";
|
||||
|
||||
public function __construct(Directory $parent = null)
|
||||
{
|
||||
parent::__construct($parent);
|
||||
}
|
||||
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
public function setExtension($ext)
|
||||
{
|
||||
$this->extension = $ext;
|
||||
}
|
||||
}
|
91
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
vendored
Normal file
91
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ECommerceCart
|
||||
* Represents a typical cart of a shopping application.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_carts")
|
||||
*/
|
||||
class ECommerceCart
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(length=50, nullable=true)
|
||||
*/
|
||||
private $payment;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="ECommerceCustomer", inversedBy="cart")
|
||||
* @JoinColumn(name="customer_id", referencedColumnName="id")
|
||||
*/
|
||||
private $customer;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="ECommerceProduct", cascade={"persist"})
|
||||
* @JoinTable(name="ecommerce_carts_products",
|
||||
joinColumns={@JoinColumn(name="cart_id", referencedColumnName="id")},
|
||||
inverseJoinColumns={@JoinColumn(name="product_id", referencedColumnName="id")})
|
||||
*/
|
||||
private $products;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->products = new ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPayment() {
|
||||
return $this->payment;
|
||||
}
|
||||
|
||||
public function setPayment($payment) {
|
||||
$this->payment = $payment;
|
||||
}
|
||||
|
||||
public function setCustomer(ECommerceCustomer $customer) {
|
||||
if ($this->customer !== $customer) {
|
||||
$this->customer = $customer;
|
||||
$customer->setCart($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeCustomer() {
|
||||
if ($this->customer !== null) {
|
||||
$customer = $this->customer;
|
||||
$this->customer = null;
|
||||
$customer->removeCart();
|
||||
}
|
||||
}
|
||||
|
||||
public function getCustomer() {
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function addProduct(ECommerceProduct $product) {
|
||||
$this->products[] = $product;
|
||||
}
|
||||
|
||||
public function removeProduct(ECommerceProduct $product) {
|
||||
return $this->products->removeElement($product);
|
||||
}
|
||||
}
|
126
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php
vendored
Normal file
126
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ECommerceCategory
|
||||
* Represents a tag applied on particular products.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_categories")
|
||||
*/
|
||||
class ECommerceCategory
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string", length=50)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="ECommerceProduct", mappedBy="categories")
|
||||
*/
|
||||
private $products;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="ECommerceCategory", mappedBy="parent", cascade={"persist"})
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="ECommerceCategory", inversedBy="children")
|
||||
* @JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->products = new ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function addProduct(ECommerceProduct $product)
|
||||
{
|
||||
if (!$this->products->contains($product)) {
|
||||
$this->products[] = $product;
|
||||
$product->addCategory($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeProduct(ECommerceProduct $product)
|
||||
{
|
||||
$removed = $this->products->removeElement($product);
|
||||
if ($removed) {
|
||||
$product->removeCategory($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
private function setParent(ECommerceCategory $parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function addChild(ECommerceCategory $child)
|
||||
{
|
||||
$this->children[] = $child;
|
||||
$child->setParent($this);
|
||||
}
|
||||
|
||||
/** does not set the owning side. */
|
||||
public function brokenAddChild(ECommerceCategory $child)
|
||||
{
|
||||
$this->children[] = $child;
|
||||
}
|
||||
|
||||
|
||||
public function removeChild(ECommerceCategory $child)
|
||||
{
|
||||
$removed = $this->children->removeElement($child);
|
||||
if ($removed) {
|
||||
$child->removeParent();
|
||||
}
|
||||
}
|
||||
|
||||
private function removeParent()
|
||||
{
|
||||
$this->parent = null;
|
||||
}
|
||||
}
|
94
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php
vendored
Normal file
94
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
/**
|
||||
* ECommerceCustomer
|
||||
* Represents a registered user of a shopping application.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_customers")
|
||||
*/
|
||||
class ECommerceCustomer
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string", length=50)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="ECommerceCart", mappedBy="customer", cascade={"persist"})
|
||||
*/
|
||||
private $cart;
|
||||
|
||||
/**
|
||||
* Example of a one-one self referential association. A mentor can follow
|
||||
* only one customer at the time, while a customer can choose only one
|
||||
* mentor. Not properly appropriate but it works.
|
||||
*
|
||||
* @OneToOne(targetEntity="ECommerceCustomer", cascade={"persist"}, fetch="EAGER")
|
||||
* @JoinColumn(name="mentor_id", referencedColumnName="id")
|
||||
*/
|
||||
private $mentor;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function setCart(ECommerceCart $cart)
|
||||
{
|
||||
if ($this->cart !== $cart) {
|
||||
$this->cart = $cart;
|
||||
$cart->setCustomer($this);
|
||||
}
|
||||
}
|
||||
|
||||
/* Does not properly maintain the bidirectional association! */
|
||||
public function brokenSetCart(ECommerceCart $cart) {
|
||||
$this->cart = $cart;
|
||||
}
|
||||
|
||||
public function getCart() {
|
||||
return $this->cart;
|
||||
}
|
||||
|
||||
public function removeCart()
|
||||
{
|
||||
if ($this->cart !== null) {
|
||||
$cart = $this->cart;
|
||||
$this->cart = null;
|
||||
$cart->removeCustomer();
|
||||
}
|
||||
}
|
||||
|
||||
public function setMentor(ECommerceCustomer $mentor)
|
||||
{
|
||||
$this->mentor = $mentor;
|
||||
}
|
||||
|
||||
public function removeMentor()
|
||||
{
|
||||
$this->mentor = null;
|
||||
}
|
||||
|
||||
public function getMentor()
|
||||
{
|
||||
return $this->mentor;
|
||||
}
|
||||
}
|
59
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php
vendored
Normal file
59
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
/**
|
||||
* Describes a product feature.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_features")
|
||||
*/
|
||||
class ECommerceFeature
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(length=50)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="ECommerceProduct", inversedBy="features")
|
||||
* @JoinColumn(name="product_id", referencedColumnName="id")
|
||||
*/
|
||||
private $product;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function setProduct(ECommerceProduct $product) {
|
||||
$this->product = $product;
|
||||
}
|
||||
|
||||
public function removeProduct() {
|
||||
if ($this->product !== null) {
|
||||
$product = $this->product;
|
||||
$this->product = null;
|
||||
$product->removeFeature($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getProduct() {
|
||||
return $this->product;
|
||||
}
|
||||
}
|
178
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
vendored
Normal file
178
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ECommerceProduct
|
||||
* Represents a type of product of a shopping application.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_products",indexes={@Index(name="name_idx", columns={"name"})})
|
||||
*/
|
||||
class ECommerceProduct
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="ECommerceShipping", cascade={"persist"})
|
||||
* @JoinColumn(name="shipping_id", referencedColumnName="id")
|
||||
*/
|
||||
private $shipping;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="ECommerceFeature", mappedBy="product", cascade={"persist"})
|
||||
*/
|
||||
private $features;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="ECommerceCategory", cascade={"persist"}, inversedBy="products")
|
||||
* @JoinTable(name="ecommerce_products_categories",
|
||||
* joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="category_id", referencedColumnName="id")})
|
||||
*/
|
||||
private $categories;
|
||||
|
||||
/**
|
||||
* This relation is saved with two records in the association table for
|
||||
* simplicity.
|
||||
* @ManyToMany(targetEntity="ECommerceProduct", cascade={"persist"})
|
||||
* @JoinTable(name="ecommerce_products_related",
|
||||
* joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="related_id", referencedColumnName="id")})
|
||||
*/
|
||||
private $related;
|
||||
|
||||
public $isCloned = false;
|
||||
public $wakeUp = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->features = new ArrayCollection;
|
||||
$this->categories = new ArrayCollection;
|
||||
$this->related = new ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getShipping()
|
||||
{
|
||||
return $this->shipping;
|
||||
}
|
||||
|
||||
public function setShipping(ECommerceShipping $shipping)
|
||||
{
|
||||
$this->shipping = $shipping;
|
||||
}
|
||||
|
||||
public function removeShipping()
|
||||
{
|
||||
$this->shipping = null;
|
||||
}
|
||||
|
||||
public function getFeatures()
|
||||
{
|
||||
return $this->features;
|
||||
}
|
||||
|
||||
public function addFeature(ECommerceFeature $feature)
|
||||
{
|
||||
$this->features[] = $feature;
|
||||
$feature->setProduct($this);
|
||||
}
|
||||
|
||||
/** does not set the owning side */
|
||||
public function brokenAddFeature(ECommerceFeature $feature)
|
||||
{
|
||||
$this->features[] = $feature;
|
||||
}
|
||||
|
||||
public function removeFeature(ECommerceFeature $feature)
|
||||
{
|
||||
$removed = $this->features->removeElement($feature);
|
||||
if ($removed) {
|
||||
$feature->removeProduct();
|
||||
}
|
||||
return $removed;
|
||||
}
|
||||
|
||||
public function addCategory(ECommerceCategory $category)
|
||||
{
|
||||
if (!$this->categories->contains($category)) {
|
||||
$this->categories[] = $category;
|
||||
$category->addProduct($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeCategory(ECommerceCategory $category)
|
||||
{
|
||||
$removed = $this->categories->removeElement($category);
|
||||
if ($removed) {
|
||||
$category->removeProduct($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCategories()
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
public function getRelated()
|
||||
{
|
||||
return $this->related;
|
||||
}
|
||||
|
||||
public function addRelated(ECommerceProduct $related)
|
||||
{
|
||||
if (!$this->related->contains($related)) {
|
||||
$this->related[] = $related;
|
||||
$related->addRelated($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeRelated(ECommerceProduct $related)
|
||||
{
|
||||
$removed = $this->related->removeElement($related);
|
||||
if ($removed) {
|
||||
$related->removeRelated($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->isCloned = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing docblock contents here
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
$this->wakeUp = true;
|
||||
}
|
||||
}
|
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php
vendored
Normal file
40
vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\ECommerce;
|
||||
|
||||
/**
|
||||
* ECommerceShipping
|
||||
* Represents a shipping method.
|
||||
*
|
||||
* @author Giorgio Sironi
|
||||
* @Entity
|
||||
* @Table(name="ecommerce_shippings")
|
||||
*/
|
||||
class ECommerceShipping
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
private $days;
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDays()
|
||||
{
|
||||
return $this->days;
|
||||
}
|
||||
|
||||
public function setDays($days)
|
||||
{
|
||||
$this->days = $days;
|
||||
}
|
||||
}
|
14
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php
vendored
Normal file
14
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class ForumAdministrator extends ForumUser
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer", name="access_level")
|
||||
*/
|
||||
public $accessLevel;
|
||||
}
|
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php
vendored
Normal file
17
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="forum_avatars")
|
||||
*/
|
||||
class ForumAvatar
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
}
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumBoard.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumBoard.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* Represents a board in a forum.
|
||||
*
|
||||
* @author robo
|
||||
* @Entity
|
||||
* @Table(name="forum_boards")
|
||||
*/
|
||||
class ForumBoard
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $position;
|
||||
/**
|
||||
* @ManyToOne(targetEntity="ForumCategory", inversedBy="boards")
|
||||
* @JoinColumn(name="category_id", referencedColumnName="id")
|
||||
*/
|
||||
public $category;
|
||||
}
|
32
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumCategory.php
vendored
Normal file
32
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumCategory.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="forum_categories")
|
||||
*/
|
||||
class ForumCategory
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id
|
||||
*/
|
||||
private $id;
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $position;
|
||||
/**
|
||||
* @Column(type="string", length=255)
|
||||
*/
|
||||
public $name;
|
||||
/**
|
||||
* @OneToMany(targetEntity="ForumBoard", mappedBy="category")
|
||||
*/
|
||||
public $boards;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
}
|
26
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumEntry.php
vendored
Normal file
26
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumEntry.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="forum_entries")
|
||||
*/
|
||||
class ForumEntry
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=50)
|
||||
*/
|
||||
public $topic;
|
||||
|
||||
public function &getTopicByReference() {
|
||||
return $this->topic;
|
||||
}
|
||||
}
|
||||
|
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumUser.php
vendored
Normal file
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Forum/ForumUser.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Forum;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="forum_users")
|
||||
*/
|
||||
class ForumUser
|
||||
{
|
||||
/**
|
||||
* @Column(type="integer")
|
||||
* @Id @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="string", length=50)
|
||||
*/
|
||||
public $username;
|
||||
/**
|
||||
* @OneToOne(targetEntity="ForumAvatar", cascade={"persist"})
|
||||
* @JoinColumn(name="avatar_id", referencedColumnName="id")
|
||||
*/
|
||||
public $avatar;
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getAvatar() {
|
||||
return $this->avatar;
|
||||
}
|
||||
|
||||
public function setAvatar(ForumAvatar $avatar) {
|
||||
$this->avatar = $avatar;
|
||||
}
|
||||
}
|
20
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/BooleanModel.php
vendored
Normal file
20
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/BooleanModel.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Generic;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="boolean_model")
|
||||
*/
|
||||
class BooleanModel
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(type="boolean")
|
||||
*/
|
||||
public $booleanField;
|
||||
}
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Generic;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="date_time_model")
|
||||
*/
|
||||
class DateTimeModel
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(name="col_datetime", type="datetime", nullable=true)
|
||||
*/
|
||||
public $datetime;
|
||||
/**
|
||||
* @Column(name="col_date", type="date", nullable=true)
|
||||
*/
|
||||
public $date;
|
||||
/**
|
||||
* @Column(name="col_time", type="time", nullable=true)
|
||||
*/
|
||||
public $time;
|
||||
}
|
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/DecimalModel.php
vendored
Normal file
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/DecimalModel.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Generic;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="decimal_model")
|
||||
*/
|
||||
class DecimalModel
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(name="`decimal`", type="decimal", scale=2, precision=5)
|
||||
*/
|
||||
public $decimal;
|
||||
|
||||
/**
|
||||
* @Column(name="`high_scale`", type="decimal", scale=4, precision=14)
|
||||
*/
|
||||
public $highScale;
|
||||
}
|
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/SerializationModel.php
vendored
Normal file
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Generic/SerializationModel.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Generic;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="serialize_model")
|
||||
*/
|
||||
class SerializationModel
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @Column(name="the_array", type="array", nullable=true)
|
||||
*/
|
||||
public $array;
|
||||
|
||||
/**
|
||||
* @Column(name="the_obj", type="object", nullable=true)
|
||||
*/
|
||||
public $object;
|
||||
}
|
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php
vendored
Normal file
68
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @entity
|
||||
* @table(name="articles")
|
||||
*/
|
||||
class DoctrineGlobal_Article
|
||||
{
|
||||
/**
|
||||
* @id
|
||||
* @column(type="int")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
*/
|
||||
protected $headline;
|
||||
|
||||
/**
|
||||
* @column(type="text")
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="DoctrineGlobal_User")
|
||||
* @JoinTable(name="author_articles",
|
||||
* joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="author_id", referencedColumnName="id", unique=true)}
|
||||
* )
|
||||
*/
|
||||
protected $author;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="\DoctrineGlobal_User")
|
||||
* @JoinTable(name="editor_articles",
|
||||
* joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="editor_id", referencedColumnName="id", unique=true)}
|
||||
* )
|
||||
*/
|
||||
protected $editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="users")
|
||||
*/
|
||||
class DoctrineGlobal_User
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @column(type="string", length=64)
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @column(type="string", length=128)
|
||||
* @var string
|
||||
*/
|
||||
private $email;
|
||||
}
|
33
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php
vendored
Normal file
33
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Legacy;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="legacy_articles")
|
||||
*/
|
||||
class LegacyArticle
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(name="iArticleId", type="integer")
|
||||
* @GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
public $_id;
|
||||
/**
|
||||
* @Column(name="sTopic", type="string", length=255)
|
||||
*/
|
||||
public $_topic;
|
||||
/**
|
||||
* @Column(name="sText", type="text")
|
||||
*/
|
||||
public $_text;
|
||||
/**
|
||||
* @ManyToOne(targetEntity="LegacyUser", inversedBy="_articles")
|
||||
* @JoinColumn(name="iUserId", referencedColumnName="iUserId")
|
||||
*/
|
||||
public $_user;
|
||||
public function setAuthor(LegacyUser $author) {
|
||||
$this->_user = $author;
|
||||
}
|
||||
}
|
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php
vendored
Normal file
41
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Legacy;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="legacy_cars")
|
||||
*/
|
||||
class LegacyCar
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
* @Column(name="iCarId", type="integer", nullable=false)
|
||||
*/
|
||||
public $_id;
|
||||
/**
|
||||
* @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars")
|
||||
*/
|
||||
public $_users;
|
||||
|
||||
/**
|
||||
* @Column(name="sDescription", type="string", length=255, unique=true)
|
||||
*/
|
||||
public $_description;
|
||||
|
||||
function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
public function addUser(LegacyUser $user) {
|
||||
$this->_users[] = $user;
|
||||
}
|
||||
|
||||
public function getUsers() {
|
||||
return $this->_users;
|
||||
}
|
||||
}
|
80
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php
vendored
Normal file
80
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Legacy;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="legacy_users")
|
||||
*/
|
||||
class LegacyUser
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
* @Column(name="iUserId", type="integer", nullable=false)
|
||||
*/
|
||||
public $_id;
|
||||
/**
|
||||
* @Column(name="sUsername", type="string", length=255, unique=true)
|
||||
*/
|
||||
public $_username;
|
||||
/**
|
||||
* @Column(type="string", length=255, name="name")
|
||||
*/
|
||||
public $_name;
|
||||
/**
|
||||
* @OneToMany(targetEntity="LegacyArticle", mappedBy="_user")
|
||||
*/
|
||||
public $_articles;
|
||||
/**
|
||||
* @OneToMany(targetEntity="LegacyUserReference", mappedBy="_source", cascade={"remove"})
|
||||
*/
|
||||
public $_references;
|
||||
/**
|
||||
* @ManyToMany(targetEntity="LegacyCar", inversedBy="_users", cascade={"persist", "merge"})
|
||||
* @JoinTable(name="legacy_users_cars",
|
||||
* joinColumns={@JoinColumn(name="iUserId", referencedColumnName="iUserId")},
|
||||
* inverseJoinColumns={@JoinColumn(name="iCarId", referencedColumnName="iCarId")}
|
||||
* )
|
||||
*/
|
||||
public $_cars;
|
||||
public function __construct() {
|
||||
$this->_articles = new ArrayCollection;
|
||||
$this->_references = new ArrayCollection;
|
||||
$this->_cars = new ArrayCollection;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->_username;
|
||||
}
|
||||
|
||||
public function addArticle(LegacyArticle $article) {
|
||||
$this->_articles[] = $article;
|
||||
$article->setAuthor($this);
|
||||
}
|
||||
|
||||
public function addReference($reference)
|
||||
{
|
||||
$this->_references[] = $reference;
|
||||
}
|
||||
|
||||
public function references()
|
||||
{
|
||||
return $this->_references;
|
||||
}
|
||||
|
||||
public function addCar(LegacyCar $car) {
|
||||
$this->_cars[] = $car;
|
||||
$car->addUser($this);
|
||||
}
|
||||
|
||||
public function getCars() {
|
||||
return $this->_cars;
|
||||
}
|
||||
}
|
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php
vendored
Normal file
65
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Legacy/LegacyUserReference.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Legacy;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="legacy_users_reference")
|
||||
*/
|
||||
class LegacyUserReference
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="LegacyUser", inversedBy="_references")
|
||||
* @JoinColumn(name="iUserIdSource", referencedColumnName="iUserId")
|
||||
*/
|
||||
private $_source;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="LegacyUser")
|
||||
* @JoinColumn(name="iUserIdTarget", referencedColumnName="iUserId")
|
||||
*/
|
||||
private $_target;
|
||||
|
||||
/**
|
||||
* @column(type="string", name="description")
|
||||
*/
|
||||
private $_description;
|
||||
|
||||
/**
|
||||
* @column(type="datetime", name="created")
|
||||
*/
|
||||
private $_created;
|
||||
|
||||
public function __construct($source, $target, $description)
|
||||
{
|
||||
$source->addReference($this);
|
||||
$target->addReference($this);
|
||||
|
||||
$this->_source = $source;
|
||||
$this->_target = $target;
|
||||
$this->_description = $description;
|
||||
$this->_created = new \DateTime("now");
|
||||
}
|
||||
|
||||
public function source()
|
||||
{
|
||||
return $this->_source;
|
||||
}
|
||||
|
||||
public function target()
|
||||
{
|
||||
return $this->_target;
|
||||
}
|
||||
|
||||
public function setDescription($desc)
|
||||
{
|
||||
$this->_description = $desc;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
}
|
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavCountry.php
vendored
Normal file
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavCountry.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Navigation;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="navigation_countries")
|
||||
*/
|
||||
class NavCountry
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @generatedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="NavPointOfInterest", mappedBy="country")
|
||||
*/
|
||||
private $pois;
|
||||
|
||||
function __construct($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
}
|
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPhotos.php
vendored
Normal file
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPhotos.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Navigation;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="navigation_photos")
|
||||
*/
|
||||
class NavPhotos
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @column(type="integer")
|
||||
* @generatedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="NavPointOfInterest")
|
||||
* @JoinColumns({
|
||||
* @JoinColumn(name="poi_long", referencedColumnName="nav_long"),
|
||||
* @JoinColumn(name="poi_lat", referencedColumnName="nav_lat")
|
||||
* })
|
||||
*/
|
||||
private $poi;
|
||||
|
||||
/**
|
||||
* @column(type="string", name="file_name")
|
||||
*/
|
||||
private $file;
|
||||
|
||||
function __construct($poi, $file) {
|
||||
$this->poi = $poi;
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPointOfInterest() {
|
||||
return $this->poi;
|
||||
}
|
||||
|
||||
public function getFile() {
|
||||
return $this->file;
|
||||
}
|
||||
}
|
56
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php
vendored
Normal file
56
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Navigation;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="navigation_pois")
|
||||
*/
|
||||
class NavPointOfInterest
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer", name="nav_long")
|
||||
*/
|
||||
private $long;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer", name="nav_lat")
|
||||
*/
|
||||
private $lat;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="NavCountry", inversedBy="pois")
|
||||
*/
|
||||
private $country;
|
||||
|
||||
public function __construct($lat, $long, $name, $country)
|
||||
{
|
||||
$this->lat = $lat;
|
||||
$this->long = $long;
|
||||
$this->name = $name;
|
||||
$this->country = $country;
|
||||
}
|
||||
|
||||
public function getLong() {
|
||||
return $this->long;
|
||||
}
|
||||
|
||||
public function getLat() {
|
||||
return $this->lat;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getCountry() {
|
||||
return $this->country;
|
||||
}
|
||||
}
|
61
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavTour.php
vendored
Normal file
61
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavTour.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Navigation;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="navigation_tours")
|
||||
*/
|
||||
class NavTour
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @generatedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="NavPointOfInterest")
|
||||
* @JoinTable(name="navigation_tour_pois",
|
||||
* joinColumns={@JoinColumn(name="tour_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={
|
||||
* @JoinColumn(name="poi_long", referencedColumnName="nav_long"),
|
||||
* @JoinColumn(name="poi_lat", referencedColumnName="nav_lat")
|
||||
* }
|
||||
* )
|
||||
*
|
||||
*/
|
||||
private $pois;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->pois = new \Doctrine\Common\Collections\ArrayCollection;
|
||||
}
|
||||
|
||||
public function addPointOfInterest(NavPointOfInterest $poi)
|
||||
{
|
||||
$this->pois[] = $poi;
|
||||
}
|
||||
|
||||
public function getPointOfInterests()
|
||||
{
|
||||
return $this->pois;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
37
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php
vendored
Normal file
37
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Routing;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class RoutingLeg
|
||||
{
|
||||
/**
|
||||
* @Id @generatedValue
|
||||
* @column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="RoutingLocation")
|
||||
* @JoinColumn(name="from_id", referencedColumnName="id")
|
||||
*/
|
||||
public $fromLocation;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="RoutingLocation")
|
||||
* @JoinColumn(name="to_id", referencedColumnName="id")
|
||||
*/
|
||||
public $toLocation;
|
||||
|
||||
/**
|
||||
* @Column(type="datetime")
|
||||
*/
|
||||
public $departureDate;
|
||||
|
||||
/**
|
||||
* @Column(type="datetime")
|
||||
*/
|
||||
public $arrivalDate;
|
||||
}
|
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php
vendored
Normal file
25
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Routing;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class RoutingLocation
|
||||
{
|
||||
/**
|
||||
* @Id @GeneratedValue
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
public $name;
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingRoute.php
vendored
Normal file
39
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingRoute.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Routing;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class RoutingRoute
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
* @column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="RoutingLeg", cascade={"all"})
|
||||
* @JoinTable(name="RoutingRouteLegs",
|
||||
* joinColumns={@JoinColumn(name="route_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@JoinColumn(name="leg_id", referencedColumnName="id", unique=true)}
|
||||
* )
|
||||
* @OrderBy({"departureDate" = "ASC"})
|
||||
*/
|
||||
public $legs;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="RoutingRouteBooking", mappedBy="route")
|
||||
* @OrderBy({"passengerName" = "ASC"})
|
||||
*/
|
||||
public $bookings = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->legs = new ArrayCollection();
|
||||
}
|
||||
}
|
32
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php
vendored
Normal file
32
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Routing;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
*/
|
||||
class RoutingRouteBooking
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @GeneratedValue
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="RoutingRoute", inversedBy="bookings")
|
||||
* @JoinColumn(name="route_id", referencedColumnName="id")
|
||||
*/
|
||||
public $route;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
public $passengerName = null;
|
||||
|
||||
public function getPassengerName()
|
||||
{
|
||||
return $this->passengerName;
|
||||
}
|
||||
}
|
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Bond.php
vendored
Normal file
48
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Bond.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace Doctrine\Tests\Models\StockExchange;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* Bonds have many stocks. This uses a many to many assocation and fails to model how many of a
|
||||
* particular stock a bond has. But i Need a many-to-many assocation, so please bear with my modelling skills ;)
|
||||
*
|
||||
* @Entity
|
||||
* @Table(name="exchange_bonds")
|
||||
*/
|
||||
class Bond
|
||||
{
|
||||
/**
|
||||
* @Id @GeneratedValue @column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="Stock", indexBy="symbol")
|
||||
* @JoinTable(name="exchange_bonds_stocks")
|
||||
* @var Stock[]
|
||||
*/
|
||||
public $stocks;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function addStock(Stock $stock)
|
||||
{
|
||||
$this->stocks[$stock->getSymbol()] = $stock;
|
||||
}
|
||||
}
|
56
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Market.php
vendored
Normal file
56
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Market.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\StockExchange;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="exchange_markets")
|
||||
*/
|
||||
class Market
|
||||
{
|
||||
/**
|
||||
* @Id @Column(type="integer") @GeneratedValue
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="Stock", mappedBy="market", indexBy="symbol")
|
||||
* @var Stock[]
|
||||
*/
|
||||
public $stocks;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->stocks = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function addStock(Stock $stock)
|
||||
{
|
||||
$this->stocks[$stock->getSymbol()] = $stock;
|
||||
}
|
||||
|
||||
public function getStock($symbol)
|
||||
{
|
||||
return $this->stocks[$symbol];
|
||||
}
|
||||
}
|
49
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Stock.php
vendored
Normal file
49
vendor/doctrine/orm/tests/Doctrine/Tests/Models/StockExchange/Stock.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\StockExchange;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="exchange_stocks")
|
||||
*/
|
||||
class Stock
|
||||
{
|
||||
/**
|
||||
* @Id @GeneratedValue @Column(type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* For real this column would have to be unique=true. But I want to test behavior of non-unique overrides.
|
||||
*
|
||||
* @Column(type="string")
|
||||
*/
|
||||
private $symbol;
|
||||
|
||||
/**
|
||||
* @Column(type="decimal")
|
||||
*/
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="Market", inversedBy="stocks")
|
||||
* @var Market
|
||||
*/
|
||||
private $market;
|
||||
|
||||
public function __construct($symbol, $initialOfferingPrice, Market $market)
|
||||
{
|
||||
$this->symbol = $symbol;
|
||||
$this->price = $initialOfferingPrice;
|
||||
$this->market = $market;
|
||||
$market->addStock($this);
|
||||
}
|
||||
|
||||
public function getSymbol()
|
||||
{
|
||||
return $this->symbol;
|
||||
}
|
||||
}
|
56
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php
vendored
Normal file
56
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
|
||||
require_once __DIR__ . '/../TestInit.php';
|
||||
|
||||
/**
|
||||
* Tests of the commit order calculation.
|
||||
*
|
||||
* IMPORTANT: When writing tests here consider that a lot of graph constellations
|
||||
* can have many valid orderings, so you may want to build a graph that has only
|
||||
* 1 valid order to simplify your tests.
|
||||
*/
|
||||
class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
private $_calc;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_calc = new \Doctrine\ORM\Internal\CommitOrderCalculator();
|
||||
}
|
||||
|
||||
public function testCommitOrdering1()
|
||||
{
|
||||
$class1 = new ClassMetadata(__NAMESPACE__ . '\NodeClass1');
|
||||
$class2 = new ClassMetadata(__NAMESPACE__ . '\NodeClass2');
|
||||
$class3 = new ClassMetadata(__NAMESPACE__ . '\NodeClass3');
|
||||
$class4 = new ClassMetadata(__NAMESPACE__ . '\NodeClass4');
|
||||
$class5 = new ClassMetadata(__NAMESPACE__ . '\NodeClass5');
|
||||
|
||||
$this->_calc->addClass($class1);
|
||||
$this->_calc->addClass($class2);
|
||||
$this->_calc->addClass($class3);
|
||||
$this->_calc->addClass($class4);
|
||||
$this->_calc->addClass($class5);
|
||||
|
||||
$this->_calc->addDependency($class1, $class2);
|
||||
$this->_calc->addDependency($class2, $class3);
|
||||
$this->_calc->addDependency($class3, $class4);
|
||||
$this->_calc->addDependency($class5, $class1);
|
||||
|
||||
$sorted = $this->_calc->getCommitOrder();
|
||||
|
||||
// There is only 1 valid ordering for this constellation
|
||||
$correctOrder = array($class5, $class1, $class2, $class3, $class4);
|
||||
$this->assertSame($correctOrder, $sorted);
|
||||
}
|
||||
}
|
||||
|
||||
class NodeClass1 {}
|
||||
class NodeClass2 {}
|
||||
class NodeClass3 {}
|
||||
class NodeClass4 {}
|
||||
class NodeClass5 {}
|
252
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php
vendored
Normal file
252
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Criteria/DqlGenerationTest.php
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\ORM\Query;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
||||
/**
|
||||
* Test case for testing the saving and referencing of query identifiers.
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
|
||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link http://www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @version $Revision$
|
||||
*/
|
||||
class DqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
protected function setUp() {
|
||||
$this->markTestSkipped('Not yet implemented.');
|
||||
}
|
||||
|
||||
protected function createQuery()
|
||||
{
|
||||
return $this->_em->createQuery();
|
||||
}
|
||||
|
||||
public function testSelect()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
// select and from
|
||||
$query->setDql('FROM User u');
|
||||
$this->assertEquals('FROM User u', $query->getDql()); // Internally we use SELECT * FROM User u to process the DQL
|
||||
$query->free();
|
||||
|
||||
$query->select()->from('User u');
|
||||
$this->assertEquals('SELECT * FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.*')->from('User u');
|
||||
$this->assertEquals('SELECT u.* FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.id')->from('User u');
|
||||
$this->assertEquals('SELECT u.id FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.id, u.name')->from('User u');
|
||||
$this->assertEquals('SELECT u.id, u.name FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name AS myCustomName')->from('User u');
|
||||
$this->assertEquals('SELECT u.name AS myCustomName FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.id')->select('u.name')->from('User u');
|
||||
$this->assertEquals('SELECT u.id, u.name FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
|
||||
public function testSelectDistinct()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->select()->distinct()->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT * FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->distinct(false)->from('User u');
|
||||
$this->assertEquals('SELECT u.name FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select()->distinct(false)->from('User u');
|
||||
$this->assertEquals('SELECT * FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->distinct()->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name, u.email')->distinct()->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name, u.email FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->select('u.email')->distinct()->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name, u.email FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('DISTINCT u.name')->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('DISTINCT u.name, u.email')->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name, u.email FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('DISTINCT u.name')->select('u.email')->from('User u');
|
||||
$this->assertEquals('SELECT DISTINCT u.name, u.email FROM User u', $query->getDql());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
|
||||
public function testSelectJoin()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->select('u.*')->from('User u')->join('u.Group g')->where('g.id = ?', 1);
|
||||
$this->assertEquals('SELECT u.* FROM User u INNER JOIN u.Group g WHERE g.id = ?', $query->getDql());
|
||||
$this->assertEquals(array(1), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.*')->from('User u')->innerJoin('u.Group g')->where('g.id = ?', 1);
|
||||
$this->assertEquals('SELECT u.* FROM User u INNER JOIN u.Group g WHERE g.id = ?', $query->getDql());
|
||||
$this->assertEquals(array(1), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.*')->from('User u')->leftJoin('u.Group g')->where('g.id IS NULL');
|
||||
$this->assertEquals('SELECT u.* FROM User u LEFT JOIN u.Group g WHERE g.id IS NULL', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.*')->from('User u')->leftJoin('u.UserGroup ug')->leftJoin('ug.Group g')->where('g.name = ?', 'admin');
|
||||
$this->assertEquals('SELECT u.* FROM User u LEFT JOIN u.UserGroup ug LEFT JOIN ug.Group g WHERE g.name = ?', $query->getDql());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
|
||||
public function testSelectWhere()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.id = ?', 1);
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ?', $query->getDql());
|
||||
$this->assertEquals(array(1), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.id = ? AND u.type != ?', array(1, 'admin'));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ? AND u.type != ?', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin'), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.id = ?', 1)->andWhere('u.type != ?', 'admin');
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ? AND u.type != ?', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin'), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('( u.id = ?', 1)->andWhere('u.type != ? )', 'admin');
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE ( u.id = ? AND u.type != ? )', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin'), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.id = ? OR u.type != ?', array(1, 'admin'));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ? OR u.type != ?', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin'), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.id = ?', 1)->orWhere('u.type != ?', 'admin');
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ? OR u.type != ?', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin'), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->andwhere('u.id = ?', 1)->andWhere('u.type != ?', 'admin')->orWhere('u.email = ?', 'admin@localhost');
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id = ? AND u.type != ? OR u.email = ?', $query->getDql());
|
||||
$this->assertEquals(array(1, 'admin', 'admin@localhost'), $query->getParams());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
|
||||
public function testSelectWhereIn()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->select('u.name')->from('User u')->whereIn('u.id', array(1, 2, 3, 4, 5));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id IN (?, ?, ?, ?, ?)', $query->getDql());
|
||||
$this->assertEquals(array(1, 2, 3, 4, 5), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->whereNotIn('u.id', array(1, 2, 3));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.id NOT IN (?, ?, ?)', $query->getDql());
|
||||
$this->assertEquals(array(1, 2, 3), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.type = ?', 'admin')->andWhereIn('u.id', array(1, 2));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.type = ? AND u.id IN (?, ?)', $query->getDql());
|
||||
$this->assertEquals(array('admin', 1, 2), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->where('u.type = ?', 'admin')->andWhereNotIn('u.id', array(1, 2));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.type = ? AND u.id NOT IN (?, ?)', $query->getDql());
|
||||
$this->assertEquals(array('admin', 1, 2), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->whereIn('u.type', array('admin', 'moderator'))->andWhereNotIn('u.id', array(1, 2, 3, 4));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.type IN (?, ?) AND u.id NOT IN (?, ?, ?, ?)', $query->getDql());
|
||||
$this->assertEquals(array('admin', 'moderator', 1, 2, 3, 4), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->whereIn('u.type', array('admin', 'moderator'))->orWhereIn('u.id', array(1, 2, 3, 4));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.type IN (?, ?) OR u.id IN (?, ?, ?, ?)', $query->getDql());
|
||||
$this->assertEquals(array('admin', 'moderator', 1, 2, 3, 4), $query->getParams());
|
||||
$query->free();
|
||||
|
||||
$query->select('u.name')->from('User u')->whereIn('u.type', array('admin', 'moderator'))->andWhereNotIn('u.id', array(1, 2))->orWhereNotIn('u.type', array('admin', 'moderator'))->andWhereNotIn('u.email', array('user@localhost', 'guest@localhost'));
|
||||
$this->assertEquals('SELECT u.name FROM User u WHERE u.type IN (?, ?) AND u.id NOT IN (?, ?) OR u.type NOT IN (?, ?) AND u.email NOT IN (?, ?)', $query->getDql());
|
||||
$this->assertEquals(array('admin', 'moderator', 1, 2, 'admin', 'moderator', 'user@localhost', 'guest@localhost'), $query->getParams());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
|
||||
$query->setDql('DELETE CmsUser u');
|
||||
$this->assertEquals('DELETE CmsUser u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->delete()->from('CmsUser u');
|
||||
$this->assertEquals('DELETE FROM CmsUser u', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->delete()->from('CmsUser u')->where('u.id = ?', 1);
|
||||
$this->assertEquals('DELETE FROM CmsUser u WHERE u.id = ?', $query->getDql());
|
||||
$query->free();
|
||||
|
||||
$query->delete()->from('CmsUser u')->where('u.username = ?', 'gblanco')->orWhere('u.name = ?', 'Guilherme');
|
||||
$this->assertEquals('DELETE FROM CmsUser u WHERE u.username = ? OR u.name = ?', $query->getDql());
|
||||
$query->free();
|
||||
}
|
||||
|
||||
}
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Entity;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
||||
class ConstructorTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
public function testFieldInitializationInConstructor()
|
||||
{
|
||||
$entity = new ConstructorTestEntity1("romanb");
|
||||
$this->assertEquals("romanb", $entity->username);
|
||||
}
|
||||
}
|
||||
|
||||
class ConstructorTestEntity1
|
||||
{
|
||||
private $id;
|
||||
public $username;
|
||||
|
||||
public function __construct($username = null)
|
||||
{
|
||||
if ($username !== null) {
|
||||
$this->username = $username;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
158
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/EntityManagerTest.php
vendored
Normal file
158
vendor/doctrine/orm/tests/Doctrine/Tests/ORM/EntityManagerTest.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM;
|
||||
|
||||
require_once __DIR__ . '/../TestInit.php';
|
||||
|
||||
class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
private $_em;
|
||||
|
||||
function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_em = $this->_getTestEntityManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-899
|
||||
*/
|
||||
public function testIsOpen()
|
||||
{
|
||||
$this->assertTrue($this->_em->isOpen());
|
||||
$this->_em->close();
|
||||
$this->assertFalse($this->_em->isOpen());
|
||||
}
|
||||
|
||||
public function testGetConnection()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Connection', $this->_em->getConnection());
|
||||
}
|
||||
|
||||
public function testGetMetadataFactory()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
|
||||
}
|
||||
|
||||
public function testGetConfiguration()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Configuration', $this->_em->getConfiguration());
|
||||
}
|
||||
|
||||
public function testGetUnitOfWork()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
|
||||
}
|
||||
|
||||
public function testGetProxyFactory()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
|
||||
}
|
||||
|
||||
public function testGetEventManager()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\Common\EventManager', $this->_em->getEventManager());
|
||||
}
|
||||
|
||||
public function testCreateNativeQuery()
|
||||
{
|
||||
$rsm = new \Doctrine\ORM\Query\ResultSetMapping();
|
||||
$query = $this->_em->createNativeQuery('SELECT foo', $rsm);
|
||||
|
||||
$this->assertSame('SELECT foo', $query->getSql());
|
||||
}
|
||||
|
||||
public function testCreateQueryBuilder()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
|
||||
}
|
||||
|
||||
public function testCreateQueryBuilderAliasValid()
|
||||
{
|
||||
$q = $this->_em->createQueryBuilder()
|
||||
->select('u')->from('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$q2 = clone $q;
|
||||
|
||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $q->getQuery()->getDql());
|
||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $q2->getQuery()->getDql());
|
||||
|
||||
$q3 = clone $q;
|
||||
|
||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $q3->getQuery()->getDql());
|
||||
}
|
||||
|
||||
public function testCreateQuery_DqlIsOptional()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $this->_em->createQuery());
|
||||
}
|
||||
|
||||
public function testGetPartialReference()
|
||||
{
|
||||
$user = $this->_em->getPartialReference('Doctrine\Tests\Models\CMS\CmsUser', 42);
|
||||
$this->assertTrue($this->_em->contains($user));
|
||||
$this->assertEquals(42, $user->id);
|
||||
$this->assertNull($user->getName());
|
||||
}
|
||||
|
||||
public function testCreateQuery()
|
||||
{
|
||||
$q = $this->_em->createQuery('SELECT 1');
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $q);
|
||||
$this->assertEquals('SELECT 1', $q->getDql());
|
||||
}
|
||||
|
||||
static public function dataMethodsAffectedByNoObjectArguments()
|
||||
{
|
||||
return array(
|
||||
array('persist'),
|
||||
array('remove'),
|
||||
array('merge'),
|
||||
array('refresh'),
|
||||
array('detach')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataMethodsAffectedByNoObjectArguments
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @param string $methodName
|
||||
*/
|
||||
public function testThrowsExceptionOnNonObjectValues($methodName) {
|
||||
$this->_em->$methodName(null);
|
||||
}
|
||||
|
||||
static public function dataAffectedByErrorIfClosedException()
|
||||
{
|
||||
return array(
|
||||
array('flush'),
|
||||
array('persist'),
|
||||
array('remove'),
|
||||
array('merge'),
|
||||
array('refresh'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataAffectedByErrorIfClosedException
|
||||
* @param string $methodName
|
||||
*/
|
||||
public function testAffectedByErrorIfClosedException($methodName)
|
||||
{
|
||||
$this->setExpectedException('Doctrine\ORM\ORMException', 'closed');
|
||||
|
||||
$this->_em->close();
|
||||
$this->_em->$methodName(new \stdClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1125
|
||||
*/
|
||||
public function testTransactionalAcceptsReturn()
|
||||
{
|
||||
$return = $this->_em->transactional(function ($em) {
|
||||
return 'foo';
|
||||
});
|
||||
|
||||
$this->assertEquals('foo', $return);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user