| author | ymh <ymh.work@gmail.com> |
| Fri, 26 Sep 2014 10:04:40 +0200 | |
| changeset 136 | f209fcb0df6c |
| parent 80 | cf6a88559482 |
| permissions | -rwxr-xr-x |
| 2 | 1 |
<?php |
|
74
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
2 |
/* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
3 |
* This file is part of the WikiTagBundle package. |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
4 |
* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
5 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
6 |
* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
8 |
* file that was distributed with this source code. |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
9 |
*/ |
| 2 | 10 |
|
11 |
namespace IRI\Bundle\WikiTagBundle\Entity; |
|
12 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
13 |
use IRI\Bundle\WikiTagBundle\Model\DocumentInterface; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
14 |
|
| 2 | 15 |
use Doctrine\ORM\EntityRepository; |
| 18 | 16 |
use IRI\Bundle\WikiTagBundle\Entity\Document; |
| 29 | 17 |
use Doctrine\ORM\Query\ResultSetMapping; |
| 18 | 18 |
use \ReflectionClass; |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
19 |
use Doctrine\ORM\AbstractQuery; |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
20 |
use Doctrine\ORM\Mapping\ClassMetadataInfo; |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
21 |
use IRI\Bundle\WikiTagBundle\Model\ModelException; |
| 2 | 22 |
|
23 |
/** |
|
24 |
* DocumentRepository |
|
25 |
* |
|
26 |
* This class was generated by the Doctrine ORM. Add your own custom |
|
27 |
* repository methods below. |
|
28 |
*/ |
|
29 |
class DocumentRepository extends EntityRepository |
|
30 |
{ |
|
| 18 | 31 |
/** |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
32 |
* The cache for the host document class |
| 18 | 33 |
* @var ReflectionClass |
34 |
*/ |
|
35 |
private $reflection_class; |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
36 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
37 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
38 |
* The cache for the wikitag document class |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
39 |
* @var ReflectionClass |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
40 |
*/ |
| 18 | 41 |
private $reflection_doc_class; |
42 |
private $set_methods = array(); |
|
43 |
private $get_methods = array(); |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
44 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
45 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
46 |
* Find one wikitagRepository by its externalId i.e. the host document id. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
47 |
* @param $external_id |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
48 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
49 |
public function findOneByExternalId($external_id) |
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
50 |
{ |
| 18 | 51 |
return $this->findOneBy(array("externalId" => $external_id)); |
52 |
} |
|
53 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
54 |
|
| 67 | 55 |
public function reflectionSetField($object, $method_name, $value) |
| 18 | 56 |
{ |
57 |
if(isset($this->set_methods[$method_name])) |
|
58 |
{ |
|
59 |
$set_method = $this->set_methods[$method_name]; |
|
60 |
} |
|
61 |
||
62 |
if(!isset($set_method) || is_null($set_method)) |
|
63 |
{ |
|
64 |
if(is_null($this->reflection_doc_class)) |
|
65 |
{ |
|
66 |
$this->reflection_doc_class = new ReflectionClass(get_class($object)); |
|
67 |
} |
|
68 |
||
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
69 |
$set_method = null; |
| 18 | 70 |
if($this->reflection_doc_class->hasMethod($method_name)) |
71 |
{ |
|
72 |
$set_method = $this->reflection_doc_class->getMethod($method_name); |
|
73 |
} |
|
74 |
if(!is_null($set_method)) |
|
75 |
{ |
|
76 |
$this->set_methods[$method_name]=$set_method; |
|
77 |
} |
|
78 |
} |
|
79 |
||
80 |
if(!isset($set_method) || is_null($set_method) || !$set_method->isPublic()) |
|
81 |
{ |
|
82 |
throw new \Exception("setter method unknown $method_name"); |
|
83 |
} |
|
84 |
||
85 |
//set value |
|
86 |
$set_method->invoke($object, $value); |
|
87 |
||
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
88 |
} |
| 3 | 89 |
|
| 67 | 90 |
public function reflectionGetField($document, $accessor) |
| 18 | 91 |
{ |
92 |
||
93 |
if(!isset($this->get_methods[$accessor]) || is_null($this->get_methods[$accessor])) |
|
94 |
{ |
|
95 |
if(is_null($this->reflection_class)) |
|
96 |
{ |
|
97 |
$this->reflection_class = new \ReflectionClass(get_class($document)); |
|
98 |
} |
|
99 |
||
100 |
//look at properties |
|
101 |
if($this->reflection_class->hasProperty($accessor)) |
|
102 |
{ |
|
103 |
$get_object = $this->reflection_class->getProperty($accessor); |
|
104 |
if(!$get_object->isPublic()) |
|
105 |
{ |
|
106 |
$get_object = NULL; |
|
107 |
} |
|
108 |
} |
|
109 |
||
110 |
if((!isset($get_object) || is_null($get_object)) && $this->reflection_class->hasMethod($accessor)) |
|
111 |
{ |
|
112 |
$get_object = $this->reflection_class->getMethod($accessor); |
|
113 |
if(!$get_object->isPublic()) |
|
114 |
{ |
|
115 |
$get_object = NULL; |
|
116 |
} |
|
117 |
} |
|
118 |
||
119 |
if((!isset($get_object) || is_null($get_object)) && $this->reflection_class->hasMethod("get".ucfirst($accessor))) |
|
120 |
{ |
|
121 |
$get_object = $this->reflection_class->getMethod("get".ucfirst($accessor)); |
|
122 |
if(!$get_object->isPublic()) |
|
123 |
{ |
|
124 |
$get_object = NULL; |
|
125 |
} |
|
126 |
} |
|
127 |
||
128 |
if(isset($get_object) && !is_null($get_object)) |
|
129 |
{ |
|
130 |
$this->get_methods[$accessor] = $get_object; |
|
131 |
} |
|
132 |
} |
|
133 |
||
134 |
if(isset($this->get_methods[$accessor])) |
|
135 |
{ |
|
136 |
$get_object = $this->get_methods[$accessor]; |
|
137 |
if(!is_null($get_object)) |
|
138 |
{ |
|
139 |
if(is_a($get_object,"\ReflectionMethod")) |
|
140 |
{ |
|
141 |
return $get_object->invoke($document); |
|
142 |
} |
|
143 |
elseif(is_a($get_object,"\ReflectionProperty")) |
|
144 |
{ |
|
145 |
return $get_object->getValue($document); |
|
146 |
} |
|
147 |
else |
|
148 |
{ |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
149 |
throw new ModelException("Bad reflection object type"); |
| 18 | 150 |
} |
151 |
} |
|
152 |
} |
|
153 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
154 |
throw new ModelException("Unknown accessor $accessor"); |
| 18 | 155 |
} |
156 |
||
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
157 |
|
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
158 |
private function getColumnName($field_name) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
159 |
{ |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
160 |
if(isset($this->getClassMetadata()->columnNames[$field_name])) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
161 |
{ |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
162 |
return $this->getClassMetadata()->columnNames[$field_name]; |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
163 |
} |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
164 |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
165 |
$res = null; |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
166 |
if(isset($this->getClassMetadata()->associationMappings[$field_name])) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
167 |
{ |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
168 |
$association_mapping = $this->getClassMetadata()->associationMappings[$field_name]; |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
169 |
if( |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
170 |
isset($association_mapping['type']) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
171 |
&& ( $association_mapping['type'] === ClassMetadataInfo::ONE_TO_ONE || $association_mapping['type'] === ClassMetadataInfo::MANY_TO_ONE) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
172 |
&& count($association_mapping['joinColumns']) > 0 |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
173 |
) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
174 |
{ |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
175 |
$res = $association_mapping['joinColumns'][0]['name']; |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
176 |
} |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
177 |
} |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
178 |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
179 |
if(is_null($res)) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
180 |
throw new \Exception("WikiTag.DocumentRepository: Unknown field $field_name"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
181 |
} |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
182 |
return $res; |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
183 |
} |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
184 |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
185 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
186 |
* Write a wikitag document given the host document and the field list. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
187 |
* @param $document The source document |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
188 |
* @param $document_id_column the name of the source document id column |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
189 |
* @param $fields The list of field definition. This is an associative array [<field name>=><field definition>]. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
190 |
* See the @IRI\Bundle\WikiTagBundle\DependencyInjection\Configuration documentation |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
191 |
*/ |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
192 |
public function writeDocument($document, $document_id_column, $fields) |
| 3 | 193 |
{ |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
194 |
// get document from id |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
195 |
|
| 18 | 196 |
$docid = $this->reflectionGetField($document, $document_id_column); |
197 |
$baseDocument = $this->findOneByExternalId($docid); |
|
| 3 | 198 |
|
199 |
if(is_null($baseDocument)) |
|
200 |
{ |
|
201 |
$baseDocument = new Document(); |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
202 |
$baseDocument->setExternalId($document); |
| 3 | 203 |
} |
| 18 | 204 |
|
205 |
foreach ($fields as $name => $field_def) { |
|
206 |
if(isset($field_def['accessor'])) |
|
207 |
{ |
|
208 |
$accessor = $field_def['accessor']; |
|
209 |
} |
|
210 |
else |
|
211 |
{ |
|
212 |
$accessor = NULL; |
|
213 |
} |
|
214 |
if(is_null($accessor)) |
|
215 |
{ |
|
216 |
$accessor = $name; |
|
217 |
} |
|
218 |
||
219 |
$value = strval($this->reflectionGetField($document,$accessor)); |
|
220 |
||
221 |
$method_name = "set".ucfirst($name); |
|
222 |
||
223 |
$this->reflectionSetField($baseDocument, $method_name, $value); |
|
224 |
||
225 |
} |
|
| 3 | 226 |
|
227 |
$this->getEntityManager()->persist($baseDocument); |
|
228 |
return $baseDocument; |
|
229 |
||
230 |
} |
|
231 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
232 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
233 |
* Remove a Wikitag doument given the host docuument. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
234 |
* @param $document The host document |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
235 |
* @param string $document_id_column The host document id column name |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
236 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
237 |
public function removeDocument($document, $document_id_column) |
| 3 | 238 |
{ |
| 18 | 239 |
$docid = $this->reflectionGetField($document, $document_id_column); |
240 |
$baseDocument = $this->findOneByExternalId($docid); |
|
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
241 |
if(!is_null($baseDocument)) |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
242 |
{ |
| 3 | 243 |
$this->getEntityManager()->remove($baseDocument); |
244 |
} |
|
245 |
} |
|
246 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
247 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
248 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
249 |
* return the list of a wikitag documents the tags label. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
250 |
* @param DocumentInterface $document the wikitag document |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
251 |
* @return array |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
252 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
253 |
public function getTagsStr($document) |
| 27 | 254 |
{ |
255 |
$em = $this->getEntityManager(); |
|
| 63 | 256 |
$query = $em->createQuery("SELECT t.label FROM WikiTagBundle:DocumentTag dt JOIN dt.tag t WHERE dt.document = :docid ORDER BY dt.tagOrder"); |
| 27 | 257 |
$query = $query->setParameter("docid", $document); |
258 |
$result = $query->getScalarResult(); |
|
259 |
$tagstr = array(); |
|
260 |
foreach ($result as $res) { |
|
261 |
$tagstr[] = $res['label']; |
|
262 |
} |
|
263 |
return $tagstr; |
|
264 |
} |
|
265 |
||
| 63 | 266 |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
267 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
268 |
* Update a wikitag document tags string. |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
269 |
* @param DocumentInterface $document the wikitag document |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
270 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
271 |
function updateTagsStr(DocumentInterface $document) |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
272 |
{ |
| 27 | 273 |
|
274 |
$tagstr = $this->getTagsStr($document); |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
275 |
|
| 27 | 276 |
$document->setTagsStr(implode(",",$tagstr)); |
277 |
$this->getEntityManager()->persist($document); |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
278 |
} |
| 29 | 279 |
|
| 34 | 280 |
|
| 29 | 281 |
/** |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
282 |
* Search wikitag documents using the index. |
| 29 | 283 |
* |
| 34 | 284 |
* @param array $values : key: the fields to search into, value : array('value'=>value, 'weight'=>weight) |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
285 |
* @param array $conditions : array : key : field name, value : simple value (operator is "=") or array(valuea, value2,...) (operatr is IN) or array("operator"=>"=","!=","<".">","<=".">=","like","ilike","in">, "value"=>value) |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
286 |
* @param array $fields : array : a list of field name to include in the result |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
37
diff
changeset
|
287 |
* @return array [["id" => <the wikitag document id>, "externalId" => <the host document ids>, "score" => <the score for this document>]] |
| 29 | 288 |
*/ |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
289 |
function search(array $values, array $conditions=null, array $fields=null) |
| 29 | 290 |
{ |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
291 |
$em = $this->getEntityManager(); |
| 29 | 292 |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
293 |
if(is_null($fields)) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
294 |
$fieldnamelist = array(); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
295 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
296 |
else { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
297 |
$fieldnamelist = $fields; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
298 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
299 |
|
| 29 | 300 |
$rsm = new ResultSetMapping(); |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
301 |
$rsm->addEntityResult("IRI\Bundle\WikiTagBundle\Entity\Document", "d"); |
| 29 | 302 |
$rsm->addFieldResult("d", "id", "id"); |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
303 |
foreach($fieldnamelist as $fieldname) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
304 |
$rsm->addFieldResult("d", $fieldname, $fieldname); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
305 |
} |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
306 |
$rsm->addScalarResult("score", "score"); |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
307 |
$rsm->addMetaResult("d", "external_id", "external_id"); |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
308 |
|
| 29 | 309 |
|
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
310 |
$score = array(); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
311 |
$i = 0; |
| 29 | 312 |
foreach ($values as $fielddef) { |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
313 |
$i++; |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
314 |
$field_list = explode(",", $fielddef["columns"]); |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
315 |
$column_list = array(); |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
316 |
foreach($field_list as $field_name) |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
317 |
{ |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
318 |
$column_list[] = $this->getColumnName(trim($field_name)); |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
319 |
} |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
320 |
$columns = join(",", $column_list); |
|
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
321 |
|
| 29 | 322 |
$value = $fielddef["value"]; |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
323 |
$weight = isset($fielddef["weight"])?$fielddef["weight"]:1.0; |
| 29 | 324 |
|
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
325 |
$score[] = "(MATCH($columns) AGAINST (:value_$i))*:weight_$i"; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
326 |
$parameters["value_$i"] = $value; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
327 |
$parameters["weight_$i"] = $weight; |
| 29 | 328 |
} |
329 |
||
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
330 |
$score_def = "(".implode("+", $score).")"; |
| 29 | 331 |
|
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
332 |
$conditions_str = ""; |
| 29 | 333 |
|
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
334 |
if(!is_null($conditions)) |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
335 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
336 |
$conditions_array = array(); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
337 |
$i = 0; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
338 |
foreach ($conditions as $field => $conddef) |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
339 |
{ |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
340 |
if(!$field) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
341 |
continue; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
342 |
} |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
343 |
$i++; |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
344 |
$col = $this->getColumnName($field); |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
345 |
if(is_array($conddef) && isset($conddef['operator'])) |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
346 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
347 |
$operator = $conddef["operator"]; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
348 |
$values = $conddef["value"]; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
349 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
350 |
elseif(is_array($conddef)) |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
351 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
352 |
$operator = "IN"; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
353 |
$values = $conddef; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
354 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
355 |
else |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
356 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
357 |
$operator = "="; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
358 |
$values = $conddef; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
359 |
} |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
360 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
361 |
if(!in_array( strtolower($operator), array("=","!=","<".">","<=".">=","like","ilike"))) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
362 |
throw new Exception('DocumentRepository.search : operator must be in "=","!=","<".">","<=".">=","like","ilike"'); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
363 |
} |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
364 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
365 |
if($operator === "IN") |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
366 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
367 |
$in_parameters = array(); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
368 |
for ($j = 0; $j < count($values); $j++) { |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
369 |
$parameters["cond_val_$i_$j"] = $values[$j]; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
370 |
$in_parameters[] = ":cond_val_$i_$j"; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
371 |
} |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
372 |
$cond = "($col IN (".implode(",",$in_parameters)."))"; |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
373 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
374 |
else |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
375 |
{ |
|
37
9ba15af20acc
make sure that we use external ids in the controller
ymh <ymh.work@gmail.com>
parents:
34
diff
changeset
|
376 |
$cond = "($col $operator :cond_val_$i)"; |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
377 |
$parameters["cond_val_$i"] = $values; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
378 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
379 |
$conditions_array[] = $cond; |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
380 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
381 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
382 |
if(count($conditions_array) > 0) |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
383 |
{ |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
384 |
$conditions_str = " AND ".implode(" AND ", $conditions_array); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
385 |
} |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
386 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
387 |
} |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
388 |
$fieldnamequery = "d.id, d.external_id"; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
389 |
if(count($fieldnamelist) > 0) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
390 |
$fieldnamequery .= ", d.".join(", d.", $fieldnamelist); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
391 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
67
diff
changeset
|
392 |
$query = $em->createNativeQuery("SELECT $fieldnamequery, $score_def AS score FROM wikitag_document d WHERE $score_def > 0 $conditions_str ORDER BY score DESC", $rsm); |
|
30
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
393 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
394 |
$query->setParameters($parameters); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
395 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
396 |
$res = $query->getResult(); |
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
397 |
|
|
d2fba1e3b94b
correction of reorder tag (including the javascript)
ymh <ymh.work@gmail.com>
parents:
29
diff
changeset
|
398 |
return $res; |
| 29 | 399 |
} |
|
57
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
400 |
|
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
401 |
/** |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
402 |
* Copy the tahg lst from one document instance to another |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
403 |
* @param IRI\Bundle\WikitagBundle\Model\DocumentInterface $src_doc |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
404 |
* @param IRI\Bundle\WikitagBundle\Model\DocumentInterface $tgt_doc |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
405 |
*/ |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
406 |
public function copyTags($src_doc, $tgt_doc) |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
407 |
{ |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
408 |
//remove the previous tags |
|
80
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
409 |
if(!is_null($tgt_doc->getTags())) { |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
410 |
foreach ($tgt_doc->getTags() as $doctag) { |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
411 |
$this->getEntityManager()->remove($doctag); |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
412 |
} |
|
57
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
413 |
} |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
414 |
|
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
415 |
// add the new ones |
|
80
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
416 |
if(!is_null($src_doc->getTags())) { |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
417 |
foreach ($src_doc->getTags() as $doctag) { |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
418 |
$new_doctag = clone $doctag; |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
419 |
$new_doctag->setDocument($tgt_doc); |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
420 |
$this->getEntityManager()->persist($new_doctag); |
|
cf6a88559482
Correct p[roblem with getTags returning Null
ymh <ymh.work@gmail.com>
parents:
74
diff
changeset
|
421 |
} |
|
57
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
422 |
} |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
423 |
|
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
424 |
$tgt_doc->setManualOrder(false); |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
425 |
$this->getEntityManager()->persist($tgt_doc); |
|
186c4121c7b3
add service tp copy tag from one document to another
ymh <ymh.work@gmail.com>
parents:
42
diff
changeset
|
426 |
} |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
427 |
|
| 2 | 428 |
} |