| author | ymh <ymh.work@gmail.com> |
| Fri, 25 Nov 2011 18:55:43 +0100 | |
| changeset 39 | 03b14b0fe101 |
| permissions | -rw-r--r-- |
|
39
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
/* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
* This software consists of voluntary contributions made by many individuals |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
* and is licensed under the LGPL. For more information, see |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
* <http://www.doctrine-project.org>. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
namespace Doctrine\DBAL\Migrations\Configuration; |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
|
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
/** |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
* Load migration configuration information from a XML configuration file. |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
* |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
* @link www.doctrine-project.org |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
* @since 2.0 |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
* @author Jonathan H. Wage <jonwage@gmail.com> |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
class XmlConfiguration extends AbstractFileConfiguration |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
{ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
/** |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
* @inheritdoc |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
*/ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
protected function doLoad($file) |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
{ |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
$xml = simplexml_load_file($file); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
if (isset($xml->name)) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
$this->setName((string) $xml->name); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
if (isset($xml->table['name'])) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
$this->setMigrationsTableName((string) $xml->table['name']); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
if (isset($xml->{'migrations-namespace'})) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
$this->setMigrationsNamespace((string) $xml->{'migrations-namespace'}); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
if (isset($xml->{'migrations-directory'})) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
$migrationsDirectory = $this->getDirectoryRelativeToFile($file, (string) $xml->{'migrations-directory'}); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
$this->setMigrationsDirectory($migrationsDirectory); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
$this->registerMigrationsFromDirectory($migrationsDirectory); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
if (isset($xml->migrations->migration)) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
foreach ($xml->migrations->migration as $migration) { |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
$this->registerMigration((string) $migration['version'], (string) $migration['class']); |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
} |
|
03b14b0fe101
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
} |