init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
109
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/LazySchemaDiffProvider.php
vendored
Normal file
109
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/LazySchemaDiffProvider.php
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
<?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\DBAL\Migrations\Provider;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use ProxyManager\Configuration;
|
||||
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
|
||||
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
|
||||
use ProxyManager\Proxy\LazyLoadingInterface;
|
||||
|
||||
class LazySchemaDiffProvider implements SchemaDiffProviderInterface
|
||||
{
|
||||
/** @var LazyLoadingValueHolderFactory */
|
||||
private $proxyFactory;
|
||||
|
||||
/** @var SchemaDiffProviderInterface */
|
||||
private $originalSchemaManipulator;
|
||||
|
||||
public function __construct(LazyLoadingValueHolderFactory $proxyFactory, SchemaDiffProviderInterface $originalSchemaManipulator)
|
||||
{
|
||||
$this->proxyFactory = $proxyFactory;
|
||||
$this->originalSchemaManipulator = $originalSchemaManipulator;
|
||||
}
|
||||
|
||||
public static function fromDefaultProxyFacyoryConfiguration(SchemaDiffProviderInterface $originalSchemaManipulator)
|
||||
{
|
||||
$proxyConfig = new Configuration();
|
||||
$proxyConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
|
||||
$proxyFactory = new LazyLoadingValueHolderFactory($proxyConfig);
|
||||
|
||||
return new LazySchemaDiffProvider($proxyFactory, $originalSchemaManipulator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Schema
|
||||
*/
|
||||
public function createFromSchema()
|
||||
{
|
||||
$originalSchemaManipulator = $this->originalSchemaManipulator;
|
||||
|
||||
return $this->proxyFactory->createProxy(
|
||||
Schema::class,
|
||||
function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator) {
|
||||
$initializer = null;
|
||||
$wrappedObject = $originalSchemaManipulator->createFromSchema();
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $fromSchema
|
||||
* @return Schema
|
||||
*/
|
||||
public function createToSchema(Schema $fromSchema)
|
||||
{
|
||||
$originalSchemaManipulator = $this->originalSchemaManipulator;
|
||||
|
||||
if ($fromSchema instanceof LazyLoadingInterface && ! $fromSchema->isProxyInitialized()) {
|
||||
return $this->proxyFactory->createProxy(
|
||||
Schema::class,
|
||||
function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator, $fromSchema) {
|
||||
$initializer = null;
|
||||
$wrappedObject = $originalSchemaManipulator->createToSchema($fromSchema);
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return $this->originalSchemaManipulator->createToSchema($fromSchema);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $fromSchema
|
||||
* @param Schema $toSchema
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema)
|
||||
{
|
||||
if (
|
||||
$toSchema instanceof LazyLoadingInterface
|
||||
&& ! $toSchema->isProxyInitialized()
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->originalSchemaManipulator->getSqlDiffToMigrate($fromSchema, $toSchema);
|
||||
}
|
||||
}
|
||||
82
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/OrmSchemaProvider.php
vendored
Normal file
82
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/OrmSchemaProvider.php
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?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\DBAL\Migrations\Provider;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
|
||||
/**
|
||||
* A schema provider that uses the doctrine ORM to generate schemas.
|
||||
*
|
||||
* @since 1.0.0-alpha3
|
||||
*/
|
||||
final class OrmSchemaProvider implements SchemaProviderInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
public function __construct($em)
|
||||
{
|
||||
if (!$this->isEntityManager($em)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'$em is not a valid Doctrine ORM Entity Manager, got "%s"',
|
||||
is_object($em) ? get_class($em) : gettype($em)
|
||||
));
|
||||
}
|
||||
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createSchema()
|
||||
{
|
||||
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
|
||||
if (empty($metadata)) {
|
||||
throw new \UnexpectedValueException('No mapping information to process');
|
||||
}
|
||||
|
||||
$tool = new SchemaTool($this->entityManager);
|
||||
|
||||
return $tool->getSchemaFromMetadata($metadata);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Doctrine's EntityManagerInterface was introduced in version 2.4, since this
|
||||
* library allows those older version we need to be able to check for those
|
||||
* old ORM versions. Hence the helper method.
|
||||
*
|
||||
* No need to check to see if EntityManagerInterface exists first here, PHP
|
||||
* doesn't care.
|
||||
*
|
||||
* @param mixed $manager Hopefully an entity manager, but it may be anything
|
||||
* @return boolean
|
||||
*/
|
||||
private function isEntityManager($manager)
|
||||
{
|
||||
return $manager instanceof EntityManagerInterface || $manager instanceof EntityManager;
|
||||
}
|
||||
|
||||
}
|
||||
66
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaDiffProvider.php
vendored
Normal file
66
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaDiffProvider.php
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?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\DBAL\Migrations\Provider;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class SchemaDiffProvider implements SchemaDiffProviderInterface
|
||||
{
|
||||
/** @var AbstractPlatform */
|
||||
private $platform;
|
||||
|
||||
/** @var AbstractSchemaManager */
|
||||
private $schemaManager;
|
||||
|
||||
public function __construct(AbstractSchemaManager $schemaManager, AbstractPlatform $platform)
|
||||
{
|
||||
$this->schemaManager = $schemaManager;
|
||||
$this->platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Schema
|
||||
*/
|
||||
public function createFromSchema()
|
||||
{
|
||||
return $this->schemaManager->createSchema();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $fromSchema
|
||||
* @return Schema
|
||||
*/
|
||||
public function createToSchema(Schema $fromSchema)
|
||||
{
|
||||
return clone $fromSchema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $fromSchema
|
||||
* @param Schema $toSchema
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema)
|
||||
{
|
||||
return $fromSchema->getMigrateToSql($toSchema, $this->platform);
|
||||
}
|
||||
}
|
||||
56
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaDiffProviderInterface.php
vendored
Normal file
56
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaDiffProviderInterface.php
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?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\DBAL\Migrations\Provider;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Generates `Schema` objects to be passed to the migrations class.
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
interface SchemaDiffProviderInterface
|
||||
{
|
||||
/**
|
||||
* Create the schema that represent the current state of the database.
|
||||
*
|
||||
* @return Schema
|
||||
*/
|
||||
public function createFromSchema();
|
||||
|
||||
/**
|
||||
* Create the schema that will represent the future state of the database
|
||||
*
|
||||
* @param Schema $fromSchema
|
||||
* @return Schema
|
||||
*/
|
||||
public function createToSchema(Schema $fromSchema);
|
||||
|
||||
/**
|
||||
* Return an array of sql statement that migrate the database state from the
|
||||
* fromSchema to the toSchema.
|
||||
*
|
||||
* @param Schema $fromSchema
|
||||
* @param Schema $toSchema
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema);
|
||||
}
|
||||
36
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaProviderInterface.php
vendored
Normal file
36
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/SchemaProviderInterface.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\DBAL\Migrations\Provider;
|
||||
|
||||
/**
|
||||
* Generates `Schema` objects for the diff command. A schema provider should
|
||||
* return the schema to which the database should be migrated.
|
||||
*
|
||||
* @since 1.0.0-alpha3
|
||||
*/
|
||||
interface SchemaProviderInterface
|
||||
{
|
||||
/**
|
||||
* Create the schema to which the database should be migrated.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Schema\Schema
|
||||
*/
|
||||
public function createSchema();
|
||||
}
|
||||
48
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/StubSchemaProvider.php
vendored
Normal file
48
vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Provider/StubSchemaProvider.php
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?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\DBAL\Migrations\Provider;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* A schemea provider implementation that just returns the schema its given.
|
||||
*
|
||||
* @since 1.0.0-alpha3
|
||||
*/
|
||||
final class StubSchemaProvider implements SchemaProviderInterface
|
||||
{
|
||||
/**
|
||||
* @var Schema
|
||||
*/
|
||||
private $toSchema;
|
||||
|
||||
public function __construct(Schema $schema)
|
||||
{
|
||||
$this->toSchema = $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createSchema()
|
||||
{
|
||||
return $this->toSchema;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue