native query annotations
This commit is contained in:
parent
022d27e4e9
commit
530e4840dd
6 changed files with 305 additions and 0 deletions
58
lib/Doctrine/ORM/Mapping/EntityResult.php
Normal file
58
lib/Doctrine/ORM/Mapping/EntityResult.php
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
}
|
48
lib/Doctrine/ORM/Mapping/FieldResult.php
Normal file
48
lib/Doctrine/ORM/Mapping/FieldResult.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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;
|
||||||
|
|
||||||
|
}
|
40
lib/Doctrine/ORM/Mapping/NamedNativeQueries.php
Normal file
40
lib/Doctrine/ORM/Mapping/NamedNativeQueries.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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;
|
||||||
|
}
|
63
lib/Doctrine/ORM/Mapping/NamedNativeQuery.php
Normal file
63
lib/Doctrine/ORM/Mapping/NamedNativeQuery.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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("CLASS")
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
56
lib/Doctrine/ORM/Mapping/SqlResultSetMapping.php
Normal file
56
lib/Doctrine/ORM/Mapping/SqlResultSetMapping.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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("CLASS")
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the result set mapping to scalar values.
|
||||||
|
*
|
||||||
|
* @var array<\Doctrine\ORM\Mapping\ColumnResult>
|
||||||
|
*/
|
||||||
|
public $columns;
|
||||||
|
|
||||||
|
}
|
40
lib/Doctrine/ORM/Mapping/SqlResultSetMappings.php
Normal file
40
lib/Doctrine/ORM/Mapping/SqlResultSetMappings.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\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;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue