1 |
<?php
|
2 |
/*
|
3 |
* $Id$
|
4 |
*
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
16 |
*
|
17 |
* This software consists of voluntary contributions made by many individuals
|
18 |
* and is licensed under the LGPL. For more information, see
|
19 |
* <http://www.phpdoctrine.com>.
|
20 |
*/
|
21 |
|
22 |
/**
|
23 |
* Doctrine_Hydrate_Array
|
24 |
* defines an array fetching strategy for Doctrine_Hydrate
|
25 |
*
|
26 |
* @package Doctrine
|
27 |
* @subpackage Hydrate
|
28 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
29 |
* @link www.phpdoctrine.com
|
30 |
* @since 1.0
|
31 |
* @version $Revision$
|
32 |
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
33 |
*/
|
34 |
class Doctrine_Hydrate_Array
|
35 |
{
|
36 |
public function getElementCollection($component)
|
37 |
{
|
38 |
return array();
|
39 |
}
|
40 |
public function getElement(array $data, $component)
|
41 |
{
|
42 |
return $data;
|
43 |
}
|
44 |
public function isIdentifiable(array $data, Doctrine_Table $table)
|
45 |
{
|
46 |
return ( ! empty($data));
|
47 |
}
|
48 |
public function registerCollection($coll)
|
49 |
{
|
50 |
|
51 |
}
|
52 |
public function initRelated(array &$data, $name)
|
53 |
{
|
54 |
if ( ! isset($data[$name])) {
|
55 |
$data[$name] = array();
|
56 |
}
|
57 |
return true;
|
58 |
}
|
59 |
public function getNullPointer()
|
60 |
{
|
61 |
return null;
|
62 |
}
|
63 |
public function search(array $element, array $data)
|
64 |
{
|
65 |
foreach ($data as $key => $val) {
|
66 |
$found = true;
|
67 |
foreach ($element as $k => $e) {
|
68 |
if (isset($val[$k]) && $val[$k] !== $e) {
|
69 |
$found = false;
|
70 |
break;
|
71 |
}
|
72 |
}
|
73 |
if ($found) {
|
74 |
return $key;
|
75 |
}
|
76 |
}
|
77 |
return false;
|
78 |
}
|
79 |
public function flush()
|
80 |
{
|
81 |
|
82 |
}
|
83 |
} |