[345] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 14 | * |
---|
| 15 | * This software consists of voluntary contributions made by many individuals |
---|
| 16 | * and is licensed under the LGPL. For more information, see |
---|
| 17 | * <http://www.doctrine-project.org>. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | namespace Doctrine\DBAL; |
---|
| 21 | |
---|
| 22 | use Doctrine\DBAL\Logging\SQLLogger; |
---|
| 23 | use Doctrine\Common\Cache\Cache; |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * Configuration container for the Doctrine DBAL. |
---|
| 27 | * |
---|
| 28 | * @since 2.0 |
---|
| 29 | * @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
---|
| 30 | * @author Jonathan Wage <jonwage@gmail.com> |
---|
| 31 | * @author Roman Borschel <roman@code-factory.org> |
---|
| 32 | * @internal When adding a new configuration option just write a getter/setter |
---|
| 33 | * pair and add the option to the _attributes array with a proper default value. |
---|
| 34 | */ |
---|
| 35 | class Configuration |
---|
| 36 | { |
---|
| 37 | /** |
---|
| 38 | * The attributes that are contained in the configuration. |
---|
| 39 | * Values are default values. |
---|
| 40 | * |
---|
| 41 | * @var array |
---|
| 42 | */ |
---|
| 43 | protected $_attributes = array(); |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled. |
---|
| 47 | * |
---|
| 48 | * @param SQLLogger $logger |
---|
| 49 | */ |
---|
| 50 | public function setSQLLogger(SQLLogger $logger = null) |
---|
| 51 | { |
---|
| 52 | $this->_attributes['sqlLogger'] = $logger; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | /** |
---|
| 56 | * Gets the SQL logger that is used. |
---|
| 57 | * |
---|
| 58 | * @return SQLLogger |
---|
| 59 | */ |
---|
| 60 | public function getSQLLogger() |
---|
| 61 | { |
---|
| 62 | return isset($this->_attributes['sqlLogger']) ? |
---|
| 63 | $this->_attributes['sqlLogger'] : null; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * Gets the cache driver implementation that is used for query result caching. |
---|
| 68 | * |
---|
| 69 | * @return \Doctrine\Common\Cache\Cache |
---|
| 70 | */ |
---|
| 71 | public function getResultCacheImpl() |
---|
| 72 | { |
---|
| 73 | return isset($this->_attributes['resultCacheImpl']) ? |
---|
| 74 | $this->_attributes['resultCacheImpl'] : null; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * Sets the cache driver implementation that is used for query result caching. |
---|
| 79 | * |
---|
| 80 | * @param \Doctrine\Common\Cache\Cache $cacheImpl |
---|
| 81 | */ |
---|
| 82 | public function setResultCacheImpl(Cache $cacheImpl) |
---|
| 83 | { |
---|
| 84 | $this->_attributes['resultCacheImpl'] = $cacheImpl; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | /** |
---|
| 88 | * Filter schema assets expression. |
---|
| 89 | * |
---|
| 90 | * Only include tables/sequences matching the filter expression regexp in |
---|
| 91 | * schema instances generated for the active connection when calling |
---|
| 92 | * {AbstractSchemaManager#createSchema()}. |
---|
| 93 | * |
---|
| 94 | * @param string $filterExpression |
---|
| 95 | */ |
---|
| 96 | public function setFilterSchemaAssetsExpression($filterExpression) |
---|
| 97 | { |
---|
| 98 | $this->_attributes['filterSchemaAssetsExpression'] = $filterExpression; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * Return filter schema assets expression. |
---|
| 103 | * |
---|
| 104 | * @return string|null |
---|
| 105 | */ |
---|
| 106 | public function getFilterSchemaAssetsExpression() |
---|
| 107 | { |
---|
| 108 | if (isset($this->_attributes['filterSchemaAssetsExpression'])) { |
---|
| 109 | return $this->_attributes['filterSchemaAssetsExpression']; |
---|
| 110 | } |
---|
| 111 | return null; |
---|
| 112 | } |
---|
| 113 | } |
---|