init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
24
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Annotation.php
vendored
Normal file
24
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Annotation.php
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
interface Annotation
|
||||
{
|
||||
}
|
||||
96
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AnsiQuoteStrategy.php
vendored
Normal file
96
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AnsiQuoteStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* ANSI compliant quote strategy, this strategy does not apply any quote.
|
||||
* To use this strategy all mapped tables and columns should be ANSI compliant.
|
||||
*
|
||||
* @since 2.5
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class AnsiQuoteStrategy implements QuoteStrategy
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $class->fieldMappings[$fieldName]['columnName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $class->table['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $definition['sequenceName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $joinColumn['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $joinColumn['referencedColumnName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $association['joinTable']['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return $class->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
|
||||
{
|
||||
return $platform->getSQLResultCasing($columnName . '_' . $counter);
|
||||
}
|
||||
}
|
||||
53
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AssociationOverride.php
vendored
Normal file
53
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AssociationOverride.php
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* This annotation is used to override association mapping of property for an entity relationship.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class AssociationOverride implements Annotation
|
||||
{
|
||||
/**
|
||||
* The name of the relationship property whose mapping is being overridden.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The join column that is being mapped to the persistent attribute.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
|
||||
*/
|
||||
public $joinColumns;
|
||||
|
||||
/**
|
||||
* The join table that maps the relationship.
|
||||
*
|
||||
* @var \Doctrine\ORM\Mapping\JoinTable
|
||||
*/
|
||||
public $joinTable;
|
||||
}
|
||||
39
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AssociationOverrides.php
vendored
Normal file
39
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AssociationOverrides.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* This annotation is used to override association mappings of relationship properties.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class AssociationOverrides implements Annotation
|
||||
{
|
||||
/**
|
||||
* Mapping overrides of relationship properties.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\AssociationOverride>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
46
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AttributeOverride.php
vendored
Normal file
46
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AttributeOverride.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* This annotation is used to override the mapping of a entity property.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class AttributeOverride implements Annotation
|
||||
{
|
||||
/**
|
||||
* The name of the property whose mapping is being overridden.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The column definition.
|
||||
*
|
||||
* @var \Doctrine\ORM\Mapping\Column
|
||||
*/
|
||||
public $column;
|
||||
}
|
||||
39
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AttributeOverrides.php
vendored
Normal file
39
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/AttributeOverrides.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* This annotation is used to override the mapping of a entity property.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class AttributeOverrides implements Annotation
|
||||
{
|
||||
/**
|
||||
* One or more field or property mapping overrides.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\AttributeOverride>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
231
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php
vendored
Normal file
231
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/AssociationBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
|
||||
class AssociationBuilder
|
||||
{
|
||||
/**
|
||||
* @var ClassMetadataBuilder
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $mapping;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $joinColumns;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* @param ClassMetadataBuilder $builder
|
||||
* @param array $mapping
|
||||
* @param int $type
|
||||
*/
|
||||
public function __construct(ClassMetadataBuilder $builder, array $mapping, $type)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
$this->mapping = $mapping;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function mappedBy($fieldName)
|
||||
{
|
||||
$this->mapping['mappedBy'] = $fieldName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function inversedBy($fieldName)
|
||||
{
|
||||
$this->mapping['inversedBy'] = $fieldName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadeAll()
|
||||
{
|
||||
$this->mapping['cascade'] = array("ALL");
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadePersist()
|
||||
{
|
||||
$this->mapping['cascade'][] = "persist";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadeRemove()
|
||||
{
|
||||
$this->mapping['cascade'][] = "remove";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadeMerge()
|
||||
{
|
||||
$this->mapping['cascade'][] = "merge";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadeDetach()
|
||||
{
|
||||
$this->mapping['cascade'][] = "detach";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function cascadeRefresh()
|
||||
{
|
||||
$this->mapping['cascade'][] = "refresh";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function fetchExtraLazy()
|
||||
{
|
||||
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function fetchEager()
|
||||
{
|
||||
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function fetchLazy()
|
||||
{
|
||||
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Join Columns.
|
||||
*
|
||||
* @param string $columnName
|
||||
* @param string $referencedColumnName
|
||||
* @param bool $nullable
|
||||
* @param bool $unique
|
||||
* @param string|null $onDelete
|
||||
* @param string|null $columnDef
|
||||
*
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
|
||||
{
|
||||
$this->joinColumns[] = array(
|
||||
'name' => $columnName,
|
||||
'referencedColumnName' => $referencedColumnName,
|
||||
'nullable' => $nullable,
|
||||
'unique' => $unique,
|
||||
'onDelete' => $onDelete,
|
||||
'columnDefinition' => $columnDef,
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field as primary key.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function makePrimaryKey()
|
||||
{
|
||||
$this->mapping['id'] = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes orphan entities when detached from their parent.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function orphanRemoval()
|
||||
{
|
||||
$this->mapping['orphanRemoval'] = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClassMetadataBuilder
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$mapping = $this->mapping;
|
||||
if ($this->joinColumns) {
|
||||
$mapping['joinColumns'] = $this->joinColumns;
|
||||
}
|
||||
$cm = $this->builder->getClassMetadata();
|
||||
if ($this->type == ClassMetadata::MANY_TO_ONE) {
|
||||
$cm->mapManyToOne($mapping);
|
||||
} else if ($this->type == ClassMetadata::ONE_TO_ONE) {
|
||||
$cm->mapOneToOne($mapping);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Type should be a ToOne Association here");
|
||||
}
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
547
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php
vendored
Normal file
547
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,547 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
|
||||
/**
|
||||
* Builder Object for ClassMetadata
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class ClassMetadataBuilder
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\ORM\Mapping\ClassMetadataInfo
|
||||
*/
|
||||
private $cm;
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $cm
|
||||
*/
|
||||
public function __construct(ClassMetadataInfo $cm)
|
||||
{
|
||||
$this->cm = $cm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClassMetadata
|
||||
*/
|
||||
public function getClassMetadata()
|
||||
{
|
||||
return $this->cm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the class as mapped superclass.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setMappedSuperClass()
|
||||
{
|
||||
$this->cm->isMappedSuperclass = true;
|
||||
$this->cm->isEmbeddedClass = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the class as embeddable.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setEmbeddable()
|
||||
{
|
||||
$this->cm->isEmbeddedClass = true;
|
||||
$this->cm->isMappedSuperclass = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds and embedded class
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $class
|
||||
* @param string|null $columnPrefix
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addEmbedded($fieldName, $class, $columnPrefix = null)
|
||||
{
|
||||
$this->cm->mapEmbedded(array(
|
||||
'fieldName' => $fieldName,
|
||||
'class' => $class,
|
||||
'columnPrefix' => $columnPrefix
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets custom Repository class name.
|
||||
*
|
||||
* @param string $repositoryClassName
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setCustomRepositoryClass($repositoryClassName)
|
||||
{
|
||||
$this->cm->setCustomRepositoryClass($repositoryClassName);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks class read only.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setReadOnly()
|
||||
{
|
||||
$this->cm->markReadOnly();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the table name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setTable($name)
|
||||
{
|
||||
$this->cm->setPrimaryTable(array('name' => $name));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Index.
|
||||
*
|
||||
* @param array $columns
|
||||
* @param string $name
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addIndex(array $columns, $name)
|
||||
{
|
||||
if (!isset($this->cm->table['indexes'])) {
|
||||
$this->cm->table['indexes'] = array();
|
||||
}
|
||||
|
||||
$this->cm->table['indexes'][$name] = array('columns' => $columns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Unique Constraint.
|
||||
*
|
||||
* @param array $columns
|
||||
* @param string $name
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addUniqueConstraint(array $columns, $name)
|
||||
{
|
||||
if ( ! isset($this->cm->table['uniqueConstraints'])) {
|
||||
$this->cm->table['uniqueConstraints'] = array();
|
||||
}
|
||||
|
||||
$this->cm->table['uniqueConstraints'][$name] = array('columns' => $columns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds named query.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $dqlQuery
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addNamedQuery($name, $dqlQuery)
|
||||
{
|
||||
$this->cm->addNamedQuery(array(
|
||||
'name' => $name,
|
||||
'query' => $dqlQuery,
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class as root of a joined table inheritance hierarchy.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setJoinedTableInheritance()
|
||||
{
|
||||
$this->cm->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_JOINED);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class as root of a single table inheritance hierarchy.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setSingleTableInheritance()
|
||||
{
|
||||
$this->cm->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the discriminator column details.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param int $length
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setDiscriminatorColumn($name, $type = 'string', $length = 255)
|
||||
{
|
||||
$this->cm->setDiscriminatorColumn(array(
|
||||
'name' => $name,
|
||||
'type' => $type,
|
||||
'length' => $length,
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a subclass to this inheritance hierarchy.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $class
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addDiscriminatorMapClass($name, $class)
|
||||
{
|
||||
$this->cm->addDiscriminatorMapClass($name, $class);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets deferred explicit change tracking policy.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setChangeTrackingPolicyDeferredExplicit()
|
||||
{
|
||||
$this->cm->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_DEFERRED_EXPLICIT);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets notify change tracking policy.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function setChangeTrackingPolicyNotify()
|
||||
{
|
||||
$this->cm->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_NOTIFY);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds lifecycle event.
|
||||
*
|
||||
* @param string $methodName
|
||||
* @param string $event
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addLifecycleEvent($methodName, $event)
|
||||
{
|
||||
$this->cm->addLifecycleCallback($methodName, $event);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Field.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param array $mapping
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addField($name, $type, array $mapping = array())
|
||||
{
|
||||
$mapping['fieldName'] = $name;
|
||||
$mapping['type'] = $type;
|
||||
|
||||
$this->cm->mapField($mapping);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a field builder.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function createField($name, $type)
|
||||
{
|
||||
return new FieldBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $name,
|
||||
'type' => $type
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an embedded builder.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $class
|
||||
*
|
||||
* @return EmbeddedBuilder
|
||||
*/
|
||||
public function createEmbedded($fieldName, $class)
|
||||
{
|
||||
return new EmbeddedBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $fieldName,
|
||||
'class' => $class,
|
||||
'columnPrefix' => null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a simple many to one association, optionally with the inversed by field.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string|null $inversedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addManyToOne($name, $targetEntity, $inversedBy = null)
|
||||
{
|
||||
$builder = $this->createManyToOne($name, $targetEntity);
|
||||
|
||||
if ($inversedBy) {
|
||||
$builder->inversedBy($inversedBy);
|
||||
}
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ManyToOne Association Builder.
|
||||
*
|
||||
* Note: This method does not add the association, you have to call build() on the AssociationBuilder.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
*
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function createManyToOne($name, $targetEntity)
|
||||
{
|
||||
return new AssociationBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $targetEntity
|
||||
),
|
||||
ClassMetadata::MANY_TO_ONE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a OneToOne Association Builder.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
*
|
||||
* @return AssociationBuilder
|
||||
*/
|
||||
public function createOneToOne($name, $targetEntity)
|
||||
{
|
||||
return new AssociationBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $targetEntity
|
||||
),
|
||||
ClassMetadata::ONE_TO_ONE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds simple inverse one-to-one association.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string $mappedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addInverseOneToOne($name, $targetEntity, $mappedBy)
|
||||
{
|
||||
$builder = $this->createOneToOne($name, $targetEntity);
|
||||
$builder->mappedBy($mappedBy);
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds simple owning one-to-one association.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string|null $inversedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addOwningOneToOne($name, $targetEntity, $inversedBy = null)
|
||||
{
|
||||
$builder = $this->createOneToOne($name, $targetEntity);
|
||||
|
||||
if ($inversedBy) {
|
||||
$builder->inversedBy($inversedBy);
|
||||
}
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ManyToMany Association Builder.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
*
|
||||
* @return ManyToManyAssociationBuilder
|
||||
*/
|
||||
public function createManyToMany($name, $targetEntity)
|
||||
{
|
||||
return new ManyToManyAssociationBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $targetEntity
|
||||
),
|
||||
ClassMetadata::MANY_TO_MANY
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a simple owning many to many association.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string|null $inversedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addOwningManyToMany($name, $targetEntity, $inversedBy = null)
|
||||
{
|
||||
$builder = $this->createManyToMany($name, $targetEntity);
|
||||
|
||||
if ($inversedBy) {
|
||||
$builder->inversedBy($inversedBy);
|
||||
}
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a simple inverse many to many association.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string $mappedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addInverseManyToMany($name, $targetEntity, $mappedBy)
|
||||
{
|
||||
$builder = $this->createManyToMany($name, $targetEntity);
|
||||
$builder->mappedBy($mappedBy);
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a one to many association builder.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
*
|
||||
* @return OneToManyAssociationBuilder
|
||||
*/
|
||||
public function createOneToMany($name, $targetEntity)
|
||||
{
|
||||
return new OneToManyAssociationBuilder(
|
||||
$this,
|
||||
array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $targetEntity
|
||||
),
|
||||
ClassMetadata::ONE_TO_MANY
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds simple OneToMany association.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string $mappedBy
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function addOneToMany($name, $targetEntity, $mappedBy)
|
||||
{
|
||||
$builder = $this->createOneToMany($name, $targetEntity);
|
||||
$builder->mappedBy($mappedBy);
|
||||
|
||||
return $builder->build();
|
||||
}
|
||||
}
|
||||
80
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/EmbeddedBuilder.php
vendored
Normal file
80
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/EmbeddedBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
/**
|
||||
* Embedded Builder
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.5
|
||||
* @author Guido Contreras Woda <guiwoda@gmail.com>
|
||||
*/
|
||||
class EmbeddedBuilder
|
||||
{
|
||||
/**
|
||||
* @var ClassMetadataBuilder
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapping;
|
||||
|
||||
/**
|
||||
* @param ClassMetadataBuilder $builder
|
||||
* @param array $mapping
|
||||
*/
|
||||
public function __construct(ClassMetadataBuilder $builder, array $mapping)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
$this->mapping = $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the column prefix for all of the embedded columns.
|
||||
*
|
||||
* @param string $columnPrefix
|
||||
* @return $this
|
||||
*/
|
||||
public function setColumnPrefix($columnPrefix)
|
||||
{
|
||||
$this->mapping['columnPrefix'] = $columnPrefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalizes this embeddable and attach it to the ClassMetadata.
|
||||
*
|
||||
* Without this call an EmbeddedBuilder has no effect on the ClassMetadata.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$cm = $this->builder->getClassMetadata();
|
||||
|
||||
$cm->mapEmbedded($this->mapping);
|
||||
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
72
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/EntityListenerBuilder.php
vendored
Normal file
72
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/EntityListenerBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Events;
|
||||
|
||||
/**
|
||||
* Builder for entity listeners.
|
||||
*
|
||||
* @since 2.4
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class EntityListenerBuilder
|
||||
{
|
||||
/**
|
||||
* @var array Hash-map to handle event names.
|
||||
*/
|
||||
static private $events = array(
|
||||
Events::preRemove => true,
|
||||
Events::postRemove => true,
|
||||
Events::prePersist => true,
|
||||
Events::postPersist => true,
|
||||
Events::preUpdate => true,
|
||||
Events::postUpdate => true,
|
||||
Events::postLoad => true,
|
||||
Events::preFlush => true
|
||||
);
|
||||
|
||||
/**
|
||||
* Lookup the entity class to find methods that match to event lifecycle names
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata.
|
||||
* @param string $className The listener class name.
|
||||
*
|
||||
* @throws \Doctrine\ORM\Mapping\MappingException When the listener class not found.
|
||||
*/
|
||||
static public function bindEntityListener(ClassMetadata $metadata, $className)
|
||||
{
|
||||
$class = $metadata->fullyQualifiedClassName($className);
|
||||
|
||||
if ( ! class_exists($class)) {
|
||||
throw MappingException::entityListenerClassNotFound($class, $className);
|
||||
}
|
||||
|
||||
foreach (get_class_methods($class) as $method) {
|
||||
if ( ! isset(self::$events[$method])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$metadata->addEntityListener($method, $class, $method);
|
||||
}
|
||||
}
|
||||
}
|
||||
257
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php
vendored
Normal file
257
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/FieldBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
/**
|
||||
* Field Builder
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class FieldBuilder
|
||||
{
|
||||
/**
|
||||
* @var ClassMetadataBuilder
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapping;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $generatedValue;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $sequenceDef;
|
||||
|
||||
/**
|
||||
* @param ClassMetadataBuilder $builder
|
||||
* @param array $mapping
|
||||
*/
|
||||
public function __construct(ClassMetadataBuilder $builder, array $mapping)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
$this->mapping = $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets length.
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function length($length)
|
||||
{
|
||||
$this->mapping['length'] = $length;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets nullable.
|
||||
*
|
||||
* @param bool $flag
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function nullable($flag = true)
|
||||
{
|
||||
$this->mapping['nullable'] = (bool)$flag;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Unique.
|
||||
*
|
||||
* @param bool $flag
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function unique($flag = true)
|
||||
{
|
||||
$this->mapping['unique'] = (bool)$flag;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets column name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function columnName($name)
|
||||
{
|
||||
$this->mapping['columnName'] = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Precision.
|
||||
*
|
||||
* @param int $p
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function precision($p)
|
||||
{
|
||||
$this->mapping['precision'] = $p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets scale.
|
||||
*
|
||||
* @param int $s
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function scale($s)
|
||||
{
|
||||
$this->mapping['scale'] = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field as primary key.
|
||||
*
|
||||
* @deprecated Use makePrimaryKey() instead
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function isPrimaryKey()
|
||||
{
|
||||
return $this->makePrimaryKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field as primary key.
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function makePrimaryKey()
|
||||
{
|
||||
$this->mapping['id'] = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function option($name, $value)
|
||||
{
|
||||
$this->mapping['options'][$name] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $strategy
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function generatedValue($strategy = 'AUTO')
|
||||
{
|
||||
$this->generatedValue = $strategy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field versioned.
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function isVersionField()
|
||||
{
|
||||
$this->version = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Sequence Generator.
|
||||
*
|
||||
* @param string $sequenceName
|
||||
* @param int $allocationSize
|
||||
* @param int $initialValue
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
|
||||
{
|
||||
$this->sequenceDef = array(
|
||||
'sequenceName' => $sequenceName,
|
||||
'allocationSize' => $allocationSize,
|
||||
'initialValue' => $initialValue,
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets column definition.
|
||||
*
|
||||
* @param string $def
|
||||
*
|
||||
* @return FieldBuilder
|
||||
*/
|
||||
public function columnDefinition($def)
|
||||
{
|
||||
$this->mapping['columnDefinition'] = $def;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalizes this field and attach it to the ClassMetadata.
|
||||
*
|
||||
* Without this call a FieldBuilder has no effect on the ClassMetadata.
|
||||
*
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$cm = $this->builder->getClassMetadata();
|
||||
if ($this->generatedValue) {
|
||||
$cm->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $this->generatedValue));
|
||||
}
|
||||
if ($this->version) {
|
||||
$cm->setVersionMapping($this->mapping);
|
||||
}
|
||||
$cm->mapField($this->mapping);
|
||||
if ($this->sequenceDef) {
|
||||
$cm->setSequenceGeneratorDefinition($this->sequenceDef);
|
||||
}
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
98
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/ManyToManyAssociationBuilder.php
vendored
Normal file
98
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/ManyToManyAssociationBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
/**
|
||||
* ManyToMany Association Builder
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $joinTableName;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $inverseJoinColumns = array();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return ManyToManyAssociationBuilder
|
||||
*/
|
||||
public function setJoinTable($name)
|
||||
{
|
||||
$this->joinTableName = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Inverse Join Columns.
|
||||
*
|
||||
* @param string $columnName
|
||||
* @param string $referencedColumnName
|
||||
* @param bool $nullable
|
||||
* @param bool $unique
|
||||
* @param string|null $onDelete
|
||||
* @param string|null $columnDef
|
||||
*
|
||||
* @return ManyToManyAssociationBuilder
|
||||
*/
|
||||
public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
|
||||
{
|
||||
$this->inverseJoinColumns[] = array(
|
||||
'name' => $columnName,
|
||||
'referencedColumnName' => $referencedColumnName,
|
||||
'nullable' => $nullable,
|
||||
'unique' => $unique,
|
||||
'onDelete' => $onDelete,
|
||||
'columnDefinition' => $columnDef,
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$mapping = $this->mapping;
|
||||
$mapping['joinTable'] = array();
|
||||
if ($this->joinColumns) {
|
||||
$mapping['joinTable']['joinColumns'] = $this->joinColumns;
|
||||
}
|
||||
if ($this->inverseJoinColumns) {
|
||||
$mapping['joinTable']['inverseJoinColumns'] = $this->inverseJoinColumns;
|
||||
}
|
||||
if ($this->joinTableName) {
|
||||
$mapping['joinTable']['name'] = $this->joinTableName;
|
||||
}
|
||||
$cm = $this->builder->getClassMetadata();
|
||||
$cm->mapManyToMany($mapping);
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
67
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php
vendored
Normal file
67
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Builder;
|
||||
|
||||
/**
|
||||
* OneToMany Association Builder
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class OneToManyAssociationBuilder extends AssociationBuilder
|
||||
{
|
||||
/**
|
||||
* @param array $fieldNames
|
||||
*
|
||||
* @return OneToManyAssociationBuilder
|
||||
*/
|
||||
public function setOrderBy(array $fieldNames)
|
||||
{
|
||||
$this->mapping['orderBy'] = $fieldNames;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return OneToManyAssociationBuilder
|
||||
*/
|
||||
public function setIndexBy($fieldName)
|
||||
{
|
||||
$this->mapping['indexBy'] = $fieldName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClassMetadataBuilder
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$mapping = $this->mapping;
|
||||
if ($this->joinColumns) {
|
||||
$mapping['joinColumns'] = $this->joinColumns;
|
||||
}
|
||||
$cm = $this->builder->getClassMetadata();
|
||||
$cm->mapOneToMany($mapping);
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
44
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Cache.php
vendored
Normal file
44
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Cache.php
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Caching to an entity or a collection.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.5
|
||||
*
|
||||
* @Annotation
|
||||
* @Target({"CLASS","PROPERTY"})
|
||||
*/
|
||||
final class Cache implements Annotation
|
||||
{
|
||||
/**
|
||||
* @Enum({"READ_ONLY", "NONSTRICT_READ_WRITE", "READ_WRITE"})
|
||||
*
|
||||
* @var string The concurrency strategy.
|
||||
*/
|
||||
public $usage = 'READ_ONLY';
|
||||
|
||||
/**
|
||||
* @var string Cache region name.
|
||||
*/
|
||||
public $region;
|
||||
}
|
||||
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ChangeTrackingPolicy.php
vendored
Normal file
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ChangeTrackingPolicy.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class ChangeTrackingPolicy implements Annotation
|
||||
{
|
||||
/**
|
||||
* The change tracking policy.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"})
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
29
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadata.php
vendored
Normal file
29
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadata.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @todo remove or rename ClassMetadataInfo to ClassMetadata
|
||||
*/
|
||||
class ClassMetadata extends ClassMetadataInfo
|
||||
{
|
||||
}
|
||||
768
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
vendored
Normal file
768
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
vendored
Normal file
|
|
@ -0,0 +1,768 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory;
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata as ClassMetadataInterface;
|
||||
use Doctrine\Common\Persistence\Mapping\ReflectionService;
|
||||
use Doctrine\DBAL\Platforms;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
|
||||
use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\ORM\Id\BigIntegerIdentityGenerator;
|
||||
use Doctrine\ORM\Id\IdentityGenerator;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use ReflectionException;
|
||||
|
||||
/**
|
||||
* The ClassMetadataFactory is used to create ClassMetadata objects that contain all the
|
||||
* metadata mapping information of a class which describes how a class should be mapped
|
||||
* to a relational database.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
{
|
||||
/**
|
||||
* @var EntityManagerInterface|null
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $targetPlatform;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
|
||||
*/
|
||||
private $driver;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\EventManager
|
||||
*/
|
||||
private $evm;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $embeddablesActiveNesting = array();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function loadMetadata($name)
|
||||
{
|
||||
$loaded = parent::loadMetadata($name);
|
||||
|
||||
array_map([$this, 'resolveDiscriminatorValue'], array_map([$this, 'getMetadataFor'], $loaded));
|
||||
|
||||
return $loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
*/
|
||||
public function setEntityManager(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->driver = $this->em->getConfiguration()->getMetadataDriverImpl();
|
||||
$this->evm = $this->em->getEventManager();
|
||||
$this->initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function onNotFoundMetadata($className)
|
||||
{
|
||||
if (! $this->evm->hasListeners(Events::onClassMetadataNotFound)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$eventArgs = new OnClassMetadataNotFoundEventArgs($className, $this->em);
|
||||
|
||||
$this->evm->dispatchEvent(Events::onClassMetadataNotFound, $eventArgs);
|
||||
|
||||
return $eventArgs->getFoundMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents)
|
||||
{
|
||||
/* @var $class ClassMetadata */
|
||||
/* @var $parent ClassMetadata */
|
||||
if ($parent) {
|
||||
$class->setInheritanceType($parent->inheritanceType);
|
||||
$class->setDiscriminatorColumn($parent->discriminatorColumn);
|
||||
$class->setIdGeneratorType($parent->generatorType);
|
||||
$this->addInheritedFields($class, $parent);
|
||||
$this->addInheritedRelations($class, $parent);
|
||||
$this->addInheritedEmbeddedClasses($class, $parent);
|
||||
$class->setIdentifier($parent->identifier);
|
||||
$class->setVersioned($parent->isVersioned);
|
||||
$class->setVersionField($parent->versionField);
|
||||
$class->setDiscriminatorMap($parent->discriminatorMap);
|
||||
$class->setLifecycleCallbacks($parent->lifecycleCallbacks);
|
||||
$class->setChangeTrackingPolicy($parent->changeTrackingPolicy);
|
||||
|
||||
if ( ! empty($parent->customGeneratorDefinition)) {
|
||||
$class->setCustomGeneratorDefinition($parent->customGeneratorDefinition);
|
||||
}
|
||||
|
||||
if ($parent->isMappedSuperclass) {
|
||||
$class->setCustomRepositoryClass($parent->customRepositoryClassName);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke driver
|
||||
try {
|
||||
$this->driver->loadMetadataForClass($class->getName(), $class);
|
||||
} catch (ReflectionException $e) {
|
||||
throw MappingException::reflectionFailure($class->getName(), $e);
|
||||
}
|
||||
|
||||
// If this class has a parent the id generator strategy is inherited.
|
||||
// However this is only true if the hierarchy of parents contains the root entity,
|
||||
// if it consists of mapped superclasses these don't necessarily include the id field.
|
||||
if ($parent && $rootEntityFound) {
|
||||
if ($parent->isIdGeneratorSequence()) {
|
||||
$class->setSequenceGeneratorDefinition($parent->sequenceGeneratorDefinition);
|
||||
} else if ($parent->isIdGeneratorTable()) {
|
||||
$class->tableGeneratorDefinition = $parent->tableGeneratorDefinition;
|
||||
}
|
||||
|
||||
if ($parent->generatorType) {
|
||||
$class->setIdGeneratorType($parent->generatorType);
|
||||
}
|
||||
|
||||
if ($parent->idGenerator) {
|
||||
$class->setIdGenerator($parent->idGenerator);
|
||||
}
|
||||
} else {
|
||||
$this->completeIdGeneratorMapping($class);
|
||||
}
|
||||
|
||||
if (!$class->isMappedSuperclass) {
|
||||
foreach ($class->embeddedClasses as $property => $embeddableClass) {
|
||||
|
||||
if (isset($embeddableClass['inherited'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! (isset($embeddableClass['class']) && $embeddableClass['class'])) {
|
||||
throw MappingException::missingEmbeddedClass($property);
|
||||
}
|
||||
|
||||
if (isset($this->embeddablesActiveNesting[$embeddableClass['class']])) {
|
||||
throw MappingException::infiniteEmbeddableNesting($class->name, $property);
|
||||
}
|
||||
|
||||
$this->embeddablesActiveNesting[$class->name] = true;
|
||||
|
||||
$embeddableMetadata = $this->getMetadataFor($embeddableClass['class']);
|
||||
|
||||
if ($embeddableMetadata->isEmbeddedClass) {
|
||||
$this->addNestedEmbeddedClasses($embeddableMetadata, $class, $property);
|
||||
}
|
||||
|
||||
$class->inlineEmbeddable($property, $embeddableMetadata);
|
||||
|
||||
unset($this->embeddablesActiveNesting[$class->name]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent) {
|
||||
if ($parent->isInheritanceTypeSingleTable()) {
|
||||
$class->setPrimaryTable($parent->table);
|
||||
}
|
||||
|
||||
if ($parent) {
|
||||
$this->addInheritedIndexes($class, $parent);
|
||||
}
|
||||
|
||||
if ($parent->cache) {
|
||||
$class->cache = $parent->cache;
|
||||
}
|
||||
|
||||
if ($parent->containsForeignIdentifier) {
|
||||
$class->containsForeignIdentifier = true;
|
||||
}
|
||||
|
||||
if ( ! empty($parent->namedQueries)) {
|
||||
$this->addInheritedNamedQueries($class, $parent);
|
||||
}
|
||||
|
||||
if ( ! empty($parent->namedNativeQueries)) {
|
||||
$this->addInheritedNamedNativeQueries($class, $parent);
|
||||
}
|
||||
|
||||
if ( ! empty($parent->sqlResultSetMappings)) {
|
||||
$this->addInheritedSqlResultSetMappings($class, $parent);
|
||||
}
|
||||
|
||||
if ( ! empty($parent->entityListeners) && empty($class->entityListeners)) {
|
||||
$class->entityListeners = $parent->entityListeners;
|
||||
}
|
||||
}
|
||||
|
||||
$class->setParentClasses($nonSuperclassParents);
|
||||
|
||||
if ($class->isRootEntity() && ! $class->isInheritanceTypeNone() && ! $class->discriminatorMap) {
|
||||
$this->addDefaultDiscriminatorMap($class);
|
||||
}
|
||||
|
||||
if ($this->evm->hasListeners(Events::loadClassMetadata)) {
|
||||
$eventArgs = new LoadClassMetadataEventArgs($class, $this->em);
|
||||
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
|
||||
}
|
||||
|
||||
$this->validateRuntimeMetadata($class, $parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate runtime metadata is correctly defined.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param ClassMetadataInterface|null $parent
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws MappingException
|
||||
*/
|
||||
protected function validateRuntimeMetadata($class, $parent)
|
||||
{
|
||||
if ( ! $class->reflClass ) {
|
||||
// only validate if there is a reflection class instance
|
||||
return;
|
||||
}
|
||||
|
||||
$class->validateIdentifier();
|
||||
$class->validateAssociations();
|
||||
$class->validateLifecycleCallbacks($this->getReflectionService());
|
||||
|
||||
// verify inheritance
|
||||
if ( ! $class->isMappedSuperclass && !$class->isInheritanceTypeNone()) {
|
||||
if ( ! $parent) {
|
||||
if (count($class->discriminatorMap) == 0) {
|
||||
throw MappingException::missingDiscriminatorMap($class->name);
|
||||
}
|
||||
if ( ! $class->discriminatorColumn) {
|
||||
throw MappingException::missingDiscriminatorColumn($class->name);
|
||||
}
|
||||
}
|
||||
} else if ($class->isMappedSuperclass && $class->name == $class->rootEntityName && (count($class->discriminatorMap) || $class->discriminatorColumn)) {
|
||||
// second condition is necessary for mapped superclasses in the middle of an inheritance hierarchy
|
||||
throw MappingException::noInheritanceOnMappedSuperClass($class->name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function newClassMetadataInstance($className)
|
||||
{
|
||||
return new ClassMetadata($className, $this->em->getConfiguration()->getNamingStrategy());
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the discriminator value of the given metadata (if not set) by iterating over discriminator
|
||||
* map classes and looking for a fitting one.
|
||||
*
|
||||
* @param ClassMetadata $metadata
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws MappingException
|
||||
*/
|
||||
private function resolveDiscriminatorValue(ClassMetadata $metadata)
|
||||
{
|
||||
if ($metadata->discriminatorValue
|
||||
|| ! $metadata->discriminatorMap
|
||||
|| $metadata->isMappedSuperclass
|
||||
|| ! $metadata->reflClass
|
||||
|| $metadata->reflClass->isAbstract()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// minor optimization: avoid loading related metadata when not needed
|
||||
foreach ($metadata->discriminatorMap as $discriminatorValue => $discriminatorClass) {
|
||||
if ($discriminatorClass === $metadata->name) {
|
||||
$metadata->discriminatorValue = $discriminatorValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// iterate over discriminator mappings and resolve actual referenced classes according to existing metadata
|
||||
foreach ($metadata->discriminatorMap as $discriminatorValue => $discriminatorClass) {
|
||||
if ($metadata->name === $this->getMetadataFor($discriminatorClass)->getName()) {
|
||||
$metadata->discriminatorValue = $discriminatorValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw MappingException::mappedClassNotPartOfDiscriminatorMap($metadata->name, $metadata->rootEntityName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a default discriminator map if no one is given
|
||||
*
|
||||
* If an entity is of any inheritance type and does not contain a
|
||||
* discriminator map, then the map is generated automatically. This process
|
||||
* is expensive computation wise.
|
||||
*
|
||||
* The automatically generated discriminator map contains the lowercase short name of
|
||||
* each class as key.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
|
||||
*
|
||||
* @throws MappingException
|
||||
*/
|
||||
private function addDefaultDiscriminatorMap(ClassMetadata $class)
|
||||
{
|
||||
$allClasses = $this->driver->getAllClassNames();
|
||||
$fqcn = $class->getName();
|
||||
$map = array($this->getShortName($class->name) => $fqcn);
|
||||
|
||||
$duplicates = array();
|
||||
foreach ($allClasses as $subClassCandidate) {
|
||||
if (is_subclass_of($subClassCandidate, $fqcn)) {
|
||||
$shortName = $this->getShortName($subClassCandidate);
|
||||
|
||||
if (isset($map[$shortName])) {
|
||||
$duplicates[] = $shortName;
|
||||
}
|
||||
|
||||
$map[$shortName] = $subClassCandidate;
|
||||
}
|
||||
}
|
||||
|
||||
if ($duplicates) {
|
||||
throw MappingException::duplicateDiscriminatorEntry($class->name, $duplicates, $map);
|
||||
}
|
||||
|
||||
$class->setDiscriminatorMap($map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lower-case short name of a class.
|
||||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getShortName($className)
|
||||
{
|
||||
if (strpos($className, "\\") === false) {
|
||||
return strtolower($className);
|
||||
}
|
||||
|
||||
$parts = explode("\\", $className);
|
||||
return strtolower(end($parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited fields to the subclass mapping.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->fieldMappings as $mapping) {
|
||||
if ( ! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
if ( ! isset($mapping['declared'])) {
|
||||
$mapping['declared'] = $parentClass->name;
|
||||
}
|
||||
$subClass->addInheritedFieldMapping($mapping);
|
||||
}
|
||||
foreach ($parentClass->reflFields as $name => $field) {
|
||||
$subClass->reflFields[$name] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited association mappings to the subclass mapping.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws MappingException
|
||||
*/
|
||||
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->associationMappings as $field => $mapping) {
|
||||
if ($parentClass->isMappedSuperclass) {
|
||||
if ($mapping['type'] & ClassMetadata::TO_MANY && !$mapping['isOwningSide']) {
|
||||
throw MappingException::illegalToManyAssociationOnMappedSuperclass($parentClass->name, $field);
|
||||
}
|
||||
$mapping['sourceEntity'] = $subClass->name;
|
||||
}
|
||||
|
||||
//$subclassMapping = $mapping;
|
||||
if ( ! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
if ( ! isset($mapping['declared'])) {
|
||||
$mapping['declared'] = $parentClass->name;
|
||||
}
|
||||
$subClass->addInheritedAssociationMapping($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
private function addInheritedEmbeddedClasses(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->embeddedClasses as $field => $embeddedClass) {
|
||||
if ( ! isset($embeddedClass['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$embeddedClass['inherited'] = $parentClass->name;
|
||||
}
|
||||
if ( ! isset($embeddedClass['declared'])) {
|
||||
$embeddedClass['declared'] = $parentClass->name;
|
||||
}
|
||||
|
||||
$subClass->embeddedClasses[$field] = $embeddedClass;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds nested embedded classes metadata to a parent class.
|
||||
*
|
||||
* @param ClassMetadata $subClass Sub embedded class metadata to add nested embedded classes metadata from.
|
||||
* @param ClassMetadata $parentClass Parent class to add nested embedded classes metadata to.
|
||||
* @param string $prefix Embedded classes' prefix to use for nested embedded classes field names.
|
||||
*/
|
||||
private function addNestedEmbeddedClasses(ClassMetadata $subClass, ClassMetadata $parentClass, $prefix)
|
||||
{
|
||||
foreach ($subClass->embeddedClasses as $property => $embeddableClass) {
|
||||
if (isset($embeddableClass['inherited'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$embeddableMetadata = $this->getMetadataFor($embeddableClass['class']);
|
||||
|
||||
$parentClass->mapEmbedded(array(
|
||||
'fieldName' => $prefix . '.' . $property,
|
||||
'class' => $embeddableMetadata->name,
|
||||
'columnPrefix' => $embeddableClass['columnPrefix'],
|
||||
'declaredField' => $embeddableClass['declaredField']
|
||||
? $prefix . '.' . $embeddableClass['declaredField']
|
||||
: $prefix,
|
||||
'originalField' => $embeddableClass['originalField'] ?: $property,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the table indices from the parent class superclass to the child class
|
||||
*
|
||||
* @param ClassMetadata $subClass
|
||||
* @param ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addInheritedIndexes(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
if (! $parentClass->isMappedSuperclass) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (array('uniqueConstraints', 'indexes') as $indexType) {
|
||||
if (isset($parentClass->table[$indexType])) {
|
||||
foreach ($parentClass->table[$indexType] as $indexName => $index) {
|
||||
if (isset($subClass->table[$indexType][$indexName])) {
|
||||
continue; // Let the inheriting table override indices
|
||||
}
|
||||
|
||||
$subClass->table[$indexType][$indexName] = $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited named queries to the subclass mapping.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->namedQueries as $name => $query) {
|
||||
if ( ! isset ($subClass->namedQueries[$name])) {
|
||||
$subClass->addNamedQuery(array(
|
||||
'name' => $query['name'],
|
||||
'query' => $query['query']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited named native queries to the subclass mapping.
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addInheritedNamedNativeQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->namedNativeQueries as $name => $query) {
|
||||
if ( ! isset ($subClass->namedNativeQueries[$name])) {
|
||||
$subClass->addNamedNativeQuery(array(
|
||||
'name' => $query['name'],
|
||||
'query' => $query['query'],
|
||||
'isSelfClass' => $query['isSelfClass'],
|
||||
'resultSetMapping' => $query['resultSetMapping'],
|
||||
'resultClass' => $query['isSelfClass'] ? $subClass->name : $query['resultClass'],
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited sql result set mappings to the subclass mapping.
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->sqlResultSetMappings as $name => $mapping) {
|
||||
if ( ! isset ($subClass->sqlResultSetMappings[$name])) {
|
||||
$entities = array();
|
||||
foreach ($mapping['entities'] as $entity) {
|
||||
$entities[] = array(
|
||||
'fields' => $entity['fields'],
|
||||
'isSelfClass' => $entity['isSelfClass'],
|
||||
'discriminatorColumn' => $entity['discriminatorColumn'],
|
||||
'entityClass' => $entity['isSelfClass'] ? $subClass->name : $entity['entityClass'],
|
||||
);
|
||||
}
|
||||
|
||||
$subClass->addSqlResultSetMapping(array(
|
||||
'name' => $mapping['name'],
|
||||
'columns' => $mapping['columns'],
|
||||
'entities' => $entities,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Completes the ID generator mapping. If "auto" is specified we choose the generator
|
||||
* most appropriate for the targeted database platform.
|
||||
*
|
||||
* @param ClassMetadataInfo $class
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ORMException
|
||||
*/
|
||||
private function completeIdGeneratorMapping(ClassMetadataInfo $class)
|
||||
{
|
||||
$idGenType = $class->generatorType;
|
||||
if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
|
||||
if ($this->getTargetPlatform()->prefersSequences()) {
|
||||
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
|
||||
} else if ($this->getTargetPlatform()->prefersIdentityColumns()) {
|
||||
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
|
||||
} else {
|
||||
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
|
||||
}
|
||||
}
|
||||
|
||||
// Create & assign an appropriate ID generator instance
|
||||
switch ($class->generatorType) {
|
||||
case ClassMetadata::GENERATOR_TYPE_IDENTITY:
|
||||
$sequenceName = null;
|
||||
$fieldName = $class->identifier ? $class->getSingleIdentifierFieldName() : null;
|
||||
|
||||
// Platforms that do not have native IDENTITY support need a sequence to emulate this behaviour.
|
||||
if ($this->getTargetPlatform()->usesSequenceEmulatedIdentityColumns()) {
|
||||
$columnName = $class->getSingleIdentifierColumnName();
|
||||
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
|
||||
$sequencePrefix = $class->getSequencePrefix($this->getTargetPlatform());
|
||||
$sequenceName = $this->getTargetPlatform()->getIdentitySequenceName($sequencePrefix, $columnName);
|
||||
$definition = array(
|
||||
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName)
|
||||
);
|
||||
|
||||
if ($quoted) {
|
||||
$definition['quoted'] = true;
|
||||
}
|
||||
|
||||
$sequenceName = $this
|
||||
->em
|
||||
->getConfiguration()
|
||||
->getQuoteStrategy()
|
||||
->getSequenceName($definition, $class, $this->getTargetPlatform());
|
||||
}
|
||||
|
||||
$generator = ($fieldName && $class->fieldMappings[$fieldName]['type'] === 'bigint')
|
||||
? new BigIntegerIdentityGenerator($sequenceName)
|
||||
: new IdentityGenerator($sequenceName);
|
||||
|
||||
$class->setIdGenerator($generator);
|
||||
|
||||
break;
|
||||
|
||||
case ClassMetadata::GENERATOR_TYPE_SEQUENCE:
|
||||
// If there is no sequence definition yet, create a default definition
|
||||
$definition = $class->sequenceGeneratorDefinition;
|
||||
|
||||
if ( ! $definition) {
|
||||
$fieldName = $class->getSingleIdentifierFieldName();
|
||||
$sequenceName = $class->getSequenceName($this->getTargetPlatform());
|
||||
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
|
||||
|
||||
$definition = array(
|
||||
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName),
|
||||
'allocationSize' => 1,
|
||||
'initialValue' => 1,
|
||||
);
|
||||
|
||||
if ($quoted) {
|
||||
$definition['quoted'] = true;
|
||||
}
|
||||
|
||||
$class->setSequenceGeneratorDefinition($definition);
|
||||
}
|
||||
|
||||
$sequenceGenerator = new \Doctrine\ORM\Id\SequenceGenerator(
|
||||
$this->em->getConfiguration()->getQuoteStrategy()->getSequenceName($definition, $class, $this->getTargetPlatform()),
|
||||
$definition['allocationSize']
|
||||
);
|
||||
$class->setIdGenerator($sequenceGenerator);
|
||||
break;
|
||||
|
||||
case ClassMetadata::GENERATOR_TYPE_NONE:
|
||||
$class->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());
|
||||
break;
|
||||
|
||||
case ClassMetadata::GENERATOR_TYPE_UUID:
|
||||
$class->setIdGenerator(new \Doctrine\ORM\Id\UuidGenerator());
|
||||
break;
|
||||
|
||||
case ClassMetadata::GENERATOR_TYPE_TABLE:
|
||||
throw new ORMException("TableGenerator not yet implemented.");
|
||||
break;
|
||||
|
||||
case ClassMetadata::GENERATOR_TYPE_CUSTOM:
|
||||
$definition = $class->customGeneratorDefinition;
|
||||
if ( ! class_exists($definition['class'])) {
|
||||
throw new ORMException("Can't instantiate custom generator : " .
|
||||
$definition['class']);
|
||||
}
|
||||
$class->setIdGenerator(new $definition['class']);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ORMException("Unknown generator type: " . $class->generatorType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService)
|
||||
{
|
||||
/* @var $class ClassMetadata */
|
||||
$class->wakeupReflection($reflService);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initializeReflection(ClassMetadataInterface $class, ReflectionService $reflService)
|
||||
{
|
||||
/* @var $class ClassMetadata */
|
||||
$class->initializeReflection($reflService);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getFqcnFromAlias($namespaceAlias, $simpleClassName)
|
||||
{
|
||||
return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDriver()
|
||||
{
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function isEntity(ClassMetadataInterface $class)
|
||||
{
|
||||
return isset($class->isMappedSuperclass) && $class->isMappedSuperclass === false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Platforms\AbstractPlatform
|
||||
*/
|
||||
private function getTargetPlatform()
|
||||
{
|
||||
if (!$this->targetPlatform) {
|
||||
$this->targetPlatform = $this->em->getConnection()->getDatabasePlatform();
|
||||
}
|
||||
|
||||
return $this->targetPlatform;
|
||||
}
|
||||
}
|
||||
3330
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
vendored
Normal file
3330
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
76
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Column.php
vendored
Normal file
76
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Column.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY","ANNOTATION"})
|
||||
*/
|
||||
final class Column implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $type = 'string';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
public $length;
|
||||
|
||||
/**
|
||||
* The precision for a decimal (exact numeric) column (Applies only for decimal column).
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $precision = 0;
|
||||
|
||||
/**
|
||||
* The scale for a decimal (exact numeric) column (Applies only for decimal column).
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $scale = 0;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $unique = false;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $nullable = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $options = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $columnDefinition;
|
||||
}
|
||||
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ColumnResult.php
vendored
Normal file
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ColumnResult.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* References name of a column in the SELECT clause of a SQL query.
|
||||
* Scalar result types can be included in the query result by specifying this annotation in the metadata.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class ColumnResult implements Annotation
|
||||
{
|
||||
/**
|
||||
* The name of a column in the SELECT clause of a SQL query.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/CustomIdGenerator.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/CustomIdGenerator.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class CustomIdGenerator implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
}
|
||||
75
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultEntityListenerResolver.php
vendored
Normal file
75
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultEntityListenerResolver.php
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* The default DefaultEntityListener
|
||||
*
|
||||
* @since 2.4
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class DefaultEntityListenerResolver implements EntityListenerResolver
|
||||
{
|
||||
/**
|
||||
* @var array Map to store entity listener instances.
|
||||
*/
|
||||
private $instances = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear($className = null)
|
||||
{
|
||||
if ($className === null) {
|
||||
$this->instances = array();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($this->instances[$className = trim($className, '\\')])) {
|
||||
unset($this->instances[$className]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register($object)
|
||||
{
|
||||
if ( ! is_object($object)) {
|
||||
throw new \InvalidArgumentException(sprintf('An object was expected, but got "%s".', gettype($object)));
|
||||
}
|
||||
|
||||
$this->instances[get_class($object)] = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve($className)
|
||||
{
|
||||
if (isset($this->instances[$className = trim($className, '\\')])) {
|
||||
return $this->instances[$className];
|
||||
}
|
||||
|
||||
return $this->instances[$className] = new $className();
|
||||
}
|
||||
}
|
||||
94
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultNamingStrategy.php
vendored
Normal file
94
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultNamingStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* The default NamingStrategy
|
||||
*
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class DefaultNamingStrategy implements NamingStrategy
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function classToTableName($className)
|
||||
{
|
||||
if (strpos($className, '\\') !== false) {
|
||||
return substr($className, strrpos($className, '\\') + 1);
|
||||
}
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function propertyToColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
|
||||
{
|
||||
return $propertyName.'_'.$embeddedColumnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function referenceColumnName()
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $propertyName . '_' . $this->referenceColumnName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
|
||||
{
|
||||
return strtolower($this->classToTableName($sourceEntity) . '_' .
|
||||
$this->classToTableName($targetEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinKeyColumnName($entityName, $referencedColumnName = null)
|
||||
{
|
||||
return strtolower($this->classToTableName($entityName) . '_' .
|
||||
($referencedColumnName ?: $this->referenceColumnName()));
|
||||
}
|
||||
}
|
||||
163
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php
vendored
Normal file
163
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* A set of rules for determining the physical column, alias and table quotes
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class DefaultQuoteStrategy implements QuoteStrategy
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return isset($class->fieldMappings[$fieldName]['quoted'])
|
||||
? $platform->quoteIdentifier($class->fieldMappings[$fieldName]['columnName'])
|
||||
: $class->fieldMappings[$fieldName]['columnName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @todo Table names should be computed in DBAL depending on the platform
|
||||
*/
|
||||
public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
$tableName = $class->table['name'];
|
||||
|
||||
if ( ! empty($class->table['schema'])) {
|
||||
$tableName = $class->table['schema'] . '.' . $class->table['name'];
|
||||
|
||||
if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
|
||||
$tableName = $class->table['schema'] . '__' . $class->table['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return isset($class->table['quoted'])
|
||||
? $platform->quoteIdentifier($tableName)
|
||||
: $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return isset($definition['quoted'])
|
||||
? $platform->quoteIdentifier($definition['sequenceName'])
|
||||
: $definition['sequenceName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return isset($joinColumn['quoted'])
|
||||
? $platform->quoteIdentifier($joinColumn['name'])
|
||||
: $joinColumn['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
return isset($joinColumn['quoted'])
|
||||
? $platform->quoteIdentifier($joinColumn['referencedColumnName'])
|
||||
: $joinColumn['referencedColumnName'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
$schema = '';
|
||||
|
||||
if (isset($association['joinTable']['schema'])) {
|
||||
$schema = $association['joinTable']['schema'] . '.';
|
||||
}
|
||||
|
||||
$tableName = $association['joinTable']['name'];
|
||||
|
||||
if (isset($association['joinTable']['quoted'])) {
|
||||
$tableName = $platform->quoteIdentifier($tableName);
|
||||
}
|
||||
|
||||
return $schema . $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
$quotedColumnNames = array();
|
||||
|
||||
foreach ($class->identifier as $fieldName) {
|
||||
if (isset($class->fieldMappings[$fieldName])) {
|
||||
$quotedColumnNames[] = $this->getColumnName($fieldName, $class, $platform);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Association defined as Id field
|
||||
$joinColumns = $class->associationMappings[$fieldName]['joinColumns'];
|
||||
$assocQuotedColumnNames = array_map(
|
||||
function ($joinColumn) use ($platform)
|
||||
{
|
||||
return isset($joinColumn['quoted'])
|
||||
? $platform->quoteIdentifier($joinColumn['name'])
|
||||
: $joinColumn['name'];
|
||||
},
|
||||
$joinColumns
|
||||
);
|
||||
|
||||
$quotedColumnNames = array_merge($quotedColumnNames, $assocQuotedColumnNames);
|
||||
}
|
||||
|
||||
return $quotedColumnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
|
||||
{
|
||||
// 1 ) Concatenate column name and counter
|
||||
// 2 ) Trim the column alias to the maximum identifier length of the platform.
|
||||
// If the alias is to long, characters are cut off from the beginning.
|
||||
// 3 ) Strip non alphanumeric characters
|
||||
// 4 ) Prefix with "_" if the result its numeric
|
||||
$columnName = $columnName . '_' . $counter;
|
||||
$columnName = substr($columnName, -$platform->getMaxIdentifierLength());
|
||||
$columnName = preg_replace('/[^A-Za-z0-9_]/', '', $columnName);
|
||||
$columnName = is_numeric($columnName) ? '_' . $columnName : $columnName;
|
||||
|
||||
return $platform->getSQLResultCasing($columnName);
|
||||
}
|
||||
}
|
||||
54
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DiscriminatorColumn.php
vendored
Normal file
54
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DiscriminatorColumn.php
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class DiscriminatorColumn implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
public $length;
|
||||
|
||||
/**
|
||||
* Field name used in non-object hydration (array/scalar).
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $fieldName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $columnDefinition;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DiscriminatorMap.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DiscriminatorMap.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class DiscriminatorMap implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
638
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
vendored
Normal file
638
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
vendored
Normal file
|
|
@ -0,0 +1,638 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\Mapping\JoinColumn;
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver;
|
||||
use Doctrine\ORM\Events;
|
||||
|
||||
/**
|
||||
* The AnnotationDriver reads the mapping metadata from docblock annotations.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class AnnotationDriver extends AbstractAnnotationDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected $entityAnnotationClasses = array(
|
||||
'Doctrine\ORM\Mapping\Entity' => 1,
|
||||
'Doctrine\ORM\Mapping\MappedSuperclass' => 2,
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
|
||||
$class = $metadata->getReflectionClass();
|
||||
if ( ! $class) {
|
||||
// this happens when running annotation driver in combination with
|
||||
// static reflection services. This is not the nicest fix
|
||||
$class = new \ReflectionClass($metadata->name);
|
||||
}
|
||||
|
||||
$classAnnotations = $this->reader->getClassAnnotations($class);
|
||||
|
||||
if ($classAnnotations) {
|
||||
foreach ($classAnnotations as $key => $annot) {
|
||||
if ( ! is_numeric($key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$classAnnotations[get_class($annot)] = $annot;
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate Entity annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\Entity'])) {
|
||||
$entityAnnot = $classAnnotations['Doctrine\ORM\Mapping\Entity'];
|
||||
if ($entityAnnot->repositoryClass !== null) {
|
||||
$metadata->setCustomRepositoryClass($entityAnnot->repositoryClass);
|
||||
}
|
||||
if ($entityAnnot->readOnly) {
|
||||
$metadata->markReadOnly();
|
||||
}
|
||||
} else if (isset($classAnnotations['Doctrine\ORM\Mapping\MappedSuperclass'])) {
|
||||
$mappedSuperclassAnnot = $classAnnotations['Doctrine\ORM\Mapping\MappedSuperclass'];
|
||||
$metadata->setCustomRepositoryClass($mappedSuperclassAnnot->repositoryClass);
|
||||
$metadata->isMappedSuperclass = true;
|
||||
} else if (isset($classAnnotations['Doctrine\ORM\Mapping\Embeddable'])) {
|
||||
$metadata->isEmbeddedClass = true;
|
||||
} else {
|
||||
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
|
||||
}
|
||||
|
||||
// Evaluate Table annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) {
|
||||
$tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table'];
|
||||
$primaryTable = array(
|
||||
'name' => $tableAnnot->name,
|
||||
'schema' => $tableAnnot->schema
|
||||
);
|
||||
|
||||
if ($tableAnnot->indexes !== null) {
|
||||
foreach ($tableAnnot->indexes as $indexAnnot) {
|
||||
$index = array('columns' => $indexAnnot->columns);
|
||||
|
||||
if ( ! empty($indexAnnot->flags)) {
|
||||
$index['flags'] = $indexAnnot->flags;
|
||||
}
|
||||
|
||||
if ( ! empty($indexAnnot->options)) {
|
||||
$index['options'] = $indexAnnot->options;
|
||||
}
|
||||
|
||||
if ( ! empty($indexAnnot->name)) {
|
||||
$primaryTable['indexes'][$indexAnnot->name] = $index;
|
||||
} else {
|
||||
$primaryTable['indexes'][] = $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($tableAnnot->uniqueConstraints !== null) {
|
||||
foreach ($tableAnnot->uniqueConstraints as $uniqueConstraintAnnot) {
|
||||
$uniqueConstraint = array('columns' => $uniqueConstraintAnnot->columns);
|
||||
|
||||
if ( ! empty($uniqueConstraintAnnot->options)) {
|
||||
$uniqueConstraint['options'] = $uniqueConstraintAnnot->options;
|
||||
}
|
||||
|
||||
if ( ! empty($uniqueConstraintAnnot->name)) {
|
||||
$primaryTable['uniqueConstraints'][$uniqueConstraintAnnot->name] = $uniqueConstraint;
|
||||
} else {
|
||||
$primaryTable['uniqueConstraints'][] = $uniqueConstraint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($tableAnnot->options) {
|
||||
$primaryTable['options'] = $tableAnnot->options;
|
||||
}
|
||||
|
||||
$metadata->setPrimaryTable($primaryTable);
|
||||
}
|
||||
|
||||
// Evaluate @Cache annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\Cache'])) {
|
||||
$cacheAnnot = $classAnnotations['Doctrine\ORM\Mapping\Cache'];
|
||||
$cacheMap = array(
|
||||
'region' => $cacheAnnot->region,
|
||||
'usage' => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
|
||||
);
|
||||
|
||||
$metadata->enableCache($cacheMap);
|
||||
}
|
||||
|
||||
// Evaluate NamedNativeQueries annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\NamedNativeQueries'])) {
|
||||
$namedNativeQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedNativeQueries'];
|
||||
|
||||
foreach ($namedNativeQueriesAnnot->value as $namedNativeQuery) {
|
||||
$metadata->addNamedNativeQuery(array(
|
||||
'name' => $namedNativeQuery->name,
|
||||
'query' => $namedNativeQuery->query,
|
||||
'resultClass' => $namedNativeQuery->resultClass,
|
||||
'resultSetMapping' => $namedNativeQuery->resultSetMapping,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate SqlResultSetMappings annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\SqlResultSetMappings'])) {
|
||||
$sqlResultSetMappingsAnnot = $classAnnotations['Doctrine\ORM\Mapping\SqlResultSetMappings'];
|
||||
|
||||
foreach ($sqlResultSetMappingsAnnot->value as $resultSetMapping) {
|
||||
$entities = array();
|
||||
$columns = array();
|
||||
foreach ($resultSetMapping->entities as $entityResultAnnot) {
|
||||
$entityResult = array(
|
||||
'fields' => array(),
|
||||
'entityClass' => $entityResultAnnot->entityClass,
|
||||
'discriminatorColumn' => $entityResultAnnot->discriminatorColumn,
|
||||
);
|
||||
|
||||
foreach ($entityResultAnnot->fields as $fieldResultAnnot) {
|
||||
$entityResult['fields'][] = array(
|
||||
'name' => $fieldResultAnnot->name,
|
||||
'column' => $fieldResultAnnot->column
|
||||
);
|
||||
}
|
||||
|
||||
$entities[] = $entityResult;
|
||||
}
|
||||
|
||||
foreach ($resultSetMapping->columns as $columnResultAnnot) {
|
||||
$columns[] = array(
|
||||
'name' => $columnResultAnnot->name,
|
||||
);
|
||||
}
|
||||
|
||||
$metadata->addSqlResultSetMapping(array(
|
||||
'name' => $resultSetMapping->name,
|
||||
'entities' => $entities,
|
||||
'columns' => $columns
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate NamedQueries annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\NamedQueries'])) {
|
||||
$namedQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedQueries'];
|
||||
|
||||
if ( ! is_array($namedQueriesAnnot->value)) {
|
||||
throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
|
||||
}
|
||||
|
||||
foreach ($namedQueriesAnnot->value as $namedQuery) {
|
||||
if ( ! ($namedQuery instanceof \Doctrine\ORM\Mapping\NamedQuery)) {
|
||||
throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
|
||||
}
|
||||
$metadata->addNamedQuery(array(
|
||||
'name' => $namedQuery->name,
|
||||
'query' => $namedQuery->query
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate InheritanceType annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\InheritanceType'])) {
|
||||
$inheritanceTypeAnnot = $classAnnotations['Doctrine\ORM\Mapping\InheritanceType'];
|
||||
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAnnot->value));
|
||||
|
||||
if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
|
||||
// Evaluate DiscriminatorColumn annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'])) {
|
||||
$discrColumnAnnot = $classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'];
|
||||
$metadata->setDiscriminatorColumn(array(
|
||||
'name' => $discrColumnAnnot->name,
|
||||
'type' => $discrColumnAnnot->type,
|
||||
'length' => $discrColumnAnnot->length,
|
||||
'columnDefinition' => $discrColumnAnnot->columnDefinition
|
||||
));
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
|
||||
}
|
||||
|
||||
// Evaluate DiscriminatorMap annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\DiscriminatorMap'])) {
|
||||
$discrMapAnnot = $classAnnotations['Doctrine\ORM\Mapping\DiscriminatorMap'];
|
||||
$metadata->setDiscriminatorMap($discrMapAnnot->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate DoctrineChangeTrackingPolicy annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\ChangeTrackingPolicy'])) {
|
||||
$changeTrackingAnnot = $classAnnotations['Doctrine\ORM\Mapping\ChangeTrackingPolicy'];
|
||||
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $changeTrackingAnnot->value));
|
||||
}
|
||||
|
||||
// Evaluate annotations on properties/fields
|
||||
/* @var $property \ReflectionProperty */
|
||||
foreach ($class->getProperties() as $property) {
|
||||
if ($metadata->isMappedSuperclass && ! $property->isPrivate()
|
||||
||
|
||||
$metadata->isInheritedField($property->name)
|
||||
||
|
||||
$metadata->isInheritedAssociation($property->name)
|
||||
||
|
||||
$metadata->isInheritedEmbeddedClass($property->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mapping = array();
|
||||
$mapping['fieldName'] = $property->getName();
|
||||
|
||||
// Check for JoinColumn/JoinColumns annotations
|
||||
$joinColumns = array();
|
||||
|
||||
if ($joinColumnAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumn')) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnAnnot);
|
||||
} else if ($joinColumnsAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumns')) {
|
||||
foreach ($joinColumnsAnnot->value as $joinColumn) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
}
|
||||
|
||||
// Field can only be annotated with one of:
|
||||
// @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany
|
||||
if ($columnAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Column')) {
|
||||
if ($columnAnnot->type == null) {
|
||||
throw MappingException::propertyTypeIsRequired($className, $property->getName());
|
||||
}
|
||||
|
||||
$mapping = $this->columnToArray($property->getName(), $columnAnnot);
|
||||
|
||||
if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
if ($generatedValueAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\GeneratedValue')) {
|
||||
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $generatedValueAnnot->strategy));
|
||||
}
|
||||
|
||||
if ($this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Version')) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
|
||||
// Check for SequenceGenerator/TableGenerator definition
|
||||
if ($seqGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\SequenceGenerator')) {
|
||||
$metadata->setSequenceGeneratorDefinition(array(
|
||||
'sequenceName' => $seqGeneratorAnnot->sequenceName,
|
||||
'allocationSize' => $seqGeneratorAnnot->allocationSize,
|
||||
'initialValue' => $seqGeneratorAnnot->initialValue
|
||||
));
|
||||
} else if ($this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\TableGenerator')) {
|
||||
throw MappingException::tableIdGeneratorNotImplemented($className);
|
||||
} else if ($customGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\CustomIdGenerator')) {
|
||||
$metadata->setCustomGeneratorDefinition(array(
|
||||
'class' => $customGeneratorAnnot->class
|
||||
));
|
||||
}
|
||||
} else if ($oneToOneAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OneToOne')) {
|
||||
if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
$mapping['targetEntity'] = $oneToOneAnnot->targetEntity;
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
$mapping['mappedBy'] = $oneToOneAnnot->mappedBy;
|
||||
$mapping['inversedBy'] = $oneToOneAnnot->inversedBy;
|
||||
$mapping['cascade'] = $oneToOneAnnot->cascade;
|
||||
$mapping['orphanRemoval'] = $oneToOneAnnot->orphanRemoval;
|
||||
$mapping['fetch'] = $this->getFetchMode($className, $oneToOneAnnot->fetch);
|
||||
$metadata->mapOneToOne($mapping);
|
||||
} else if ($oneToManyAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OneToMany')) {
|
||||
$mapping['mappedBy'] = $oneToManyAnnot->mappedBy;
|
||||
$mapping['targetEntity'] = $oneToManyAnnot->targetEntity;
|
||||
$mapping['cascade'] = $oneToManyAnnot->cascade;
|
||||
$mapping['indexBy'] = $oneToManyAnnot->indexBy;
|
||||
$mapping['orphanRemoval'] = $oneToManyAnnot->orphanRemoval;
|
||||
$mapping['fetch'] = $this->getFetchMode($className, $oneToManyAnnot->fetch);
|
||||
|
||||
if ($orderByAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OrderBy')) {
|
||||
$mapping['orderBy'] = $orderByAnnot->value;
|
||||
}
|
||||
|
||||
$metadata->mapOneToMany($mapping);
|
||||
} else if ($manyToOneAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\ManyToOne')) {
|
||||
if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
$mapping['cascade'] = $manyToOneAnnot->cascade;
|
||||
$mapping['inversedBy'] = $manyToOneAnnot->inversedBy;
|
||||
$mapping['targetEntity'] = $manyToOneAnnot->targetEntity;
|
||||
$mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnot->fetch);
|
||||
$metadata->mapManyToOne($mapping);
|
||||
} else if ($manyToManyAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\ManyToMany')) {
|
||||
$joinTable = array();
|
||||
|
||||
if ($joinTableAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinTable')) {
|
||||
$joinTable = array(
|
||||
'name' => $joinTableAnnot->name,
|
||||
'schema' => $joinTableAnnot->schema
|
||||
);
|
||||
|
||||
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
|
||||
foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinTable'] = $joinTable;
|
||||
$mapping['targetEntity'] = $manyToManyAnnot->targetEntity;
|
||||
$mapping['mappedBy'] = $manyToManyAnnot->mappedBy;
|
||||
$mapping['inversedBy'] = $manyToManyAnnot->inversedBy;
|
||||
$mapping['cascade'] = $manyToManyAnnot->cascade;
|
||||
$mapping['indexBy'] = $manyToManyAnnot->indexBy;
|
||||
$mapping['orphanRemoval'] = $manyToManyAnnot->orphanRemoval;
|
||||
$mapping['fetch'] = $this->getFetchMode($className, $manyToManyAnnot->fetch);
|
||||
|
||||
if ($orderByAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OrderBy')) {
|
||||
$mapping['orderBy'] = $orderByAnnot->value;
|
||||
}
|
||||
|
||||
$metadata->mapManyToMany($mapping);
|
||||
} else if ($embeddedAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Embedded')) {
|
||||
$mapping['class'] = $embeddedAnnot->class;
|
||||
$mapping['columnPrefix'] = $embeddedAnnot->columnPrefix;
|
||||
$metadata->mapEmbedded($mapping);
|
||||
}
|
||||
|
||||
// Evaluate @Cache annotation
|
||||
if (($cacheAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Cache')) !== null) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], array(
|
||||
'usage' => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
|
||||
'region' => $cacheAnnot->region,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate AssociationOverrides annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\AssociationOverrides'])) {
|
||||
$associationOverridesAnnot = $classAnnotations['Doctrine\ORM\Mapping\AssociationOverrides'];
|
||||
|
||||
foreach ($associationOverridesAnnot->value as $associationOverride) {
|
||||
$override = array();
|
||||
$fieldName = $associationOverride->name;
|
||||
|
||||
// Check for JoinColumn/JoinColumns annotations
|
||||
if ($associationOverride->joinColumns) {
|
||||
$joinColumns = array();
|
||||
foreach ($associationOverride->joinColumns as $joinColumn) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
$override['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
// Check for JoinTable annotations
|
||||
if ($associationOverride->joinTable) {
|
||||
$joinTableAnnot = $associationOverride->joinTable;
|
||||
$joinTable = array(
|
||||
'name' => $joinTableAnnot->name,
|
||||
'schema' => $joinTableAnnot->schema
|
||||
);
|
||||
|
||||
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
|
||||
foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
|
||||
$override['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
$metadata->setAssociationOverride($fieldName, $override);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate AttributeOverrides annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\AttributeOverrides'])) {
|
||||
$attributeOverridesAnnot = $classAnnotations['Doctrine\ORM\Mapping\AttributeOverrides'];
|
||||
foreach ($attributeOverridesAnnot->value as $attributeOverrideAnnot) {
|
||||
$attributeOverride = $this->columnToArray($attributeOverrideAnnot->name, $attributeOverrideAnnot->column);
|
||||
$metadata->setAttributeOverride($attributeOverrideAnnot->name, $attributeOverride);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate EntityListeners annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\EntityListeners'])) {
|
||||
$entityListenersAnnot = $classAnnotations['Doctrine\ORM\Mapping\EntityListeners'];
|
||||
|
||||
foreach ($entityListenersAnnot->value as $item) {
|
||||
$listenerClassName = $metadata->fullyQualifiedClassName($item);
|
||||
|
||||
if ( ! class_exists($listenerClassName)) {
|
||||
throw MappingException::entityListenerClassNotFound($listenerClassName, $className);
|
||||
}
|
||||
|
||||
$hasMapping = false;
|
||||
$listenerClass = new \ReflectionClass($listenerClassName);
|
||||
/* @var $method \ReflectionMethod */
|
||||
foreach ($listenerClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
// find method callbacks.
|
||||
$callbacks = $this->getMethodCallbacks($method);
|
||||
$hasMapping = $hasMapping ?: ( ! empty($callbacks));
|
||||
|
||||
foreach ($callbacks as $value) {
|
||||
$metadata->addEntityListener($value[1], $listenerClassName, $value[0]);
|
||||
}
|
||||
}
|
||||
// Evaluate the listener using naming convention.
|
||||
if ( ! $hasMapping ) {
|
||||
EntityListenerBuilder::bindEntityListener($metadata, $listenerClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate @HasLifecycleCallbacks annotation
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\HasLifecycleCallbacks'])) {
|
||||
/* @var $method \ReflectionMethod */
|
||||
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
|
||||
foreach ($this->getMethodCallbacks($method) as $value) {
|
||||
|
||||
$metadata->addLifecycleCallback($value[0], $value[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to resolve the fetch mode.
|
||||
*
|
||||
* @param string $className The class name.
|
||||
* @param string $fetchMode The fetch mode.
|
||||
*
|
||||
* @return integer The fetch mode as defined in ClassMetadata.
|
||||
*
|
||||
* @throws MappingException If the fetch mode is not valid.
|
||||
*/
|
||||
private function getFetchMode($className, $fetchMode)
|
||||
{
|
||||
if( ! defined('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode)) {
|
||||
throw MappingException::invalidFetchMode($className, $fetchMode);
|
||||
}
|
||||
|
||||
return constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given method.
|
||||
*
|
||||
* @param \ReflectionMethod $method
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getMethodCallbacks(\ReflectionMethod $method)
|
||||
{
|
||||
$callbacks = array();
|
||||
$annotations = $this->reader->getMethodAnnotations($method);
|
||||
|
||||
foreach ($annotations as $annot) {
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PrePersist) {
|
||||
$callbacks[] = array($method->name, Events::prePersist);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PostPersist) {
|
||||
$callbacks[] = array($method->name, Events::postPersist);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PreUpdate) {
|
||||
$callbacks[] = array($method->name, Events::preUpdate);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PostUpdate) {
|
||||
$callbacks[] = array($method->name, Events::postUpdate);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PreRemove) {
|
||||
$callbacks[] = array($method->name, Events::preRemove);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PostRemove) {
|
||||
$callbacks[] = array($method->name, Events::postRemove);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PostLoad) {
|
||||
$callbacks[] = array($method->name, Events::postLoad);
|
||||
}
|
||||
|
||||
if ($annot instanceof \Doctrine\ORM\Mapping\PreFlush) {
|
||||
$callbacks[] = array($method->name, Events::preFlush);
|
||||
}
|
||||
}
|
||||
|
||||
return $callbacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given JoinColumn as array
|
||||
*
|
||||
* @param JoinColumn $joinColumn
|
||||
* @return array
|
||||
*/
|
||||
private function joinColumnToArray(JoinColumn $joinColumn)
|
||||
{
|
||||
return array(
|
||||
'name' => $joinColumn->name,
|
||||
'unique' => $joinColumn->unique,
|
||||
'nullable' => $joinColumn->nullable,
|
||||
'onDelete' => $joinColumn->onDelete,
|
||||
'columnDefinition' => $joinColumn->columnDefinition,
|
||||
'referencedColumnName' => $joinColumn->referencedColumnName,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given Column as array
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param Column $column
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function columnToArray($fieldName, Column $column)
|
||||
{
|
||||
$mapping = array(
|
||||
'fieldName' => $fieldName,
|
||||
'type' => $column->type,
|
||||
'scale' => $column->scale,
|
||||
'length' => $column->length,
|
||||
'unique' => $column->unique,
|
||||
'nullable' => $column->nullable,
|
||||
'precision' => $column->precision
|
||||
);
|
||||
|
||||
if ($column->options) {
|
||||
$mapping['options'] = $column->options;
|
||||
}
|
||||
|
||||
if (isset($column->name)) {
|
||||
$mapping['columnName'] = $column->name;
|
||||
}
|
||||
|
||||
if (isset($column->columnDefinition)) {
|
||||
$mapping['columnDefinition'] = $column->columnDefinition;
|
||||
}
|
||||
|
||||
return $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for the Annotation Driver.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param AnnotationReader|null $reader
|
||||
*
|
||||
* @return AnnotationDriver
|
||||
*/
|
||||
static public function create($paths = array(), AnnotationReader $reader = null)
|
||||
{
|
||||
if ($reader == null) {
|
||||
$reader = new AnnotationReader();
|
||||
}
|
||||
|
||||
return new self($reader, $paths);
|
||||
}
|
||||
}
|
||||
555
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
vendored
Normal file
555
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
vendored
Normal file
|
|
@ -0,0 +1,555 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Common\Util\Inflector;
|
||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||
use Doctrine\DBAL\Schema\SchemaException;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
|
||||
/**
|
||||
* The DatabaseDriver reverse engineers the mapping metadata from a database.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class DatabaseDriver implements MappingDriver
|
||||
{
|
||||
/**
|
||||
* @var AbstractSchemaManager
|
||||
*/
|
||||
private $_sm;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
private $tables = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $classToTableNames = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $manyToManyTables = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $classNamesForTables = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $fieldNamesForColumns = array();
|
||||
|
||||
/**
|
||||
* The namespace for the generated entities.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $namespace;
|
||||
|
||||
/**
|
||||
* @param AbstractSchemaManager $schemaManager
|
||||
*/
|
||||
public function __construct(AbstractSchemaManager $schemaManager)
|
||||
{
|
||||
$this->_sm = $schemaManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the namespace for the generated entities.
|
||||
*
|
||||
* @param string $namespace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isTransient($className)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAllClassNames()
|
||||
{
|
||||
$this->reverseEngineerMappingFromDatabase();
|
||||
|
||||
return array_keys($this->classToTableNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class name for a table.
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param string $className
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassNameForTable($tableName, $className)
|
||||
{
|
||||
$this->classNamesForTables[$tableName] = $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field name for a column on a specific table.
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param string $columnName
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setFieldNameForColumn($tableName, $columnName, $fieldName)
|
||||
{
|
||||
$this->fieldNamesForColumns[$tableName][$columnName] = $fieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets tables manually instead of relying on the reverse engineering capabilities of SchemaManager.
|
||||
*
|
||||
* @param array $entityTables
|
||||
* @param array $manyToManyTables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTables($entityTables, $manyToManyTables)
|
||||
{
|
||||
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
|
||||
|
||||
foreach ($entityTables as $table) {
|
||||
$className = $this->getClassNameForTable($table->getName());
|
||||
|
||||
$this->classToTableNames[$className] = $table->getName();
|
||||
$this->tables[$table->getName()] = $table;
|
||||
}
|
||||
|
||||
foreach ($manyToManyTables as $table) {
|
||||
$this->manyToManyTables[$table->getName()] = $table;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
$this->reverseEngineerMappingFromDatabase();
|
||||
|
||||
if ( ! isset($this->classToTableNames[$className])) {
|
||||
throw new \InvalidArgumentException("Unknown class " . $className);
|
||||
}
|
||||
|
||||
$tableName = $this->classToTableNames[$className];
|
||||
|
||||
$metadata->name = $className;
|
||||
$metadata->table['name'] = $tableName;
|
||||
|
||||
$this->buildIndexes($metadata);
|
||||
$this->buildFieldMappings($metadata);
|
||||
$this->buildToOneAssociationMappings($metadata);
|
||||
|
||||
foreach ($this->manyToManyTables as $manyTable) {
|
||||
foreach ($manyTable->getForeignKeys() as $foreignKey) {
|
||||
// foreign key maps to the table of the current entity, many to many association probably exists
|
||||
if ( ! (strtolower($tableName) === strtolower($foreignKey->getForeignTableName()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$myFk = $foreignKey;
|
||||
$otherFk = null;
|
||||
|
||||
foreach ($manyTable->getForeignKeys() as $foreignKey) {
|
||||
if ($foreignKey != $myFk) {
|
||||
$otherFk = $foreignKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $otherFk) {
|
||||
// the definition of this many to many table does not contain
|
||||
// enough foreign key information to continue reverse engineering.
|
||||
continue;
|
||||
}
|
||||
|
||||
$localColumn = current($myFk->getColumns());
|
||||
|
||||
$associationMapping = array();
|
||||
$associationMapping['fieldName'] = $this->getFieldNameForColumn($manyTable->getName(), current($otherFk->getColumns()), true);
|
||||
$associationMapping['targetEntity'] = $this->getClassNameForTable($otherFk->getForeignTableName());
|
||||
|
||||
if (current($manyTable->getColumns())->getName() == $localColumn) {
|
||||
$associationMapping['inversedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
|
||||
$associationMapping['joinTable'] = array(
|
||||
'name' => strtolower($manyTable->getName()),
|
||||
'joinColumns' => array(),
|
||||
'inverseJoinColumns' => array(),
|
||||
);
|
||||
|
||||
$fkCols = $myFk->getForeignColumns();
|
||||
$cols = $myFk->getColumns();
|
||||
|
||||
for ($i = 0; $i < count($cols); $i++) {
|
||||
$associationMapping['joinTable']['joinColumns'][] = array(
|
||||
'name' => $cols[$i],
|
||||
'referencedColumnName' => $fkCols[$i],
|
||||
);
|
||||
}
|
||||
|
||||
$fkCols = $otherFk->getForeignColumns();
|
||||
$cols = $otherFk->getColumns();
|
||||
|
||||
for ($i = 0; $i < count($cols); $i++) {
|
||||
$associationMapping['joinTable']['inverseJoinColumns'][] = array(
|
||||
'name' => $cols[$i],
|
||||
'referencedColumnName' => $fkCols[$i],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$associationMapping['mappedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
|
||||
}
|
||||
|
||||
$metadata->mapManyToMany($associationMapping);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws \Doctrine\ORM\Mapping\MappingException
|
||||
*/
|
||||
private function reverseEngineerMappingFromDatabase()
|
||||
{
|
||||
if ($this->tables !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tables = array();
|
||||
|
||||
foreach ($this->_sm->listTableNames() as $tableName) {
|
||||
$tables[$tableName] = $this->_sm->listTableDetails($tableName);
|
||||
}
|
||||
|
||||
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
|
||||
|
||||
foreach ($tables as $tableName => $table) {
|
||||
$foreignKeys = ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints())
|
||||
? $table->getForeignKeys()
|
||||
: array();
|
||||
|
||||
$allForeignKeyColumns = array();
|
||||
|
||||
foreach ($foreignKeys as $foreignKey) {
|
||||
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
|
||||
}
|
||||
|
||||
if ( ! $table->hasPrimaryKey()) {
|
||||
throw new MappingException(
|
||||
"Table " . $table->getName() . " has no primary key. Doctrine does not ".
|
||||
"support reverse engineering from tables that don't have a primary key."
|
||||
);
|
||||
}
|
||||
|
||||
$pkColumns = $table->getPrimaryKey()->getColumns();
|
||||
|
||||
sort($pkColumns);
|
||||
sort($allForeignKeyColumns);
|
||||
|
||||
if ($pkColumns == $allForeignKeyColumns && count($foreignKeys) == 2) {
|
||||
$this->manyToManyTables[$tableName] = $table;
|
||||
} else {
|
||||
// lower-casing is necessary because of Oracle Uppercase Tablenames,
|
||||
// assumption is lower-case + underscore separated.
|
||||
$className = $this->getClassNameForTable($tableName);
|
||||
|
||||
$this->tables[$tableName] = $table;
|
||||
$this->classToTableNames[$className] = $tableName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build indexes from a class metadata.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
|
||||
*/
|
||||
private function buildIndexes(ClassMetadataInfo $metadata)
|
||||
{
|
||||
$tableName = $metadata->table['name'];
|
||||
$indexes = $this->tables[$tableName]->getIndexes();
|
||||
|
||||
foreach($indexes as $index){
|
||||
if ($index->isPrimary()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$indexName = $index->getName();
|
||||
$indexColumns = $index->getColumns();
|
||||
$constraintType = $index->isUnique()
|
||||
? 'uniqueConstraints'
|
||||
: 'indexes';
|
||||
|
||||
$metadata->table[$constraintType][$indexName]['columns'] = $indexColumns;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build field mapping from class metadata.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
|
||||
*/
|
||||
private function buildFieldMappings(ClassMetadataInfo $metadata)
|
||||
{
|
||||
$tableName = $metadata->table['name'];
|
||||
$columns = $this->tables[$tableName]->getColumns();
|
||||
$primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
|
||||
$foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);
|
||||
$allForeignKeys = array();
|
||||
|
||||
foreach ($foreignKeys as $foreignKey) {
|
||||
$allForeignKeys = array_merge($allForeignKeys, $foreignKey->getLocalColumns());
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
$fieldMappings = array();
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (in_array($column->getName(), $allForeignKeys)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fieldMapping = $this->buildFieldMapping($tableName, $column);
|
||||
|
||||
if ($primaryKeys && in_array($column->getName(), $primaryKeys)) {
|
||||
$fieldMapping['id'] = true;
|
||||
$ids[] = $fieldMapping;
|
||||
}
|
||||
|
||||
$fieldMappings[] = $fieldMapping;
|
||||
}
|
||||
|
||||
// We need to check for the columns here, because we might have associations as id as well.
|
||||
if ($ids && count($primaryKeys) == 1) {
|
||||
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
|
||||
}
|
||||
|
||||
foreach ($fieldMappings as $fieldMapping) {
|
||||
$metadata->mapField($fieldMapping);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build field mapping from a schema column definition
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param \Doctrine\DBAL\Schema\Column $column
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function buildFieldMapping($tableName, Column $column)
|
||||
{
|
||||
$fieldMapping = array(
|
||||
'fieldName' => $this->getFieldNameForColumn($tableName, $column->getName(), false),
|
||||
'columnName' => $column->getName(),
|
||||
'type' => $column->getType()->getName(),
|
||||
'nullable' => ( ! $column->getNotNull()),
|
||||
);
|
||||
|
||||
// Type specific elements
|
||||
switch ($fieldMapping['type']) {
|
||||
case Type::TARRAY:
|
||||
case Type::BLOB:
|
||||
case Type::GUID:
|
||||
case Type::JSON_ARRAY:
|
||||
case Type::OBJECT:
|
||||
case Type::SIMPLE_ARRAY:
|
||||
case Type::STRING:
|
||||
case Type::TEXT:
|
||||
$fieldMapping['length'] = $column->getLength();
|
||||
$fieldMapping['options']['fixed'] = $column->getFixed();
|
||||
break;
|
||||
|
||||
case Type::DECIMAL:
|
||||
case Type::FLOAT:
|
||||
$fieldMapping['precision'] = $column->getPrecision();
|
||||
$fieldMapping['scale'] = $column->getScale();
|
||||
break;
|
||||
|
||||
case Type::INTEGER:
|
||||
case Type::BIGINT:
|
||||
case Type::SMALLINT:
|
||||
$fieldMapping['options']['unsigned'] = $column->getUnsigned();
|
||||
break;
|
||||
}
|
||||
|
||||
// Comment
|
||||
if (($comment = $column->getComment()) !== null) {
|
||||
$fieldMapping['options']['comment'] = $comment;
|
||||
}
|
||||
|
||||
// Default
|
||||
if (($default = $column->getDefault()) !== null) {
|
||||
$fieldMapping['options']['default'] = $default;
|
||||
}
|
||||
|
||||
return $fieldMapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build to one (one to one, many to one) association mapping from class metadata.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
|
||||
*/
|
||||
private function buildToOneAssociationMappings(ClassMetadataInfo $metadata)
|
||||
{
|
||||
$tableName = $metadata->table['name'];
|
||||
$primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
|
||||
$foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);
|
||||
|
||||
foreach ($foreignKeys as $foreignKey) {
|
||||
$foreignTableName = $foreignKey->getForeignTableName();
|
||||
$fkColumns = $foreignKey->getColumns();
|
||||
$fkForeignColumns = $foreignKey->getForeignColumns();
|
||||
$localColumn = current($fkColumns);
|
||||
$associationMapping = array(
|
||||
'fieldName' => $this->getFieldNameForColumn($tableName, $localColumn, true),
|
||||
'targetEntity' => $this->getClassNameForTable($foreignTableName),
|
||||
);
|
||||
|
||||
if (isset($metadata->fieldMappings[$associationMapping['fieldName']])) {
|
||||
$associationMapping['fieldName'] .= '2'; // "foo" => "foo2"
|
||||
}
|
||||
|
||||
if ($primaryKeys && in_array($localColumn, $primaryKeys)) {
|
||||
$associationMapping['id'] = true;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($fkColumns); $i++) {
|
||||
$associationMapping['joinColumns'][] = array(
|
||||
'name' => $fkColumns[$i],
|
||||
'referencedColumnName' => $fkForeignColumns[$i],
|
||||
);
|
||||
}
|
||||
|
||||
// Here we need to check if $fkColumns are the same as $primaryKeys
|
||||
if ( ! array_diff($fkColumns, $primaryKeys)) {
|
||||
$metadata->mapOneToOne($associationMapping);
|
||||
} else {
|
||||
$metadata->mapManyToOne($associationMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive schema table definition foreign keys.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getTableForeignKeys(Table $table)
|
||||
{
|
||||
return ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints())
|
||||
? $table->getForeignKeys()
|
||||
: array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive schema table definition primary keys.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getTablePrimaryKeys(Table $table)
|
||||
{
|
||||
try {
|
||||
return $table->getPrimaryKey()->getColumns();
|
||||
} catch(SchemaException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mapped class name for a table if it exists. Otherwise return "classified" version.
|
||||
*
|
||||
* @param string $tableName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getClassNameForTable($tableName)
|
||||
{
|
||||
if (isset($this->classNamesForTables[$tableName])) {
|
||||
return $this->namespace . $this->classNamesForTables[$tableName];
|
||||
}
|
||||
|
||||
return $this->namespace . Inflector::classify(strtolower($tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mapped field name for a column, if it exists. Otherwise return camelized version.
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param string $columnName
|
||||
* @param boolean $fk Whether the column is a foreignkey or not.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getFieldNameForColumn($tableName, $columnName, $fk = false)
|
||||
{
|
||||
if (isset($this->fieldNamesForColumns[$tableName]) && isset($this->fieldNamesForColumns[$tableName][$columnName])) {
|
||||
return $this->fieldNamesForColumns[$tableName][$columnName];
|
||||
}
|
||||
|
||||
$columnName = strtolower($columnName);
|
||||
|
||||
// Replace _id if it is a foreignkey column
|
||||
if ($fk) {
|
||||
$columnName = str_replace('_id', '', $columnName);
|
||||
}
|
||||
return Inflector::camelize($columnName);
|
||||
}
|
||||
}
|
||||
69
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
vendored
Normal file
69
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/../Annotation.php';
|
||||
require_once __DIR__.'/../Entity.php';
|
||||
require_once __DIR__.'/../Embeddable.php';
|
||||
require_once __DIR__.'/../Embedded.php';
|
||||
require_once __DIR__.'/../MappedSuperclass.php';
|
||||
require_once __DIR__.'/../InheritanceType.php';
|
||||
require_once __DIR__.'/../DiscriminatorColumn.php';
|
||||
require_once __DIR__.'/../DiscriminatorMap.php';
|
||||
require_once __DIR__.'/../Id.php';
|
||||
require_once __DIR__.'/../GeneratedValue.php';
|
||||
require_once __DIR__.'/../Version.php';
|
||||
require_once __DIR__.'/../JoinColumn.php';
|
||||
require_once __DIR__.'/../JoinColumns.php';
|
||||
require_once __DIR__.'/../Column.php';
|
||||
require_once __DIR__.'/../OneToOne.php';
|
||||
require_once __DIR__.'/../OneToMany.php';
|
||||
require_once __DIR__.'/../ManyToOne.php';
|
||||
require_once __DIR__.'/../ManyToMany.php';
|
||||
require_once __DIR__.'/../Table.php';
|
||||
require_once __DIR__.'/../UniqueConstraint.php';
|
||||
require_once __DIR__.'/../Index.php';
|
||||
require_once __DIR__.'/../JoinTable.php';
|
||||
require_once __DIR__.'/../SequenceGenerator.php';
|
||||
require_once __DIR__.'/../CustomIdGenerator.php';
|
||||
require_once __DIR__.'/../ChangeTrackingPolicy.php';
|
||||
require_once __DIR__.'/../OrderBy.php';
|
||||
require_once __DIR__.'/../NamedQueries.php';
|
||||
require_once __DIR__.'/../NamedQuery.php';
|
||||
require_once __DIR__.'/../HasLifecycleCallbacks.php';
|
||||
require_once __DIR__.'/../PrePersist.php';
|
||||
require_once __DIR__.'/../PostPersist.php';
|
||||
require_once __DIR__.'/../PreUpdate.php';
|
||||
require_once __DIR__.'/../PostUpdate.php';
|
||||
require_once __DIR__.'/../PreRemove.php';
|
||||
require_once __DIR__.'/../PostRemove.php';
|
||||
require_once __DIR__.'/../PostLoad.php';
|
||||
require_once __DIR__.'/../PreFlush.php';
|
||||
require_once __DIR__.'/../FieldResult.php';
|
||||
require_once __DIR__.'/../ColumnResult.php';
|
||||
require_once __DIR__.'/../EntityResult.php';
|
||||
require_once __DIR__.'/../NamedNativeQuery.php';
|
||||
require_once __DIR__.'/../NamedNativeQueries.php';
|
||||
require_once __DIR__.'/../SqlResultSetMapping.php';
|
||||
require_once __DIR__.'/../SqlResultSetMappings.php';
|
||||
require_once __DIR__.'/../AssociationOverride.php';
|
||||
require_once __DIR__.'/../AssociationOverrides.php';
|
||||
require_once __DIR__.'/../AttributeOverride.php';
|
||||
require_once __DIR__.'/../AttributeOverrides.php';
|
||||
require_once __DIR__.'/../EntityListeners.php';
|
||||
require_once __DIR__.'/../Cache.php';
|
||||
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php
vendored
Normal file
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DriverChain.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated this driver will be removed. Use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain instead
|
||||
*/
|
||||
class DriverChain extends MappingDriverChain
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php
vendored
Normal file
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\PHPDriver as CommonPHPDriver;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated this driver will be removed. Use Doctrine\Common\Persistence\Mapping\Driver\PHPDriver instead
|
||||
*/
|
||||
class PHPDriver extends CommonPHPDriver
|
||||
{
|
||||
}
|
||||
43
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php
vendored
Normal file
43
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator;
|
||||
|
||||
/**
|
||||
* XmlDriver that additionally looks for mapping information in a global file.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @license MIT
|
||||
*/
|
||||
class SimplifiedXmlDriver extends XmlDriver
|
||||
{
|
||||
const DEFAULT_FILE_EXTENSION = '.orm.xml';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
||||
{
|
||||
$locator = new SymfonyFileLocator((array) $prefixes, $fileExtension);
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
}
|
||||
43
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedYamlDriver.php
vendored
Normal file
43
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedYamlDriver.php
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator;
|
||||
|
||||
/**
|
||||
* YamlDriver that additionally looks for mapping information in a global file.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @license MIT
|
||||
*/
|
||||
class SimplifiedYamlDriver extends YamlDriver
|
||||
{
|
||||
const DEFAULT_FILE_EXTENSION = '.orm.yml';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
||||
{
|
||||
$locator = new SymfonyFileLocator((array) $prefixes, $fileExtension);
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
}
|
||||
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php
vendored
Normal file
31
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/StaticPHPDriver.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver as CommonStaticPHPDriver;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @deprecated this driver will be removed. Use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver instead
|
||||
*/
|
||||
class StaticPHPDriver extends CommonStaticPHPDriver
|
||||
{
|
||||
}
|
||||
848
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
vendored
Normal file
848
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
vendored
Normal file
|
|
@ -0,0 +1,848 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use SimpleXMLElement;
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
|
||||
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
|
||||
/**
|
||||
* XmlDriver is a metadata driver that enables mapping through XML files.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class XmlDriver extends FileDriver
|
||||
{
|
||||
const DEFAULT_FILE_EXTENSION = '.dcm.xml';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
||||
{
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
|
||||
/* @var $xmlRoot SimpleXMLElement */
|
||||
$xmlRoot = $this->getElement($className);
|
||||
|
||||
if ($xmlRoot->getName() == 'entity') {
|
||||
if (isset($xmlRoot['repository-class'])) {
|
||||
$metadata->setCustomRepositoryClass((string)$xmlRoot['repository-class']);
|
||||
}
|
||||
if (isset($xmlRoot['read-only']) && $this->evaluateBoolean($xmlRoot['read-only'])) {
|
||||
$metadata->markReadOnly();
|
||||
}
|
||||
} else if ($xmlRoot->getName() == 'mapped-superclass') {
|
||||
$metadata->setCustomRepositoryClass(
|
||||
isset($xmlRoot['repository-class']) ? (string)$xmlRoot['repository-class'] : null
|
||||
);
|
||||
$metadata->isMappedSuperclass = true;
|
||||
} else if ($xmlRoot->getName() == 'embeddable') {
|
||||
$metadata->isEmbeddedClass = true;
|
||||
} else {
|
||||
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
|
||||
}
|
||||
|
||||
// Evaluate <entity...> attributes
|
||||
$primaryTable = array();
|
||||
|
||||
if (isset($xmlRoot['table'])) {
|
||||
$primaryTable['name'] = (string) $xmlRoot['table'];
|
||||
}
|
||||
|
||||
if (isset($xmlRoot['schema'])) {
|
||||
$primaryTable['schema'] = (string) $xmlRoot['schema'];
|
||||
}
|
||||
|
||||
$metadata->setPrimaryTable($primaryTable);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($xmlRoot->cache)) {
|
||||
$metadata->enableCache($this->cacheToArray($xmlRoot->cache));
|
||||
}
|
||||
|
||||
// Evaluate named queries
|
||||
if (isset($xmlRoot->{'named-queries'})) {
|
||||
foreach ($xmlRoot->{'named-queries'}->{'named-query'} as $namedQueryElement) {
|
||||
$metadata->addNamedQuery(array(
|
||||
'name' => (string)$namedQueryElement['name'],
|
||||
'query' => (string)$namedQueryElement['query']
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate native named queries
|
||||
if (isset($xmlRoot->{'named-native-queries'})) {
|
||||
foreach ($xmlRoot->{'named-native-queries'}->{'named-native-query'} as $nativeQueryElement) {
|
||||
$metadata->addNamedNativeQuery(array(
|
||||
'name' => isset($nativeQueryElement['name']) ? (string)$nativeQueryElement['name'] : null,
|
||||
'query' => isset($nativeQueryElement->query) ? (string)$nativeQueryElement->query : null,
|
||||
'resultClass' => isset($nativeQueryElement['result-class']) ? (string)$nativeQueryElement['result-class'] : null,
|
||||
'resultSetMapping' => isset($nativeQueryElement['result-set-mapping']) ? (string)$nativeQueryElement['result-set-mapping'] : null,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate sql result set mapping
|
||||
if (isset($xmlRoot->{'sql-result-set-mappings'})) {
|
||||
foreach ($xmlRoot->{'sql-result-set-mappings'}->{'sql-result-set-mapping'} as $rsmElement) {
|
||||
$entities = array();
|
||||
$columns = array();
|
||||
foreach ($rsmElement as $entityElement) {
|
||||
//<entity-result/>
|
||||
if (isset($entityElement['entity-class'])) {
|
||||
$entityResult = array(
|
||||
'fields' => array(),
|
||||
'entityClass' => (string)$entityElement['entity-class'],
|
||||
'discriminatorColumn' => isset($entityElement['discriminator-column']) ? (string)$entityElement['discriminator-column'] : null,
|
||||
);
|
||||
|
||||
foreach ($entityElement as $fieldElement) {
|
||||
$entityResult['fields'][] = array(
|
||||
'name' => isset($fieldElement['name']) ? (string)$fieldElement['name'] : null,
|
||||
'column' => isset($fieldElement['column']) ? (string)$fieldElement['column'] : null,
|
||||
);
|
||||
}
|
||||
|
||||
$entities[] = $entityResult;
|
||||
}
|
||||
|
||||
//<column-result/>
|
||||
if (isset($entityElement['name'])) {
|
||||
$columns[] = array(
|
||||
'name' => (string)$entityElement['name'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$metadata->addSqlResultSetMapping(array(
|
||||
'name' => (string)$rsmElement['name'],
|
||||
'entities' => $entities,
|
||||
'columns' => $columns
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($xmlRoot['inheritance-type'])) {
|
||||
$inheritanceType = (string)$xmlRoot['inheritance-type'];
|
||||
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
|
||||
|
||||
if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
|
||||
// Evaluate <discriminator-column...>
|
||||
if (isset($xmlRoot->{'discriminator-column'})) {
|
||||
$discrColumn = $xmlRoot->{'discriminator-column'};
|
||||
$metadata->setDiscriminatorColumn(array(
|
||||
'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null,
|
||||
'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : null,
|
||||
'length' => isset($discrColumn['length']) ? (string)$discrColumn['length'] : null,
|
||||
'columnDefinition' => isset($discrColumn['column-definition']) ? (string)$discrColumn['column-definition'] : null
|
||||
));
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
|
||||
}
|
||||
|
||||
// Evaluate <discriminator-map...>
|
||||
if (isset($xmlRoot->{'discriminator-map'})) {
|
||||
$map = array();
|
||||
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) {
|
||||
$map[(string)$discrMapElement['value']] = (string)$discrMapElement['class'];
|
||||
}
|
||||
$metadata->setDiscriminatorMap($map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate <change-tracking-policy...>
|
||||
if (isset($xmlRoot['change-tracking-policy'])) {
|
||||
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
|
||||
. strtoupper((string)$xmlRoot['change-tracking-policy'])));
|
||||
}
|
||||
|
||||
// Evaluate <indexes...>
|
||||
if (isset($xmlRoot->indexes)) {
|
||||
$metadata->table['indexes'] = array();
|
||||
foreach ($xmlRoot->indexes->index as $indexXml) {
|
||||
$index = array('columns' => explode(',', (string) $indexXml['columns']));
|
||||
|
||||
if (isset($indexXml['flags'])) {
|
||||
$index['flags'] = explode(',', (string) $indexXml['flags']);
|
||||
}
|
||||
|
||||
if (isset($indexXml->options)) {
|
||||
$index['options'] = $this->_parseOptions($indexXml->options->children());
|
||||
}
|
||||
|
||||
if (isset($indexXml['name'])) {
|
||||
$metadata->table['indexes'][(string) $indexXml['name']] = $index;
|
||||
} else {
|
||||
$metadata->table['indexes'][] = $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <unique-constraints..>
|
||||
if (isset($xmlRoot->{'unique-constraints'})) {
|
||||
$metadata->table['uniqueConstraints'] = array();
|
||||
foreach ($xmlRoot->{'unique-constraints'}->{'unique-constraint'} as $uniqueXml) {
|
||||
$unique = array('columns' => explode(',', (string) $uniqueXml['columns']));
|
||||
|
||||
|
||||
if (isset($uniqueXml->options)) {
|
||||
$unique['options'] = $this->_parseOptions($uniqueXml->options->children());
|
||||
}
|
||||
|
||||
if (isset($uniqueXml['name'])) {
|
||||
$metadata->table['uniqueConstraints'][(string)$uniqueXml['name']] = $unique;
|
||||
} else {
|
||||
$metadata->table['uniqueConstraints'][] = $unique;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($xmlRoot->options)) {
|
||||
$metadata->table['options'] = $this->_parseOptions($xmlRoot->options->children());
|
||||
}
|
||||
|
||||
// The mapping assignment is done in 2 times as a bug might occurs on some php/xml lib versions
|
||||
// The internal SimpleXmlIterator get resetted, to this generate a duplicate field exception
|
||||
$mappings = array();
|
||||
// Evaluate <field ...> mappings
|
||||
if (isset($xmlRoot->field)) {
|
||||
foreach ($xmlRoot->field as $fieldMapping) {
|
||||
$mapping = $this->columnToArray($fieldMapping);
|
||||
|
||||
if (isset($mapping['version'])) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
unset($mapping['version']);
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($xmlRoot->embedded)) {
|
||||
foreach ($xmlRoot->embedded as $embeddedMapping) {
|
||||
$columnPrefix = isset($embeddedMapping['column-prefix'])
|
||||
? (string) $embeddedMapping['column-prefix']
|
||||
: null;
|
||||
|
||||
$useColumnPrefix = isset($embeddedMapping['use-column-prefix'])
|
||||
? $this->evaluateBoolean($embeddedMapping['use-column-prefix'])
|
||||
: true;
|
||||
|
||||
$mapping = array(
|
||||
'fieldName' => (string) $embeddedMapping['name'],
|
||||
'class' => (string) $embeddedMapping['class'],
|
||||
'columnPrefix' => $useColumnPrefix ? $columnPrefix : false
|
||||
);
|
||||
|
||||
$metadata->mapEmbedded($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($mappings as $mapping) {
|
||||
if (isset($mapping['version'])) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
}
|
||||
|
||||
// Evaluate <id ...> mappings
|
||||
$associationIds = array();
|
||||
foreach ($xmlRoot->id as $idElement) {
|
||||
if (isset($idElement['association-key']) && $this->evaluateBoolean($idElement['association-key'])) {
|
||||
$associationIds[(string)$idElement['name']] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
$mapping = array(
|
||||
'id' => true,
|
||||
'fieldName' => (string)$idElement['name']
|
||||
);
|
||||
|
||||
if (isset($idElement['type'])) {
|
||||
$mapping['type'] = (string)$idElement['type'];
|
||||
}
|
||||
|
||||
if (isset($idElement['length'])) {
|
||||
$mapping['length'] = (string)$idElement['length'];
|
||||
}
|
||||
|
||||
if (isset($idElement['column'])) {
|
||||
$mapping['columnName'] = (string)$idElement['column'];
|
||||
}
|
||||
|
||||
if (isset($idElement['column-definition'])) {
|
||||
$mapping['columnDefinition'] = (string)$idElement['column-definition'];
|
||||
}
|
||||
|
||||
if (isset($idElement->options)) {
|
||||
$mapping['options'] = $this->_parseOptions($idElement->options->children());
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
|
||||
if (isset($idElement->generator)) {
|
||||
$strategy = isset($idElement->generator['strategy']) ?
|
||||
(string)$idElement->generator['strategy'] : 'AUTO';
|
||||
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
|
||||
. $strategy));
|
||||
}
|
||||
|
||||
// Check for SequenceGenerator/TableGenerator definition
|
||||
if (isset($idElement->{'sequence-generator'})) {
|
||||
$seqGenerator = $idElement->{'sequence-generator'};
|
||||
$metadata->setSequenceGeneratorDefinition(array(
|
||||
'sequenceName' => (string)$seqGenerator['sequence-name'],
|
||||
'allocationSize' => (string)$seqGenerator['allocation-size'],
|
||||
'initialValue' => (string)$seqGenerator['initial-value']
|
||||
));
|
||||
} else if (isset($idElement->{'custom-id-generator'})) {
|
||||
$customGenerator = $idElement->{'custom-id-generator'};
|
||||
$metadata->setCustomGeneratorDefinition(array(
|
||||
'class' => (string) $customGenerator['class']
|
||||
));
|
||||
} else if (isset($idElement->{'table-generator'})) {
|
||||
throw MappingException::tableIdGeneratorNotImplemented($className);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <one-to-one ...> mappings
|
||||
if (isset($xmlRoot->{'one-to-one'})) {
|
||||
foreach ($xmlRoot->{'one-to-one'} as $oneToOneElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => (string)$oneToOneElement['field'],
|
||||
'targetEntity' => (string)$oneToOneElement['target-entity']
|
||||
);
|
||||
|
||||
if (isset($associationIds[$mapping['fieldName']])) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$oneToOneElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['mapped-by'])) {
|
||||
$mapping['mappedBy'] = (string)$oneToOneElement['mapped-by'];
|
||||
} else {
|
||||
if (isset($oneToOneElement['inversed-by'])) {
|
||||
$mapping['inversedBy'] = (string)$oneToOneElement['inversed-by'];
|
||||
}
|
||||
$joinColumns = array();
|
||||
|
||||
if (isset($oneToOneElement->{'join-column'})) {
|
||||
$joinColumns[] = $this->joinColumnToArray($oneToOneElement->{'join-column'});
|
||||
} else if (isset($oneToOneElement->{'join-columns'})) {
|
||||
foreach ($oneToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($oneToOneElement->cascade);
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['orphan-removal'])) {
|
||||
$mapping['orphanRemoval'] = $this->evaluateBoolean($oneToOneElement['orphan-removal']);
|
||||
}
|
||||
|
||||
$metadata->mapOneToOne($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($oneToOneElement->cache)) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToOneElement->cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <one-to-many ...> mappings
|
||||
if (isset($xmlRoot->{'one-to-many'})) {
|
||||
foreach ($xmlRoot->{'one-to-many'} as $oneToManyElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => (string)$oneToManyElement['field'],
|
||||
'targetEntity' => (string)$oneToManyElement['target-entity'],
|
||||
'mappedBy' => (string)$oneToManyElement['mapped-by']
|
||||
);
|
||||
|
||||
if (isset($oneToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$oneToManyElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($oneToManyElement->cascade);
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['orphan-removal'])) {
|
||||
$mapping['orphanRemoval'] = $this->evaluateBoolean($oneToManyElement['orphan-removal']);
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement->{'order-by'})) {
|
||||
$orderBy = array();
|
||||
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
|
||||
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction'];
|
||||
}
|
||||
$mapping['orderBy'] = $orderBy;
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['index-by'])) {
|
||||
$mapping['indexBy'] = (string)$oneToManyElement['index-by'];
|
||||
} else if (isset($oneToManyElement->{'index-by'})) {
|
||||
throw new \InvalidArgumentException("<index-by /> is not a valid tag");
|
||||
}
|
||||
|
||||
$metadata->mapOneToMany($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($oneToManyElement->cache)) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToManyElement->cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <many-to-one ...> mappings
|
||||
if (isset($xmlRoot->{'many-to-one'})) {
|
||||
foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => (string)$manyToOneElement['field'],
|
||||
'targetEntity' => (string)$manyToOneElement['target-entity']
|
||||
);
|
||||
|
||||
if (isset($associationIds[$mapping['fieldName']])) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
if (isset($manyToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$manyToOneElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($manyToOneElement['inversed-by'])) {
|
||||
$mapping['inversedBy'] = (string)$manyToOneElement['inversed-by'];
|
||||
}
|
||||
|
||||
$joinColumns = array();
|
||||
|
||||
if (isset($manyToOneElement->{'join-column'})) {
|
||||
$joinColumns[] = $this->joinColumnToArray($manyToOneElement->{'join-column'});
|
||||
} else if (isset($manyToOneElement->{'join-columns'})) {
|
||||
foreach ($manyToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
|
||||
if (isset($manyToOneElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($manyToOneElement->cascade);
|
||||
}
|
||||
|
||||
$metadata->mapManyToOne($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($manyToOneElement->cache)) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToOneElement->cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <many-to-many ...> mappings
|
||||
if (isset($xmlRoot->{'many-to-many'})) {
|
||||
foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => (string)$manyToManyElement['field'],
|
||||
'targetEntity' => (string)$manyToManyElement['target-entity']
|
||||
);
|
||||
|
||||
if (isset($manyToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$manyToManyElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['orphan-removal'])) {
|
||||
$mapping['orphanRemoval'] = $this->evaluateBoolean($manyToManyElement['orphan-removal']);
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['mapped-by'])) {
|
||||
$mapping['mappedBy'] = (string)$manyToManyElement['mapped-by'];
|
||||
} else if (isset($manyToManyElement->{'join-table'})) {
|
||||
if (isset($manyToManyElement['inversed-by'])) {
|
||||
$mapping['inversedBy'] = (string)$manyToManyElement['inversed-by'];
|
||||
}
|
||||
|
||||
$joinTableElement = $manyToManyElement->{'join-table'};
|
||||
$joinTable = array(
|
||||
'name' => (string)$joinTableElement['name']
|
||||
);
|
||||
|
||||
if (isset($joinTableElement['schema'])) {
|
||||
$joinTable['schema'] = (string)$joinTableElement['schema'];
|
||||
}
|
||||
|
||||
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
|
||||
foreach ($joinTableElement->{'inverse-join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
|
||||
$mapping['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($manyToManyElement->cascade);
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement->{'order-by'})) {
|
||||
$orderBy = array();
|
||||
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
|
||||
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction'];
|
||||
}
|
||||
$mapping['orderBy'] = $orderBy;
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['index-by'])) {
|
||||
$mapping['indexBy'] = (string)$manyToManyElement['index-by'];
|
||||
} else if (isset($manyToManyElement->{'index-by'})) {
|
||||
throw new \InvalidArgumentException("<index-by /> is not a valid tag");
|
||||
}
|
||||
|
||||
$metadata->mapManyToMany($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($manyToManyElement->cache)) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToManyElement->cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate association-overrides
|
||||
if (isset($xmlRoot->{'attribute-overrides'})) {
|
||||
foreach ($xmlRoot->{'attribute-overrides'}->{'attribute-override'} as $overrideElement) {
|
||||
$fieldName = (string) $overrideElement['name'];
|
||||
foreach ($overrideElement->field as $field) {
|
||||
$mapping = $this->columnToArray($field);
|
||||
$mapping['fieldName'] = $fieldName;
|
||||
$metadata->setAttributeOverride($fieldName, $mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate association-overrides
|
||||
if (isset($xmlRoot->{'association-overrides'})) {
|
||||
foreach ($xmlRoot->{'association-overrides'}->{'association-override'} as $overrideElement) {
|
||||
$fieldName = (string) $overrideElement['name'];
|
||||
$override = array();
|
||||
|
||||
// Check for join-columns
|
||||
if (isset($overrideElement->{'join-columns'})) {
|
||||
$joinColumns = array();
|
||||
foreach ($overrideElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
$override['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
// Check for join-table
|
||||
if ($overrideElement->{'join-table'}) {
|
||||
$joinTable = null;
|
||||
$joinTableElement = $overrideElement->{'join-table'};
|
||||
|
||||
$joinTable = array(
|
||||
'name' => (string) $joinTableElement['name'],
|
||||
'schema' => (string) $joinTableElement['schema']
|
||||
);
|
||||
|
||||
if (isset($joinTableElement->{'join-columns'})) {
|
||||
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($joinTableElement->{'inverse-join-columns'})) {
|
||||
foreach ($joinTableElement->{'inverse-join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$override['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
$metadata->setAssociationOverride($fieldName, $override);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate <lifecycle-callbacks...>
|
||||
if (isset($xmlRoot->{'lifecycle-callbacks'})) {
|
||||
foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
|
||||
$metadata->addLifecycleCallback((string)$lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string)$lifecycleCallback['type']));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate entity listener
|
||||
if (isset($xmlRoot->{'entity-listeners'})) {
|
||||
foreach ($xmlRoot->{'entity-listeners'}->{'entity-listener'} as $listenerElement) {
|
||||
$className = (string) $listenerElement['class'];
|
||||
// Evaluate the listener using naming convention.
|
||||
if($listenerElement->count() === 0) {
|
||||
EntityListenerBuilder::bindEntityListener($metadata, $className);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($listenerElement as $callbackElement) {
|
||||
$eventName = (string) $callbackElement['type'];
|
||||
$methodName = (string) $callbackElement['method'];
|
||||
|
||||
$metadata->addEntityListener($eventName, $className, $methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses (nested) option elements.
|
||||
*
|
||||
* @param SimpleXMLElement $options The XML element.
|
||||
*
|
||||
* @return array The options array.
|
||||
*/
|
||||
private function _parseOptions(SimpleXMLElement $options)
|
||||
{
|
||||
$array = array();
|
||||
|
||||
/* @var $option SimpleXMLElement */
|
||||
foreach ($options as $option) {
|
||||
if ($option->count()) {
|
||||
$value = $this->_parseOptions($option->children());
|
||||
} else {
|
||||
$value = (string) $option;
|
||||
}
|
||||
|
||||
$attr = $option->attributes();
|
||||
|
||||
if (isset($attr->name)) {
|
||||
$array[(string) $attr->name] = $value;
|
||||
} else {
|
||||
$array[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a joinColumn mapping array based on the information
|
||||
* found in the given SimpleXMLElement.
|
||||
*
|
||||
* @param SimpleXMLElement $joinColumnElement The XML element.
|
||||
*
|
||||
* @return array The mapping array.
|
||||
*/
|
||||
private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
|
||||
{
|
||||
$joinColumn = array(
|
||||
'name' => (string)$joinColumnElement['name'],
|
||||
'referencedColumnName' => (string)$joinColumnElement['referenced-column-name']
|
||||
);
|
||||
|
||||
if (isset($joinColumnElement['unique'])) {
|
||||
$joinColumn['unique'] = $this->evaluateBoolean($joinColumnElement['unique']);
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['nullable'])) {
|
||||
$joinColumn['nullable'] = $this->evaluateBoolean($joinColumnElement['nullable']);
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['on-delete'])) {
|
||||
$joinColumn['onDelete'] = (string)$joinColumnElement['on-delete'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['column-definition'])) {
|
||||
$joinColumn['columnDefinition'] = (string)$joinColumnElement['column-definition'];
|
||||
}
|
||||
|
||||
return $joinColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given field as array.
|
||||
*
|
||||
* @param SimpleXMLElement $fieldMapping
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function columnToArray(SimpleXMLElement $fieldMapping)
|
||||
{
|
||||
$mapping = array(
|
||||
'fieldName' => (string) $fieldMapping['name'],
|
||||
);
|
||||
|
||||
if (isset($fieldMapping['type'])) {
|
||||
$mapping['type'] = (string) $fieldMapping['type'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['column'])) {
|
||||
$mapping['columnName'] = (string) $fieldMapping['column'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['length'])) {
|
||||
$mapping['length'] = (int) $fieldMapping['length'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['precision'])) {
|
||||
$mapping['precision'] = (int) $fieldMapping['precision'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['scale'])) {
|
||||
$mapping['scale'] = (int) $fieldMapping['scale'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['unique'])) {
|
||||
$mapping['unique'] = $this->evaluateBoolean($fieldMapping['unique']);
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['nullable'])) {
|
||||
$mapping['nullable'] = $this->evaluateBoolean($fieldMapping['nullable']);
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['version']) && $fieldMapping['version']) {
|
||||
$mapping['version'] = $this->evaluateBoolean($fieldMapping['version']);
|
||||
}
|
||||
|
||||
if (isset($fieldMapping['column-definition'])) {
|
||||
$mapping['columnDefinition'] = (string) $fieldMapping['column-definition'];
|
||||
}
|
||||
|
||||
if (isset($fieldMapping->options)) {
|
||||
$mapping['options'] = $this->_parseOptions($fieldMapping->options->children());
|
||||
}
|
||||
|
||||
return $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse / Normalize the cache configuration
|
||||
*
|
||||
* @param SimpleXMLElement $cacheMapping
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function cacheToArray(SimpleXMLElement $cacheMapping)
|
||||
{
|
||||
$region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
|
||||
$usage = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
|
||||
|
||||
if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
|
||||
}
|
||||
|
||||
if ($usage) {
|
||||
$usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
|
||||
}
|
||||
|
||||
return array(
|
||||
'usage' => $usage,
|
||||
'region' => $region,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers a list of cascade options found in the given cascade element.
|
||||
*
|
||||
* @param SimpleXMLElement $cascadeElement The cascade element.
|
||||
*
|
||||
* @return array The list of cascade options.
|
||||
*/
|
||||
private function _getCascadeMappings(SimpleXMLElement $cascadeElement)
|
||||
{
|
||||
$cascades = array();
|
||||
/* @var $action SimpleXmlElement */
|
||||
foreach ($cascadeElement->children() as $action) {
|
||||
// According to the JPA specifications, XML uses "cascade-persist"
|
||||
// instead of "persist". Here, both variations
|
||||
// are supported because both YAML and Annotation use "persist"
|
||||
// and we want to make sure that this driver doesn't need to know
|
||||
// anything about the supported cascading actions
|
||||
$cascades[] = str_replace('cascade-', '', $action->getName());
|
||||
}
|
||||
return $cascades;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function loadMappingFile($file)
|
||||
{
|
||||
$result = array();
|
||||
// Note: we do not use `simplexml_load_file()` because of https://bugs.php.net/bug.php?id=62577
|
||||
$xmlElement = simplexml_load_string(file_get_contents($file));
|
||||
|
||||
if (isset($xmlElement->entity)) {
|
||||
foreach ($xmlElement->entity as $entityElement) {
|
||||
$entityName = (string)$entityElement['name'];
|
||||
$result[$entityName] = $entityElement;
|
||||
}
|
||||
} else if (isset($xmlElement->{'mapped-superclass'})) {
|
||||
foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) {
|
||||
$className = (string)$mappedSuperClass['name'];
|
||||
$result[$className] = $mappedSuperClass;
|
||||
}
|
||||
} else if (isset($xmlElement->embeddable)) {
|
||||
foreach ($xmlElement->embeddable as $embeddableElement) {
|
||||
$embeddableName = (string) $embeddableElement['name'];
|
||||
$result[$embeddableName] = $embeddableElement;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function evaluateBoolean($element)
|
||||
{
|
||||
$flag = (string)$element;
|
||||
|
||||
return ($flag == "true" || $flag == "1");
|
||||
}
|
||||
}
|
||||
790
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
vendored
Normal file
790
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
vendored
Normal file
|
|
@ -0,0 +1,790 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Driver;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* The YamlDriver reads the mapping metadata from yaml schema files.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class YamlDriver extends FileDriver
|
||||
{
|
||||
const DEFAULT_FILE_EXTENSION = '.dcm.yml';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
||||
{
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
|
||||
$element = $this->getElement($className);
|
||||
|
||||
if ($element['type'] == 'entity') {
|
||||
if (isset($element['repositoryClass'])) {
|
||||
$metadata->setCustomRepositoryClass($element['repositoryClass']);
|
||||
}
|
||||
if (isset($element['readOnly']) && $element['readOnly'] == true) {
|
||||
$metadata->markReadOnly();
|
||||
}
|
||||
} else if ($element['type'] == 'mappedSuperclass') {
|
||||
$metadata->setCustomRepositoryClass(
|
||||
isset($element['repositoryClass']) ? $element['repositoryClass'] : null
|
||||
);
|
||||
$metadata->isMappedSuperclass = true;
|
||||
} else if ($element['type'] == 'embeddable') {
|
||||
$metadata->isEmbeddedClass = true;
|
||||
} else {
|
||||
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
|
||||
}
|
||||
|
||||
// Evaluate root level properties
|
||||
$primaryTable = array();
|
||||
|
||||
if (isset($element['table'])) {
|
||||
$primaryTable['name'] = $element['table'];
|
||||
}
|
||||
|
||||
if (isset($element['schema'])) {
|
||||
$primaryTable['schema'] = $element['schema'];
|
||||
}
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($element['cache'])) {
|
||||
$metadata->enableCache($this->cacheToArray($element['cache']));
|
||||
}
|
||||
|
||||
$metadata->setPrimaryTable($primaryTable);
|
||||
|
||||
// Evaluate named queries
|
||||
if (isset($element['namedQueries'])) {
|
||||
foreach ($element['namedQueries'] as $name => $queryMapping) {
|
||||
if (is_string($queryMapping)) {
|
||||
$queryMapping = array('query' => $queryMapping);
|
||||
}
|
||||
|
||||
if ( ! isset($queryMapping['name'])) {
|
||||
$queryMapping['name'] = $name;
|
||||
}
|
||||
|
||||
$metadata->addNamedQuery($queryMapping);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate named native queries
|
||||
if (isset($element['namedNativeQueries'])) {
|
||||
foreach ($element['namedNativeQueries'] as $name => $mappingElement) {
|
||||
if (!isset($mappingElement['name'])) {
|
||||
$mappingElement['name'] = $name;
|
||||
}
|
||||
$metadata->addNamedNativeQuery(array(
|
||||
'name' => $mappingElement['name'],
|
||||
'query' => isset($mappingElement['query']) ? $mappingElement['query'] : null,
|
||||
'resultClass' => isset($mappingElement['resultClass']) ? $mappingElement['resultClass'] : null,
|
||||
'resultSetMapping' => isset($mappingElement['resultSetMapping']) ? $mappingElement['resultSetMapping'] : null,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate sql result set mappings
|
||||
if (isset($element['sqlResultSetMappings'])) {
|
||||
foreach ($element['sqlResultSetMappings'] as $name => $resultSetMapping) {
|
||||
if (!isset($resultSetMapping['name'])) {
|
||||
$resultSetMapping['name'] = $name;
|
||||
}
|
||||
|
||||
$entities = array();
|
||||
$columns = array();
|
||||
if (isset($resultSetMapping['entityResult'])) {
|
||||
foreach ($resultSetMapping['entityResult'] as $entityResultElement) {
|
||||
$entityResult = array(
|
||||
'fields' => array(),
|
||||
'entityClass' => isset($entityResultElement['entityClass']) ? $entityResultElement['entityClass'] : null,
|
||||
'discriminatorColumn' => isset($entityResultElement['discriminatorColumn']) ? $entityResultElement['discriminatorColumn'] : null,
|
||||
);
|
||||
|
||||
if (isset($entityResultElement['fieldResult'])) {
|
||||
foreach ($entityResultElement['fieldResult'] as $fieldResultElement) {
|
||||
$entityResult['fields'][] = array(
|
||||
'name' => isset($fieldResultElement['name']) ? $fieldResultElement['name'] : null,
|
||||
'column' => isset($fieldResultElement['column']) ? $fieldResultElement['column'] : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$entities[] = $entityResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($resultSetMapping['columnResult'])) {
|
||||
foreach ($resultSetMapping['columnResult'] as $columnResultAnnot) {
|
||||
$columns[] = array(
|
||||
'name' => isset($columnResultAnnot['name']) ? $columnResultAnnot['name'] : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$metadata->addSqlResultSetMapping(array(
|
||||
'name' => $resultSetMapping['name'],
|
||||
'entities' => $entities,
|
||||
'columns' => $columns
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['inheritanceType'])) {
|
||||
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . strtoupper($element['inheritanceType'])));
|
||||
|
||||
if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
|
||||
// Evaluate discriminatorColumn
|
||||
if (isset($element['discriminatorColumn'])) {
|
||||
$discrColumn = $element['discriminatorColumn'];
|
||||
$metadata->setDiscriminatorColumn(array(
|
||||
'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null,
|
||||
'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : null,
|
||||
'length' => isset($discrColumn['length']) ? (string)$discrColumn['length'] : null,
|
||||
'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string)$discrColumn['columnDefinition'] : null
|
||||
));
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
|
||||
}
|
||||
|
||||
// Evaluate discriminatorMap
|
||||
if (isset($element['discriminatorMap'])) {
|
||||
$metadata->setDiscriminatorMap($element['discriminatorMap']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate changeTrackingPolicy
|
||||
if (isset($element['changeTrackingPolicy'])) {
|
||||
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
|
||||
. strtoupper($element['changeTrackingPolicy'])));
|
||||
}
|
||||
|
||||
// Evaluate indexes
|
||||
if (isset($element['indexes'])) {
|
||||
foreach ($element['indexes'] as $name => $indexYml) {
|
||||
if ( ! isset($indexYml['name'])) {
|
||||
$indexYml['name'] = $name;
|
||||
}
|
||||
|
||||
if (is_string($indexYml['columns'])) {
|
||||
$index = array('columns' => array_map('trim', explode(',', $indexYml['columns'])));
|
||||
} else {
|
||||
$index = array('columns' => $indexYml['columns']);
|
||||
}
|
||||
|
||||
if (isset($indexYml['flags'])) {
|
||||
if (is_string($indexYml['flags'])) {
|
||||
$index['flags'] = array_map('trim', explode(',', $indexYml['flags']));
|
||||
} else {
|
||||
$index['flags'] = $indexYml['flags'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($indexYml['options'])) {
|
||||
$index['options'] = $indexYml['options'];
|
||||
}
|
||||
|
||||
$metadata->table['indexes'][$indexYml['name']] = $index;
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate uniqueConstraints
|
||||
if (isset($element['uniqueConstraints'])) {
|
||||
foreach ($element['uniqueConstraints'] as $name => $uniqueYml) {
|
||||
if ( ! isset($uniqueYml['name'])) {
|
||||
$uniqueYml['name'] = $name;
|
||||
}
|
||||
|
||||
if (is_string($uniqueYml['columns'])) {
|
||||
$unique = array('columns' => array_map('trim', explode(',', $uniqueYml['columns'])));
|
||||
} else {
|
||||
$unique = array('columns' => $uniqueYml['columns']);
|
||||
}
|
||||
|
||||
if (isset($uniqueYml['options'])) {
|
||||
$unique['options'] = $uniqueYml['options'];
|
||||
}
|
||||
|
||||
$metadata->table['uniqueConstraints'][$uniqueYml['name']] = $unique;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['options'])) {
|
||||
$metadata->table['options'] = $element['options'];
|
||||
}
|
||||
|
||||
$associationIds = array();
|
||||
if (isset($element['id'])) {
|
||||
// Evaluate identifier settings
|
||||
foreach ($element['id'] as $name => $idElement) {
|
||||
if (isset($idElement['associationKey']) && $idElement['associationKey'] == true) {
|
||||
$associationIds[$name] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
$mapping = array(
|
||||
'id' => true,
|
||||
'fieldName' => $name
|
||||
);
|
||||
|
||||
if (isset($idElement['type'])) {
|
||||
$mapping['type'] = $idElement['type'];
|
||||
}
|
||||
|
||||
if (isset($idElement['column'])) {
|
||||
$mapping['columnName'] = $idElement['column'];
|
||||
}
|
||||
|
||||
if (isset($idElement['length'])) {
|
||||
$mapping['length'] = $idElement['length'];
|
||||
}
|
||||
|
||||
if (isset($idElement['columnDefinition'])) {
|
||||
$mapping['columnDefinition'] = $idElement['columnDefinition'];
|
||||
}
|
||||
|
||||
if (isset($idElement['options'])) {
|
||||
$mapping['options'] = $idElement['options'];
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
|
||||
if (isset($idElement['generator'])) {
|
||||
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
|
||||
. strtoupper($idElement['generator']['strategy'])));
|
||||
}
|
||||
// Check for SequenceGenerator/TableGenerator definition
|
||||
if (isset($idElement['sequenceGenerator'])) {
|
||||
$metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']);
|
||||
} else if (isset($idElement['customIdGenerator'])) {
|
||||
$customGenerator = $idElement['customIdGenerator'];
|
||||
$metadata->setCustomGeneratorDefinition(array(
|
||||
'class' => (string) $customGenerator['class']
|
||||
));
|
||||
} else if (isset($idElement['tableGenerator'])) {
|
||||
throw MappingException::tableIdGeneratorNotImplemented($className);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate fields
|
||||
if (isset($element['fields'])) {
|
||||
foreach ($element['fields'] as $name => $fieldMapping) {
|
||||
|
||||
$mapping = $this->columnToArray($name, $fieldMapping);
|
||||
|
||||
if (isset($fieldMapping['id'])) {
|
||||
$mapping['id'] = true;
|
||||
if (isset($fieldMapping['generator']['strategy'])) {
|
||||
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
|
||||
. strtoupper($fieldMapping['generator']['strategy'])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($mapping['version'])) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
unset($mapping['version']);
|
||||
}
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['embedded'])) {
|
||||
foreach ($element['embedded'] as $name => $embeddedMapping) {
|
||||
$mapping = array(
|
||||
'fieldName' => $name,
|
||||
'class' => $embeddedMapping['class'],
|
||||
'columnPrefix' => isset($embeddedMapping['columnPrefix']) ? $embeddedMapping['columnPrefix'] : null,
|
||||
);
|
||||
$metadata->mapEmbedded($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate oneToOne relationships
|
||||
if (isset($element['oneToOne'])) {
|
||||
foreach ($element['oneToOne'] as $name => $oneToOneElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $oneToOneElement['targetEntity']
|
||||
);
|
||||
|
||||
if (isset($associationIds[$mapping['fieldName']])) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToOneElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['mappedBy'])) {
|
||||
$mapping['mappedBy'] = $oneToOneElement['mappedBy'];
|
||||
} else {
|
||||
if (isset($oneToOneElement['inversedBy'])) {
|
||||
$mapping['inversedBy'] = $oneToOneElement['inversedBy'];
|
||||
}
|
||||
|
||||
$joinColumns = array();
|
||||
|
||||
if (isset($oneToOneElement['joinColumn'])) {
|
||||
$joinColumns[] = $this->joinColumnToArray($oneToOneElement['joinColumn']);
|
||||
} else if (isset($oneToOneElement['joinColumns'])) {
|
||||
foreach ($oneToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $joinColumnName;
|
||||
}
|
||||
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['cascade'])) {
|
||||
$mapping['cascade'] = $oneToOneElement['cascade'];
|
||||
}
|
||||
|
||||
if (isset($oneToOneElement['orphanRemoval'])) {
|
||||
$mapping['orphanRemoval'] = (bool)$oneToOneElement['orphanRemoval'];
|
||||
}
|
||||
|
||||
$metadata->mapOneToOne($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($oneToOneElement['cache'])) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToOneElement['cache']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate oneToMany relationships
|
||||
if (isset($element['oneToMany'])) {
|
||||
foreach ($element['oneToMany'] as $name => $oneToManyElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $oneToManyElement['targetEntity'],
|
||||
'mappedBy' => $oneToManyElement['mappedBy']
|
||||
);
|
||||
|
||||
if (isset($oneToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToManyElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['cascade'])) {
|
||||
$mapping['cascade'] = $oneToManyElement['cascade'];
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['orphanRemoval'])) {
|
||||
$mapping['orphanRemoval'] = (bool)$oneToManyElement['orphanRemoval'];
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['orderBy'])) {
|
||||
$mapping['orderBy'] = $oneToManyElement['orderBy'];
|
||||
}
|
||||
|
||||
if (isset($oneToManyElement['indexBy'])) {
|
||||
$mapping['indexBy'] = $oneToManyElement['indexBy'];
|
||||
}
|
||||
|
||||
$metadata->mapOneToMany($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($oneToManyElement['cache'])) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToManyElement['cache']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate manyToOne relationships
|
||||
if (isset($element['manyToOne'])) {
|
||||
foreach ($element['manyToOne'] as $name => $manyToOneElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $manyToOneElement['targetEntity']
|
||||
);
|
||||
|
||||
if (isset($associationIds[$mapping['fieldName']])) {
|
||||
$mapping['id'] = true;
|
||||
}
|
||||
|
||||
if (isset($manyToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToOneElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($manyToOneElement['inversedBy'])) {
|
||||
$mapping['inversedBy'] = $manyToOneElement['inversedBy'];
|
||||
}
|
||||
|
||||
$joinColumns = array();
|
||||
|
||||
if (isset($manyToOneElement['joinColumn'])) {
|
||||
$joinColumns[] = $this->joinColumnToArray($manyToOneElement['joinColumn']);
|
||||
} else if (isset($manyToOneElement['joinColumns'])) {
|
||||
foreach ($manyToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $joinColumnName;
|
||||
}
|
||||
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
|
||||
if (isset($manyToOneElement['cascade'])) {
|
||||
$mapping['cascade'] = $manyToOneElement['cascade'];
|
||||
}
|
||||
|
||||
$metadata->mapManyToOne($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($manyToOneElement['cache'])) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToOneElement['cache']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate manyToMany relationships
|
||||
if (isset($element['manyToMany'])) {
|
||||
foreach ($element['manyToMany'] as $name => $manyToManyElement) {
|
||||
$mapping = array(
|
||||
'fieldName' => $name,
|
||||
'targetEntity' => $manyToManyElement['targetEntity']
|
||||
);
|
||||
|
||||
if (isset($manyToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToManyElement['fetch']);
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['mappedBy'])) {
|
||||
$mapping['mappedBy'] = $manyToManyElement['mappedBy'];
|
||||
} else if (isset($manyToManyElement['joinTable'])) {
|
||||
|
||||
$joinTableElement = $manyToManyElement['joinTable'];
|
||||
$joinTable = array(
|
||||
'name' => $joinTableElement['name']
|
||||
);
|
||||
|
||||
if (isset($joinTableElement['schema'])) {
|
||||
$joinTable['schema'] = $joinTableElement['schema'];
|
||||
}
|
||||
|
||||
if (isset($joinTableElement['joinColumns'])) {
|
||||
foreach ($joinTableElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $joinColumnName;
|
||||
}
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($joinTableElement['inverseJoinColumns'])) {
|
||||
foreach ($joinTableElement['inverseJoinColumns'] as $joinColumnName => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $joinColumnName;
|
||||
}
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
$mapping['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['inversedBy'])) {
|
||||
$mapping['inversedBy'] = $manyToManyElement['inversedBy'];
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['cascade'])) {
|
||||
$mapping['cascade'] = $manyToManyElement['cascade'];
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['orderBy'])) {
|
||||
$mapping['orderBy'] = $manyToManyElement['orderBy'];
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['indexBy'])) {
|
||||
$mapping['indexBy'] = $manyToManyElement['indexBy'];
|
||||
}
|
||||
|
||||
if (isset($manyToManyElement['orphanRemoval'])) {
|
||||
$mapping['orphanRemoval'] = (bool)$manyToManyElement['orphanRemoval'];
|
||||
}
|
||||
|
||||
$metadata->mapManyToMany($mapping);
|
||||
|
||||
// Evaluate second level cache
|
||||
if (isset($manyToManyElement['cache'])) {
|
||||
$metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToManyElement['cache']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate associationOverride
|
||||
if (isset($element['associationOverride']) && is_array($element['associationOverride'])) {
|
||||
|
||||
foreach ($element['associationOverride'] as $fieldName => $associationOverrideElement) {
|
||||
$override = array();
|
||||
|
||||
// Check for joinColumn
|
||||
if (isset($associationOverrideElement['joinColumn'])) {
|
||||
$joinColumns = array();
|
||||
foreach ($associationOverrideElement['joinColumn'] as $name => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $name;
|
||||
}
|
||||
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
$override['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
// Check for joinTable
|
||||
if (isset($associationOverrideElement['joinTable'])) {
|
||||
|
||||
$joinTableElement = $associationOverrideElement['joinTable'];
|
||||
$joinTable = array(
|
||||
'name' => $joinTableElement['name']
|
||||
);
|
||||
|
||||
if (isset($joinTableElement['schema'])) {
|
||||
$joinTable['schema'] = $joinTableElement['schema'];
|
||||
}
|
||||
|
||||
foreach ($joinTableElement['joinColumns'] as $name => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $name;
|
||||
}
|
||||
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
|
||||
foreach ($joinTableElement['inverseJoinColumns'] as $name => $joinColumnElement) {
|
||||
if ( ! isset($joinColumnElement['name'])) {
|
||||
$joinColumnElement['name'] = $name;
|
||||
}
|
||||
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
||||
}
|
||||
|
||||
$override['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
$metadata->setAssociationOverride($fieldName, $override);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate associationOverride
|
||||
if (isset($element['attributeOverride']) && is_array($element['attributeOverride'])) {
|
||||
|
||||
foreach ($element['attributeOverride'] as $fieldName => $attributeOverrideElement) {
|
||||
$mapping = $this->columnToArray($fieldName, $attributeOverrideElement);
|
||||
$metadata->setAttributeOverride($fieldName, $mapping);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate lifeCycleCallbacks
|
||||
if (isset($element['lifecycleCallbacks'])) {
|
||||
foreach ($element['lifecycleCallbacks'] as $type => $methods) {
|
||||
foreach ($methods as $method) {
|
||||
$metadata->addLifecycleCallback($method, constant('Doctrine\ORM\Events::' . $type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate entityListeners
|
||||
if (isset($element['entityListeners'])) {
|
||||
foreach ($element['entityListeners'] as $className => $entityListener) {
|
||||
// Evaluate the listener using naming convention.
|
||||
if (empty($entityListener)) {
|
||||
EntityListenerBuilder::bindEntityListener($metadata, $className);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($entityListener as $eventName => $callbackElement){
|
||||
foreach ($callbackElement as $methodName) {
|
||||
$metadata->addEntityListener($eventName, $className, $methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a joinColumn mapping array based on the information
|
||||
* found in the given join column element.
|
||||
*
|
||||
* @param array $joinColumnElement The array join column element.
|
||||
*
|
||||
* @return array The mapping array.
|
||||
*/
|
||||
private function joinColumnToArray($joinColumnElement)
|
||||
{
|
||||
$joinColumn = array();
|
||||
if (isset($joinColumnElement['referencedColumnName'])) {
|
||||
$joinColumn['referencedColumnName'] = (string) $joinColumnElement['referencedColumnName'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['name'])) {
|
||||
$joinColumn['name'] = (string) $joinColumnElement['name'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['fieldName'])) {
|
||||
$joinColumn['fieldName'] = (string) $joinColumnElement['fieldName'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['unique'])) {
|
||||
$joinColumn['unique'] = (bool) $joinColumnElement['unique'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['nullable'])) {
|
||||
$joinColumn['nullable'] = (bool) $joinColumnElement['nullable'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['onDelete'])) {
|
||||
$joinColumn['onDelete'] = $joinColumnElement['onDelete'];
|
||||
}
|
||||
|
||||
if (isset($joinColumnElement['columnDefinition'])) {
|
||||
$joinColumn['columnDefinition'] = $joinColumnElement['columnDefinition'];
|
||||
}
|
||||
|
||||
return $joinColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given column as array.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param array $column
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function columnToArray($fieldName, $column)
|
||||
{
|
||||
$mapping = array(
|
||||
'fieldName' => $fieldName
|
||||
);
|
||||
|
||||
if (isset($column['type'])) {
|
||||
$params = explode('(', $column['type']);
|
||||
$column['type'] = $params[0];
|
||||
$mapping['type'] = $column['type'];
|
||||
|
||||
if (isset($params[1])) {
|
||||
$column['length'] = (integer) substr($params[1], 0, strlen($params[1]) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($column['column'])) {
|
||||
$mapping['columnName'] = $column['column'];
|
||||
}
|
||||
|
||||
if (isset($column['length'])) {
|
||||
$mapping['length'] = $column['length'];
|
||||
}
|
||||
|
||||
if (isset($column['precision'])) {
|
||||
$mapping['precision'] = $column['precision'];
|
||||
}
|
||||
|
||||
if (isset($column['scale'])) {
|
||||
$mapping['scale'] = $column['scale'];
|
||||
}
|
||||
|
||||
if (isset($column['unique'])) {
|
||||
$mapping['unique'] = (bool)$column['unique'];
|
||||
}
|
||||
|
||||
if (isset($column['options'])) {
|
||||
$mapping['options'] = $column['options'];
|
||||
}
|
||||
|
||||
if (isset($column['nullable'])) {
|
||||
$mapping['nullable'] = $column['nullable'];
|
||||
}
|
||||
|
||||
if (isset($column['version']) && $column['version']) {
|
||||
$mapping['version'] = $column['version'];
|
||||
}
|
||||
|
||||
if (isset($column['columnDefinition'])) {
|
||||
$mapping['columnDefinition'] = $column['columnDefinition'];
|
||||
}
|
||||
|
||||
return $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse / Normalize the cache configuration
|
||||
*
|
||||
* @param array $cacheMapping
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function cacheToArray($cacheMapping)
|
||||
{
|
||||
$region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
|
||||
$usage = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
|
||||
|
||||
if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
|
||||
}
|
||||
|
||||
if ($usage) {
|
||||
$usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
|
||||
}
|
||||
|
||||
return array(
|
||||
'usage' => $usage,
|
||||
'region' => $region,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function loadMappingFile($file)
|
||||
{
|
||||
return Yaml::parse(file_get_contents($file));
|
||||
}
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Embeddable.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Embeddable.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class Embeddable implements Annotation
|
||||
{
|
||||
}
|
||||
38
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Embedded.php
vendored
Normal file
38
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Embedded.php
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class Embedded implements Annotation
|
||||
{
|
||||
/**
|
||||
* @Required
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $columnPrefix;
|
||||
}
|
||||
37
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Entity.php
vendored
Normal file
37
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Entity.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class Entity implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $repositoryClass;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $readOnly = false;
|
||||
}
|
||||
55
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityListenerResolver.php
vendored
Normal file
55
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityListenerResolver.php
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* A resolver is used to instantiate an entity listener.
|
||||
*
|
||||
* @since 2.4
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
interface EntityListenerResolver
|
||||
{
|
||||
/**
|
||||
* Clear all instances from the set, or a specific class when given.
|
||||
*
|
||||
* @param string $className The fully-qualified class name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clear($className = null);
|
||||
|
||||
/**
|
||||
* Returns a entity listener instance for the given class name.
|
||||
*
|
||||
* @param string $className The fully-qualified class name
|
||||
*
|
||||
* @return object An entity listener
|
||||
*/
|
||||
function resolve($className);
|
||||
|
||||
/**
|
||||
* Register a entity listener instance.
|
||||
*
|
||||
* @param object $object An entity listener
|
||||
*/
|
||||
function register($object);
|
||||
}
|
||||
41
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityListeners.php
vendored
Normal file
41
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityListeners.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* The EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass.
|
||||
* The EntityListeners annotation may be applied to an entity class or mapped superclass.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.4
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class EntityListeners implements Annotation
|
||||
{
|
||||
/**
|
||||
* Specifies the names of the entity listeners.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $value = array();
|
||||
}
|
||||
56
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityResult.php
vendored
Normal file
56
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/EntityResult.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* References an entity in the SELECT clause of a SQL query.
|
||||
* If this annotation is used, the SQL statement should select all of the columns that are mapped to the entity object.
|
||||
* This should include foreign key columns to related entities.
|
||||
* The results obtained when insufficient data is available are undefined.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class EntityResult implements Annotation
|
||||
{
|
||||
/**
|
||||
* The class of the result.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $entityClass;
|
||||
|
||||
/**
|
||||
* Maps the columns specified in the SELECT list of the query to the properties or fields of the entity class.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\FieldResult>
|
||||
*/
|
||||
public $fields = array();
|
||||
|
||||
/**
|
||||
* Specifies the column name of the column in the SELECT list that is used to determine the type of the entity instance.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $discriminatorColumn;
|
||||
}
|
||||
46
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/FieldResult.php
vendored
Normal file
46
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/FieldResult.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Is used to map the columns specified in the SELECT list of the query to the properties or fields of the entity class.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class FieldResult implements Annotation
|
||||
{
|
||||
/**
|
||||
* Name of the column in the SELECT clause.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Name of the persistent field or property of the class.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $column;
|
||||
}
|
||||
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/GeneratedValue.php
vendored
Normal file
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/GeneratedValue.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class GeneratedValue implements Annotation
|
||||
{
|
||||
/**
|
||||
* The type of Id generator.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"})
|
||||
*/
|
||||
public $strategy = 'AUTO';
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/HasLifecycleCallbacks.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/HasLifecycleCallbacks.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class HasLifecycleCallbacks implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Id.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Id.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class Id implements Annotation
|
||||
{
|
||||
}
|
||||
47
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Index.php
vendored
Normal file
47
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Index.php
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class Index implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $flags;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $options;
|
||||
}
|
||||
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/InheritanceType.php
vendored
Normal file
36
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/InheritanceType.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class InheritanceType implements Annotation
|
||||
{
|
||||
/**
|
||||
* The inheritance type used by the class and its subclasses.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"NONE", "JOINED", "SINGLE_TABLE", "TABLE_PER_CLASS"})
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
64
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinColumn.php
vendored
Normal file
64
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinColumn.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY","ANNOTATION"})
|
||||
*/
|
||||
final class JoinColumn implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $referencedColumnName = 'id';
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $unique = false;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $nullable = true;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $onDelete;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $columnDefinition;
|
||||
|
||||
/**
|
||||
* Field name used in non-object hydration (array/scalar).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $fieldName;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinColumns.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinColumns.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class JoinColumns implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
47
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinTable.php
vendored
Normal file
47
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/JoinTable.php
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY","ANNOTATION"})
|
||||
*/
|
||||
final class JoinTable implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $schema;
|
||||
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
|
||||
*/
|
||||
public $joinColumns = array();
|
||||
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
|
||||
*/
|
||||
public $inverseJoinColumns = array();
|
||||
}
|
||||
66
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ManyToMany.php
vendored
Normal file
66
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ManyToMany.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class ManyToMany implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $targetEntity;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mappedBy;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $inversedBy;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $cascade;
|
||||
|
||||
/**
|
||||
* The fetching strategy to use for the association.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
|
||||
*/
|
||||
public $fetch = 'LAZY';
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $orphanRemoval = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $indexBy;
|
||||
}
|
||||
51
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ManyToOne.php
vendored
Normal file
51
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ManyToOne.php
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class ManyToOne implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $targetEntity;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $cascade;
|
||||
|
||||
/**
|
||||
* The fetching strategy to use for the association.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
|
||||
*/
|
||||
public $fetch = 'LAZY';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $inversedBy;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappedSuperclass.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappedSuperclass.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class MappedSuperclass implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $repositoryClass;
|
||||
}
|
||||
812
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php
vendored
Normal file
812
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php
vendored
Normal file
|
|
@ -0,0 +1,812 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.phpdoctrine.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* A MappingException indicates that something is wrong with the mapping setup.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class MappingException extends \Doctrine\ORM\ORMException
|
||||
{
|
||||
/**
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function pathRequired()
|
||||
{
|
||||
return new self("Specifying the paths to your entities is required ".
|
||||
"in the AnnotationDriver to retrieve all class names.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entityName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function identifierRequired($entityName)
|
||||
{
|
||||
if (false !== ($parent = get_parent_class($entityName))) {
|
||||
return new self(sprintf(
|
||||
'No identifier/primary key specified for Entity "%s" sub class of "%s". Every Entity must have an identifier/primary key.',
|
||||
$entityName, $parent
|
||||
));
|
||||
}
|
||||
|
||||
return new self(sprintf(
|
||||
'No identifier/primary key specified for Entity "%s". Every Entity must have an identifier/primary key.',
|
||||
$entityName
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entityName
|
||||
* @param string $type
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidInheritanceType($entityName, $type)
|
||||
{
|
||||
return new self("The inheritance type '$type' specified for '$entityName' does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function generatorNotAllowedWithCompositeId()
|
||||
{
|
||||
return new self("Id generators can't be used with a composite id.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingFieldName($entity)
|
||||
{
|
||||
return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingTargetEntity($fieldName)
|
||||
{
|
||||
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingSourceEntity($fieldName)
|
||||
{
|
||||
return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingEmbeddedClass($fieldName)
|
||||
{
|
||||
return new self("The embed mapping '$fieldName' misses the 'class' attribute.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entityName
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function mappingFileNotFound($entityName, $fileName)
|
||||
{
|
||||
return new self("No mapping file found named '$fileName' for class '$entityName'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception for invalid property name override.
|
||||
*
|
||||
* @param string $className The entity's name.
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidOverrideFieldName($className, $fieldName)
|
||||
{
|
||||
return new self("Invalid field override named '$fieldName' for class '$className'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception for invalid property type override.
|
||||
*
|
||||
* @param string $className The entity's name.
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidOverrideFieldType($className, $fieldName)
|
||||
{
|
||||
return new self("The column type of attribute '$fieldName' on class '$className' could not be changed.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function mappingNotFound($className, $fieldName)
|
||||
{
|
||||
return new self("No mapping found for field '$fieldName' on class '$className'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $queryName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function queryNotFound($className, $queryName)
|
||||
{
|
||||
return new self("No query found named '$queryName' on class '$className'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $resultName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function resultMappingNotFound($className, $resultName)
|
||||
{
|
||||
return new self("No result set mapping found named '$resultName' on class '$className'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $queryName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function emptyQueryMapping($entity, $queryName)
|
||||
{
|
||||
return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function nameIsMandatoryForQueryMapping($className)
|
||||
{
|
||||
return new self("Query name on entity class '$className' is not defined.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $queryName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingQueryMapping($entity, $queryName)
|
||||
{
|
||||
return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $resultName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingResultSetMappingEntity($entity, $resultName)
|
||||
{
|
||||
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $resultName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingResultSetMappingFieldName($entity, $resultName)
|
||||
{
|
||||
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function nameIsMandatoryForSqlResultSetMapping($className)
|
||||
{
|
||||
return new self("Result set mapping name on entity class '$className' is not defined.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function oneToManyRequiresMappedBy($fieldName)
|
||||
{
|
||||
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function joinTableRequired($fieldName)
|
||||
{
|
||||
return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called if a required option was not found but is required
|
||||
*
|
||||
* @param string $field Which field cannot be processed?
|
||||
* @param string $expectedOption Which option is required
|
||||
* @param string $hint Can optionally be used to supply a tip for common mistakes,
|
||||
* e.g. "Did you think of the plural s?"
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
static function missingRequiredOption($field, $expectedOption, $hint = '')
|
||||
{
|
||||
$message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required.";
|
||||
|
||||
if ( ! empty($hint)) {
|
||||
$message .= ' (Hint: ' . $hint . ')';
|
||||
}
|
||||
|
||||
return new self($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic exception for invalid mappings.
|
||||
*
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidMapping($fieldName)
|
||||
{
|
||||
return new self("The mapping of field '$fieldName' is invalid.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception for reflection exceptions - adds the entity name,
|
||||
* because there might be long classnames that will be shortened
|
||||
* within the stacktrace
|
||||
*
|
||||
* @param string $entity The entity's name
|
||||
* @param \ReflectionException $previousException
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function reflectionFailure($entity, \ReflectionException $previousException)
|
||||
{
|
||||
return new self('An error occurred in ' . $entity, 0, $previousException);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $joinColumn
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function joinColumnMustPointToMappedField($className, $joinColumn)
|
||||
{
|
||||
return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
|
||||
. $className . ' since it is referenced by a join column of another class.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function classIsNotAValidEntityOrMappedSuperClass($className)
|
||||
{
|
||||
if (false !== ($parent = get_parent_class($className))) {
|
||||
return new self(sprintf(
|
||||
'Class "%s" sub class of "%s" is not a valid entity or mapped super class.',
|
||||
$className, $parent
|
||||
));
|
||||
}
|
||||
|
||||
return new self(sprintf(
|
||||
'Class "%s" is not a valid entity or mapped super class.',
|
||||
$className
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function propertyTypeIsRequired($className, $propertyName)
|
||||
{
|
||||
return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName.".");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function tableIdGeneratorNotImplemented($className)
|
||||
{
|
||||
return new self("TableIdGenerator is not yet implemented for use with class ".$className);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity The entity's name.
|
||||
* @param string $fieldName The name of the field that was already declared.
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateFieldMapping($entity, $fieldName)
|
||||
{
|
||||
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateAssociationMapping($entity, $fieldName)
|
||||
{
|
||||
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $queryName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateQueryMapping($entity, $queryName)
|
||||
{
|
||||
return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $resultName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateResultSetMapping($entity, $resultName)
|
||||
{
|
||||
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function singleIdNotAllowedOnCompositePrimaryKey($entity)
|
||||
{
|
||||
return new self('Single id is not allowed on composite primary key in entity '.$entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
* @param string $fieldName
|
||||
* @param string $unsupportedType
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType)
|
||||
{
|
||||
return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") '
|
||||
.'is not supported by Doctrine.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $path
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
|
||||
{
|
||||
if ( ! empty($path)) {
|
||||
$path = '[' . $path . ']';
|
||||
}
|
||||
|
||||
return new self(
|
||||
'File mapping drivers must have a valid directory path, ' .
|
||||
'however the given path ' . $path . ' seems to be incorrect!'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an exception that indicates that a class used in a discriminator map does not exist.
|
||||
* An example would be an outdated (maybe renamed) classname.
|
||||
*
|
||||
* @param string $className The class that could not be found
|
||||
* @param string $owningClass The class that declares the discriminator map.
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidClassInDiscriminatorMap($className, $owningClass)
|
||||
{
|
||||
return new self(
|
||||
"Entity class '$className' used in the discriminator map of class '$owningClass' ".
|
||||
"does not exist."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param array $entries
|
||||
* @param array $map
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateDiscriminatorEntry($className, array $entries, array $map)
|
||||
{
|
||||
return new self(
|
||||
"The entries " . implode(', ', $entries) . " in discriminator map of class '" . $className . "' is duplicated. " .
|
||||
"If the discriminator map is automatically generated you have to convert it to an explicit discriminator map now. " .
|
||||
"The entries of the current map are: @DiscriminatorMap({" . implode(', ', array_map(
|
||||
function($a, $b) { return "'$a': '$b'"; }, array_keys($map), array_values($map)
|
||||
)) . "})"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingDiscriminatorMap($className)
|
||||
{
|
||||
return new self("Entity class '$className' is using inheritance but no discriminator map was defined.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingDiscriminatorColumn($className)
|
||||
{
|
||||
return new self("Entity class '$className' is using inheritance but no discriminator column was defined.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $type
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidDiscriminatorColumnType($className, $type)
|
||||
{
|
||||
return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function nameIsMandatoryForDiscriminatorColumns($className)
|
||||
{
|
||||
return new self("Discriminator column name on entity class '$className' is not defined.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $fieldName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function cannotVersionIdField($className, $fieldName)
|
||||
{
|
||||
return new self("Setting Id field '$fieldName' as versionable in entity class '$className' is not supported.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $fieldName
|
||||
* @param string $type
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type)
|
||||
{
|
||||
return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $columnName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function duplicateColumnName($className, $columnName)
|
||||
{
|
||||
return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function illegalToManyAssociationOnMappedSuperclass($className, $field)
|
||||
{
|
||||
return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $targetEntity
|
||||
* @param string $targetField
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField)
|
||||
{
|
||||
return new self("It is not possible to map entity '".$className."' with a composite primary key ".
|
||||
"as part of the primary key of another entity '".$targetEntity."#".$targetField."'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function noSingleAssociationJoinColumnFound($className, $field)
|
||||
{
|
||||
return new self("'$className#$field' is not an association with a single join column.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $column
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function noFieldNameFoundForColumn($className, $column)
|
||||
{
|
||||
return new self("Cannot find a field on '$className' that is mapped to column '$column'. Either the ".
|
||||
"field does not exist or an association exists but it has multiple join columns.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field)
|
||||
{
|
||||
return new self("The orphan removal option is not allowed on an association that is ".
|
||||
"part of the identifier in '$className#$field'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function illegalOrphanRemoval($className, $field)
|
||||
{
|
||||
return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
|
||||
"associations, but " . $className."#" .$field . " is not.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function illegalInverseIdentifierAssociation($className, $field)
|
||||
{
|
||||
return new self("An inverse association is not allowed to be identifier in '$className#$field'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $field
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function illegalToManyIdentifierAssociation($className, $field)
|
||||
{
|
||||
return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function noInheritanceOnMappedSuperClass($className)
|
||||
{
|
||||
return new self("It is not supported to define inheritance information on a mapped superclass '" . $className . "'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $rootClassName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
|
||||
{
|
||||
return new self(
|
||||
"Entity '" . $className . "' has to be part of the discriminator map of '" . $rootClassName . "' " .
|
||||
"to be properly mapped in the inheritance hierarchy. Alternatively you can make '".$className."' an abstract class " .
|
||||
"to avoid this exception from occurring."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $methodName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function lifecycleCallbackMethodNotFound($className, $methodName)
|
||||
{
|
||||
return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listenerName
|
||||
* @param string $className
|
||||
*
|
||||
* @return \Doctrine\ORM\Mapping\MappingException
|
||||
*/
|
||||
public static function entityListenerClassNotFound($listenerName, $className)
|
||||
{
|
||||
return new self(sprintf('Entity Listener "%s" declared on "%s" not found.', $listenerName, $className));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listenerName
|
||||
* @param string $methodName
|
||||
* @param string $className
|
||||
*
|
||||
* @return \Doctrine\ORM\Mapping\MappingException
|
||||
*/
|
||||
public static function entityListenerMethodNotFound($listenerName, $methodName, $className)
|
||||
{
|
||||
return new self(sprintf('Entity Listener "%s" declared on "%s" has no method "%s".', $listenerName, $className, $methodName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $listenerName
|
||||
* @param string $methodName
|
||||
* @param string $className
|
||||
*
|
||||
* @return \Doctrine\ORM\Mapping\MappingException
|
||||
*/
|
||||
public static function duplicateEntityListener($listenerName, $methodName, $className)
|
||||
{
|
||||
return new self(sprintf('Entity Listener "%s#%s()" in "%s" was already declared, but it must be declared only once.', $listenerName, $methodName, $className));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $annotation
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidFetchMode($className, $annotation)
|
||||
{
|
||||
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function compositeKeyAssignedIdGeneratorRequired($className)
|
||||
{
|
||||
return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $targetEntity
|
||||
* @param string $sourceEntity
|
||||
* @param string $associationName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
|
||||
{
|
||||
return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $cascades
|
||||
* @param string $className
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function invalidCascadeOption(array $cascades, $className, $propertyName)
|
||||
{
|
||||
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));
|
||||
return new self(sprintf(
|
||||
"You have specified invalid cascade options for %s::$%s: %s; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'",
|
||||
$className,
|
||||
$propertyName,
|
||||
$cascades
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function missingSequenceName($className)
|
||||
{
|
||||
return new self(
|
||||
sprintf('Missing "sequenceName" attribute for sequence id generator definition on class "%s".', $className)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $propertyName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
public static function infiniteEmbeddableNesting($className, $propertyName)
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
'Infinite nesting detected for embedded property %s::%s. ' .
|
||||
'You cannot embed an embeddable from the same type inside an embeddable.',
|
||||
$className,
|
||||
$propertyName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedNativeQueries.php
vendored
Normal file
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedNativeQueries.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Is used to specify an array of native SQL named queries.
|
||||
* The NamedNativeQueries annotation can be applied to an entity or mapped superclass.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class NamedNativeQueries implements Annotation
|
||||
{
|
||||
/**
|
||||
* One or more NamedNativeQuery annotations.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\NamedNativeQuery>
|
||||
*/
|
||||
public $value = array();
|
||||
}
|
||||
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedNativeQuery.php
vendored
Normal file
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedNativeQuery.php
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Is used to specify a native SQL named query.
|
||||
* The NamedNativeQuery annotation can be applied to an entity or mapped superclass.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class NamedNativeQuery implements Annotation
|
||||
{
|
||||
/**
|
||||
* The name used to refer to the query with the EntityManager methods that create query objects.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The SQL query string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $query;
|
||||
|
||||
/**
|
||||
* The class of the result.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resultClass;
|
||||
|
||||
/**
|
||||
* The name of a SqlResultSetMapping, as defined in metadata.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resultSetMapping;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedQueries.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedQueries.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class NamedQueries implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\NamedQuery>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
37
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedQuery.php
vendored
Normal file
37
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamedQuery.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class NamedQuery implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $query;
|
||||
}
|
||||
100
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamingStrategy.php
vendored
Normal file
100
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/NamingStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* A set of rules for determining the physical column and table names
|
||||
*
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
interface NamingStrategy
|
||||
{
|
||||
/**
|
||||
* Returns a table name for an entity class.
|
||||
*
|
||||
* @param string $className The fully-qualified class name.
|
||||
*
|
||||
* @return string A table name.
|
||||
*/
|
||||
function classToTableName($className);
|
||||
|
||||
/**
|
||||
* Returns a column name for a property.
|
||||
*
|
||||
* @param string $propertyName A property name.
|
||||
* @param string|null $className The fully-qualified class name.
|
||||
*
|
||||
* @return string A column name.
|
||||
*/
|
||||
function propertyToColumnName($propertyName, $className = null);
|
||||
|
||||
/**
|
||||
* Returns a column name for an embedded property.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $embeddedColumnName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null);
|
||||
|
||||
/**
|
||||
* Returns the default reference column name.
|
||||
*
|
||||
* @return string A column name.
|
||||
*/
|
||||
function referenceColumnName();
|
||||
|
||||
/**
|
||||
* Returns a join column name for a property.
|
||||
*
|
||||
* @param string $propertyName A property name.
|
||||
* @param string|null $className The fully-qualified class name.
|
||||
* This parameter is omitted from the signature due to BC
|
||||
*
|
||||
* @return string A join column name.
|
||||
*/
|
||||
function joinColumnName($propertyName/*, $className = null*/);
|
||||
|
||||
/**
|
||||
* Returns a join table name.
|
||||
*
|
||||
* @param string $sourceEntity The source entity.
|
||||
* @param string $targetEntity The target entity.
|
||||
* @param string|null $propertyName A property name.
|
||||
*
|
||||
* @return string A join table name.
|
||||
*/
|
||||
function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
|
||||
|
||||
/**
|
||||
* Returns the foreign key column name for the given parameters.
|
||||
*
|
||||
* @param string $entityName An entity.
|
||||
* @param string|null $referencedColumnName A property.
|
||||
*
|
||||
* @return string A join column name.
|
||||
*/
|
||||
function joinKeyColumnName($entityName, $referencedColumnName = null);
|
||||
}
|
||||
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OneToMany.php
vendored
Normal file
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OneToMany.php
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class OneToMany implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mappedBy;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $targetEntity;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $cascade;
|
||||
|
||||
/**
|
||||
* The fetching strategy to use for the association.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
|
||||
*/
|
||||
public $fetch = 'LAZY';
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $orphanRemoval = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $indexBy;
|
||||
}
|
||||
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OneToOne.php
vendored
Normal file
61
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OneToOne.php
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class OneToOne implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $targetEntity;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mappedBy;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $inversedBy;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $cascade;
|
||||
|
||||
/**
|
||||
* The fetching strategy to use for the association.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
|
||||
*/
|
||||
public $fetch = 'LAZY';
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $orphanRemoval = false;
|
||||
}
|
||||
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OrderBy.php
vendored
Normal file
32
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/OrderBy.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class OrderBy implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostLoad.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostLoad.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PostLoad implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostPersist.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostPersist.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PostPersist implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostRemove.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostRemove.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PostRemove implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostUpdate.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PostUpdate.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PostUpdate implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreFlush.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreFlush.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PreFlush implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PrePersist.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PrePersist.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PrePersist implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreRemove.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreRemove.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PreRemove implements Annotation
|
||||
{
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreUpdate.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/PreUpdate.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
final class PreUpdate implements Annotation
|
||||
{
|
||||
}
|
||||
119
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/QuoteStrategy.php
vendored
Normal file
119
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/QuoteStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* A set of rules for determining the column, alias and table quotes.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
interface QuoteStrategy
|
||||
{
|
||||
/**
|
||||
* Gets the (possibly quoted) column name for safe use in an SQL statement.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) primary table name for safe use in an SQL statement.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getTableName(ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) sequence name for safe use in an SQL statement.
|
||||
*
|
||||
* @param array $definition
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) name of the join table.
|
||||
*
|
||||
* @param array $association
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the column alias.
|
||||
*
|
||||
* @param string $columnName
|
||||
* @param integer $counter
|
||||
* @param AbstractPlatform $platform
|
||||
* @param ClassMetadata|null $class
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
|
||||
|
||||
}
|
||||
163
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php
vendored
Normal file
163
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping\Reflection;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ReflectionService;
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
|
||||
/**
|
||||
* Utility class to retrieve all reflection instance properties of a given class, including
|
||||
* private inherited properties and transient properties.
|
||||
*
|
||||
* @private This API is for internal use only
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
final class ReflectionPropertiesGetter
|
||||
{
|
||||
/**
|
||||
* @var ReflectionProperty[][] indexed by class name and property internal name
|
||||
*/
|
||||
private $properties = [];
|
||||
|
||||
/**
|
||||
* @var ReflectionService
|
||||
*/
|
||||
private $reflectionService;
|
||||
|
||||
/**
|
||||
* @param ReflectionService $reflectionService
|
||||
*/
|
||||
public function __construct(ReflectionService $reflectionService)
|
||||
{
|
||||
$this->reflectionService = $reflectionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $className
|
||||
*
|
||||
* @return ReflectionProperty[] indexed by property internal name
|
||||
*/
|
||||
public function getProperties($className)
|
||||
{
|
||||
if (isset($this->properties[$className])) {
|
||||
return $this->properties[$className];
|
||||
}
|
||||
|
||||
return $this->properties[$className] = call_user_func_array(
|
||||
'array_merge',
|
||||
// first merge because `array_merge` expects >= 1 params
|
||||
array_merge(
|
||||
[[]],
|
||||
array_map(
|
||||
[$this, 'getClassProperties'],
|
||||
$this->getHierarchyClasses($className)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return ReflectionClass[]
|
||||
*/
|
||||
private function getHierarchyClasses($className)
|
||||
{
|
||||
$classes = [];
|
||||
$parentClassName = $className;
|
||||
|
||||
while ($parentClassName && $currentClass = $this->reflectionService->getClass($parentClassName)) {
|
||||
$classes[] = $currentClass;
|
||||
$parentClassName = null;
|
||||
|
||||
if ($parentClass = $currentClass->getParentClass()) {
|
||||
$parentClassName = $parentClass->getName();
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
*
|
||||
* @return ReflectionProperty[]
|
||||
*/
|
||||
private function getClassProperties(ReflectionClass $reflectionClass)
|
||||
{
|
||||
$properties = $reflectionClass->getProperties();
|
||||
|
||||
return array_filter(
|
||||
array_filter(array_map(
|
||||
[$this, 'getAccessibleProperty'],
|
||||
array_combine(
|
||||
array_map([$this, 'getLogicalName'], $properties),
|
||||
$properties
|
||||
)
|
||||
)),
|
||||
[$this, 'isInstanceProperty']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionProperty $reflectionProperty
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isInstanceProperty(ReflectionProperty $reflectionProperty)
|
||||
{
|
||||
return ! $reflectionProperty->isStatic();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionProperty $property
|
||||
*
|
||||
* @return null|ReflectionProperty
|
||||
*/
|
||||
private function getAccessibleProperty(ReflectionProperty $property)
|
||||
{
|
||||
return $this->reflectionService->getAccessibleProperty(
|
||||
$property->getDeclaringClass()->getName(),
|
||||
$property->getName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionProperty $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getLogicalName(ReflectionProperty $property)
|
||||
{
|
||||
$propertyName = $property->getName();
|
||||
|
||||
if ($property->isPublic()) {
|
||||
return $propertyName;
|
||||
}
|
||||
|
||||
if ($property->isProtected()) {
|
||||
return "\0*\0" . $propertyName;
|
||||
}
|
||||
|
||||
return "\0" . $property->getDeclaringClass()->getName() . "\0" . $propertyName;
|
||||
}
|
||||
}
|
||||
101
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
vendored
Normal file
101
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Doctrine\Instantiator\Instantiator;
|
||||
use ReflectionProperty;
|
||||
|
||||
/**
|
||||
* Acts as a proxy to a nested Property structure, making it look like
|
||||
* just a single scalar property.
|
||||
*
|
||||
* This way value objects "just work" without UnitOfWork, Persisters or Hydrators
|
||||
* needing any changes.
|
||||
*
|
||||
* TODO: Move this class into Common\Reflection
|
||||
*/
|
||||
class ReflectionEmbeddedProperty extends ReflectionProperty
|
||||
{
|
||||
/**
|
||||
* @var ReflectionProperty reflection property of the class where the embedded object has to be put
|
||||
*/
|
||||
private $parentProperty;
|
||||
|
||||
/**
|
||||
* @var ReflectionProperty reflection property of the embedded object
|
||||
*/
|
||||
private $childProperty;
|
||||
|
||||
/**
|
||||
* @var string name of the embedded class to be eventually instantiated
|
||||
*/
|
||||
private $embeddedClass;
|
||||
|
||||
/**
|
||||
* @var Instantiator|null
|
||||
*/
|
||||
private $instantiator;
|
||||
|
||||
/**
|
||||
* @param ReflectionProperty $parentProperty
|
||||
* @param ReflectionProperty $childProperty
|
||||
* @param string $embeddedClass
|
||||
*/
|
||||
public function __construct(ReflectionProperty $parentProperty, ReflectionProperty $childProperty, $embeddedClass)
|
||||
{
|
||||
$this->parentProperty = $parentProperty;
|
||||
$this->childProperty = $childProperty;
|
||||
$this->embeddedClass = (string) $embeddedClass;
|
||||
|
||||
parent::__construct($childProperty->getDeclaringClass()->getName(), $childProperty->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getValue($object = null)
|
||||
{
|
||||
$embeddedObject = $this->parentProperty->getValue($object);
|
||||
|
||||
if (null === $embeddedObject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->childProperty->getValue($embeddedObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
$embeddedObject = $this->parentProperty->getValue($object);
|
||||
|
||||
if (null === $embeddedObject) {
|
||||
$this->instantiator = $this->instantiator ?: new Instantiator();
|
||||
|
||||
$embeddedObject = $this->instantiator->instantiate($this->embeddedClass);
|
||||
|
||||
$this->parentProperty->setValue($object, $embeddedObject);
|
||||
}
|
||||
|
||||
$this->childProperty->setValue($embeddedObject, $value);
|
||||
}
|
||||
}
|
||||
42
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SequenceGenerator.php
vendored
Normal file
42
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SequenceGenerator.php
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class SequenceGenerator implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $sequenceName;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
public $allocationSize = 1;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
public $initialValue = 1;
|
||||
}
|
||||
54
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SqlResultSetMapping.php
vendored
Normal file
54
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SqlResultSetMapping.php
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* The SqlResultSetMapping annotation is used to specify the mapping of the result of a native SQL query.
|
||||
* The SqlResultSetMapping annotation can be applied to an entity or mapped superclass.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class SqlResultSetMapping implements Annotation
|
||||
{
|
||||
/**
|
||||
* The name given to the result set mapping, and used to refer to it in the methods of the Query API.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Specifies the result set mapping to entities.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\EntityResult>
|
||||
*/
|
||||
public $entities = array();
|
||||
|
||||
/**
|
||||
* Specifies the result set mapping to scalar values.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\ColumnResult>
|
||||
*/
|
||||
public $columns = array();
|
||||
}
|
||||
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SqlResultSetMappings.php
vendored
Normal file
40
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/SqlResultSetMappings.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Is used to specify an array of mappings.
|
||||
* The SqlResultSetMappings annotation can be applied to an entity or mapped superclass.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
*
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class SqlResultSetMappings implements Annotation
|
||||
{
|
||||
/**
|
||||
* One or more SqlResultSetMapping annotations.
|
||||
*
|
||||
* @var array<\Doctrine\ORM\Mapping\SqlResultSetMapping>
|
||||
*/
|
||||
public $value = array();
|
||||
}
|
||||
52
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Table.php
vendored
Normal file
52
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Table.php
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
final class Table implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $schema;
|
||||
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\Index>
|
||||
*/
|
||||
public $indexes;
|
||||
|
||||
/**
|
||||
* @var array<\Doctrine\ORM\Mapping\UniqueConstraint>
|
||||
*/
|
||||
public $uniqueConstraints;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $options = array();
|
||||
}
|
||||
146
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php
vendored
Normal file
146
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* Naming strategy implementing the underscore naming convention.
|
||||
* Converts 'MyEntity' to 'my_entity' or 'MY_ENTITY'.
|
||||
*
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class UnderscoreNamingStrategy implements NamingStrategy
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $case;
|
||||
|
||||
/**
|
||||
* Underscore naming strategy construct.
|
||||
*
|
||||
* @param integer $case CASE_LOWER | CASE_UPPER
|
||||
*/
|
||||
public function __construct($case = CASE_LOWER)
|
||||
{
|
||||
$this->case = $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer CASE_LOWER | CASE_UPPER
|
||||
*/
|
||||
public function getCase()
|
||||
{
|
||||
return $this->case;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets string case CASE_LOWER | CASE_UPPER.
|
||||
* Alphabetic characters converted to lowercase or uppercase.
|
||||
*
|
||||
* @param integer $case
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCase($case)
|
||||
{
|
||||
$this->case = $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function classToTableName($className)
|
||||
{
|
||||
if (strpos($className, '\\') !== false) {
|
||||
$className = substr($className, strrpos($className, '\\') + 1);
|
||||
}
|
||||
|
||||
return $this->underscore($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function propertyToColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $this->underscore($propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
|
||||
{
|
||||
return $this->underscore($propertyName).'_'.$embeddedColumnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function referenceColumnName()
|
||||
{
|
||||
return $this->case === CASE_UPPER ? 'ID' : 'id';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinColumnName($propertyName, $className = null)
|
||||
{
|
||||
return $this->underscore($propertyName) . '_' . $this->referenceColumnName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
|
||||
{
|
||||
return $this->classToTableName($sourceEntity) . '_' . $this->classToTableName($targetEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function joinKeyColumnName($entityName, $referencedColumnName = null)
|
||||
{
|
||||
return $this->classToTableName($entityName) . '_' .
|
||||
($referencedColumnName ?: $this->referenceColumnName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function underscore($string)
|
||||
{
|
||||
$string = preg_replace('/(?<=[a-z])([A-Z])/', '_$1', $string);
|
||||
|
||||
if ($this->case === CASE_UPPER) {
|
||||
return strtoupper($string);
|
||||
}
|
||||
|
||||
return strtolower($string);
|
||||
}
|
||||
}
|
||||
42
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UniqueConstraint.php
vendored
Normal file
42
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UniqueConstraint.php
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("ANNOTATION")
|
||||
*/
|
||||
final class UniqueConstraint implements Annotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $options;
|
||||
}
|
||||
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Version.php
vendored
Normal file
28
vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Version.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 MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("PROPERTY")
|
||||
*/
|
||||
final class Version implements Annotation
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue