Permalink
Browse files

Updating license to MIT

  • Loading branch information...
1 parent 6a49ee3 commit 1df16023ad231ef0dd0f8e6cfec141c16691ae1a @Ocramius Ocramius committed May 20, 2012
View
14 LICENSE
@@ -0,0 +1,14 @@
+Copyright (c) 2006-2012 Doctrine Project
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
View
@@ -1,4 +1,22 @@
<?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>.
+ */
+
ini_set('display_errors', true);
chdir(__DIR__);
View
@@ -2,6 +2,7 @@
"name": "doctrine/DoctrineModule",
"description": "Zend Framework 2 Module that provides Doctrine basic functionality required for ORM and ODM modules",
"type": "library",
+ "license": "LGPL",
"keywords": [
"doctrine",
"module",
View
@@ -1,4 +1,22 @@
<?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>.
+ */
+
return array(
'di' => array(
'instance' => array(
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -42,26 +42,26 @@ class EventManager extends Instance
'subscribers' => 'array'
)
);
-
+
protected function loadInstance()
{
$opts = $this->getOptions();
$evm = new DoctrineEventManager;
-
+
foreach($opts['subscribers'] as $subscriber) {
if (is_string($subscriber)) {
if (!class_exists($subscriber)) {
throw new \InvalidArgumentException(sprintf(
'failed to register subscriber "%s" because the class does not exist.',
- $subscriber
+ $subscriber
));
}
$subscriber = new $subscriber;
}
-
+
$evm->addEventSubscriber($subscriber);
}
-
+
$this->instance = $evm;
}
}
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -33,57 +33,57 @@
abstract class Instance
{
/**
- * All instances have a required opts array.
+ * All instances have a required opts array.
* @var array
*/
protected $opts;
-
+
/**
* Provides a definition of expected option parameters.
* @var array
*/
protected $definition = array();
-
+
/**
* The configured instance.
* @var mixed
*/
protected $instance;
-
+
/**
* Constructor.
- *
+ *
* @param array $opts
*/
public function __construct(array $opts)
{
$this->setOptions($opts);
}
-
+
/**
* Set options and validate minimum requirements.
- *
+ *
* @param array $opts
*/
public function setOptions(array $opts)
{
$this->validateOptions($opts);
$this->opts = $opts;
}
-
+
/**
* Get options.
- *
+ *
* @return array
*/
public function getOptions()
{
return $this->opts;
}
-
+
/**
* Get the configured instance.
- *
+ *
* @return mixed
*/
public function getInstance()
@@ -93,13 +93,13 @@ public function getInstance()
}
return $this->instance;
}
-
+
abstract protected function loadInstance();
-
+
/**
* Validates that required options are present and of the correct type and generates
* optional options of the correct type if missing.
- *
+ *
* @param array $opts Options to check.
* @param null|array $defs Definitions to use - defaults to the class.
* @throws InvalidArgumentException on missing required arguments.
@@ -118,7 +118,7 @@ protected function validateOptions(array &$opts, array $defs = null)
$var
));
}
-
+
// if class_exists of $type then instantiate new object
if (null !== $type) {
$got = gettype($opts[$var]);
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -13,7 +13,7 @@
* 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
+ * and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
@@ -49,31 +49,31 @@
self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found",
self::ERROR_RECORD_FOUND => "A record matching '%value%' was found",
);
-
+
/**
* Doctrine EntityManager
- *
+ *
* @var EntityManager
*/
protected $_em;
-
+
/**
* Name of the entity to use for validation.
- *
+ *
* @var string
*/
protected $_entity;
-
+
/**
* Name of the field to use for validation.
- *
+ *
* @var string
*/
protected $_field;
/**
* QueryBuilder closure.
- *
+ *
* @var Closure
*/
protected $_queryBuilder;
@@ -83,53 +83,53 @@
* - em EntityManager instance to use.
* - entity Entity to use for validation.
* - field Field to check.
- *
+ *
* Optional options are:
* - query_builder Custom query_builder Closure to use for the select. A single
* EntityRepository argument is passed at call time. Example:
- * 'query_builder' => function($er) { return $er->createQueryBuilder('q'); }
+ * 'query_builder' => function($er) { return $er->createQueryBuilder('q'); }
*/
public function __construct(array $options)
{
if (!array_key_exists('em', $options)) {
throw new Exception\InvalidArgumentException('No EntityManager was specified.');
}
-
+
if (!$options['em'] instanceof EntityManager) {
throw new Exception\InvalidArgumentException('Invalid EntityManager specified.');
}
$this->_em = $options['em'];
-
+
if (!array_key_exists('entity', $options)) {
throw new Exception\InvalidArgumentException('No entity class was specified.');
}
$this->_entity = $options['entity'];
-
+
if (array_key_exists('query_builder', $options)) {
if (!$options['query_builder'] instanceof Closure) {
throw new Exception\InvalidArgumentException('query_builder must be a Closure');
}
$this->_queryBuilder = $options['query_builder'];
- }
+ }
$this->_field = $options['field'];
-
+
parent::__construct($options);
}
/**
* Generates a query based on the constructor options. Attempts to enforce
* a minimum select for the query by checking the DQL parts for an alias
* and then using the entity metadata to select only the identifiers.
- *
+ *
* @param mixed $value Contains the value to check.
- * @return Doctrine\ORM\Query
+ * @return Doctrine\ORM\Query
*/
protected function _getQuery($value)
{
$em = $this->_em;
$qb = $this->_queryBuilder;
$field = $this->_field;
-
+
// set default query builder closure if one wasn't specified
if (!$qb) {
$qb = function(EntityRepository $er) use ($field) {
@@ -139,17 +139,17 @@ protected function _getQuery($value)
$er = $em->getRepository($this->_entity);
$qb = call_user_func($qb, $er);
-
+
// reduce query to minimal return (selecting identifiers)
$mdata = $em->getClassMetadata($this->_entity);
$alias = current($qb->getDqlPart('from'))->getAlias();
-
+
$qb->select("partial {$alias}.{" . implode(',', $mdata->identifier) . '}');
-
+
// add field to query
$qb->andWhere($qb->expr()->eq('q.' . $field, $qb->expr()->literal($value)))
->setMaxResults(1);
-
+
return $qb->getQuery();
}
}
Oops, something went wrong.

0 comments on commit 1df1602

Please sign in to comment.