1 <?php 2 /* Copyright (c) 2013, Geert Bergman (geert@scrivo.nl) 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 3. Neither the name of "Scrivo" nor the names of its contributors may be 14 * used to endorse or promote products derived from this software without 15 * specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 * 29 * $Id: ListItemPropertyDefinition.php 866 2013-08-25 16:22:35Z geert $ 30 */ 31 32 /** 33 * Implementation of the \Scrivo\ListItemPropertyDefinition class. 34 */ 35 36 namespace Scrivo; 37 38 /** 39 * Class to hold the property definitions for list item properties. It holds 40 * the information to propery instantiate a list item property. 41 * 42 * These properties are all derived from the ListItemProperty the class. The 43 * latter accounts for the persistent storage of the actual property data. 44 * But when an list item property is instantiated it should be in the form 45 * of a 'typed' list item property (such as image, url). The list item 46 * property defintion determines the type property and may hold addition 47 * configuration data. 48 * 49 * @property-read int $id The list item property defintion id (DB key). 50 * @property int $listItemDefinitionId The id of the list item definition 51 * where this list item property defintion belongs to. 52 * @property int $applicationDefinitionId The id of the list/application 53 * definition where this list item property defintion belongs to. 54 * @property boolean $inList Setting to show or hide this property in item 55 * lists in the user interface. 56 * @property \Scrivo\String $phpSelector A textual identification/key for this 57 * list item property. 58 * @property \Scrivo\String $title A descriptive name for the list item 59 * property. 60 * @property \Scrivo\String $type The list item property type, one out of 61 * ListItemProperty::TYPE_* constants. 62 * @property \stdClass $typeData Optional data needed to for this specific 63 * property type. 64 */ 65 class ListItemPropertyDefinition { 66 67 /** 68 * Value indicating an img property. 69 */ 70 const TYPE_IMAGE = "img"; 71 72 /** 73 * Value indicating an input field property. 74 */ 75 const TYPE_INPUT = "input"; 76 77 /** 78 * Value indicating a select list property. 79 */ 80 const TYPE_SELECT = "select"; 81 82 /** 83 * Value indicating a color property. 84 */ 85 const TYPE_COLOR = "color"; 86 87 /** 88 * Value indicating a url property. 89 */ 90 const TYPE_URL = "url"; 91 92 /** 93 * Value indicating a checkbox property. 94 */ 95 const TYPE_CHECKBOX = "checkbox"; 96 97 /** 98 * Value indicating a html textarea property. 99 */ 100 const TYPE_HTML_TEXT = "html_text"; 101 102 /** 103 * Value indicating a textarea property. 104 */ 105 const TYPE_TEXT = "text"; 106 107 /** 108 * Value indicating a date property. 109 */ 110 const TYPE_DATE_TIME = "datetime"; 111 112 /** 113 * Value indicating a tab in the user interface. 114 */ 115 const TYPE_TAB = "tab"; 116 117 /** 118 * Value indicating an informative text. 119 */ 120 const TYPE_INFO = "info"; 121 122 /** 123 * The list item property defintion id (DB key). 124 * @var int 125 */ 126 private $id = 0; 127 128 /** 129 * The id of the list/application definition where this list item property 130 * defintion belongs to. 131 * @var int 132 */ 133 private $applicationDefinitionId = 0; 134 135 /** 136 * The id of the list item definition where this list item property 137 * defintion belongs to. 138 * @var int 139 */ 140 private $listItemDefinitionId = 0; 141 142 /** 143 * The sequence number of the list item definition defintion. 144 * @var int 145 */ 146 private $sequenceNo = 0; 147 148 /** 149 * The list item property type, one out of ListItemProperty::TYPE_* 150 * constants. 151 * @var \Scrivo\String 152 */ 153 private $type = ""; 154 155 /** 156 * Optional data needed to for this specific property type. 157 * @var \stdClass 158 */ 159 private $typeData = null; 160 161 /** 162 * A textual identification/key for this list item property. 163 * @var \Scrivo\String 164 */ 165 private $phpSelector = null; 166 167 /** 168 * A descriptive name for the list item property. 169 * @var \Scrivo\String 170 */ 171 private $title = null; 172 173 /** 174 * Setting to show or hide this property in item lists in the user 175 * interface. 176 * @var boolean 177 */ 178 private $inList = false; 179 180 /** 181 * A Scrivo context. 182 * @var \Scrivo\Context 183 */ 184 private $context = null; 185 186 /** 187 * Create an empty list item property definiton object. 188 * 189 * @param \Scrivo\Context $context A Scrivo context. 190 */ 191 public function __construct(\Scrivo\Context $context=null) { 192 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array(null), 0); 193 194 if ($context) { 195 $this->phpSelector = new \Scrivo\String(); 196 $this->title = new \Scrivo\String(); 197 $this->typeData = new \stdClass; 198 199 $this->context = $context; 200 } 201 } 202 203 /** 204 * Implementation of the readable properties using the PHP magic 205 * method __get(). 206 * 207 * @param string $name The name of the property to get. 208 * 209 * @return mixed The value of the requested property. 210 */ 211 public function __get($name) { 212 switch($name) { 213 case "id": return $this->id; 214 case "applicationDefinitionId": 215 return $this->applicationDefinitionId; 216 case "listItemDefinitionId": return $this->listItemDefinitionId; 217 case "type": return $this->type; 218 case "typeData": return $this->typeData; 219 case "phpSelector": return $this->phpSelector; 220 case "title": return $this->title; 221 case "inList": return $this->inList; 222 } 223 throw new \Scrivo\SystemException("No such get-property '$name'."); 224 } 225 226 /** 227 * Implementation of the writable properties using the PHP magic 228 * method __set(). 229 * 230 * @param string $name The name of the property to set. 231 * @param mixed $value The value of the property to set. 232 */ 233 public function __set($name, $value) { 234 switch($name) { 235 case "applicationDefinitionId": 236 $this->setApplicationDefinitionId($value); return; 237 case "listItemDefinitionId": 238 $this->setListItemDefinitionId($value); return; 239 case "type": $this->setType($value); return; 240 case "typeData": $this->setTypeData($value); return; 241 case "phpSelector": $this->setPhpSelector($value); return; 242 case "title": $this->setTitle($value); return; 243 case "inList": $this->setInList($value); return; 244 } 245 throw new \Scrivo\SystemException("No such set-property '$name'."); 246 } 247 248 /** 249 * Convenience method to set the fields of a list item property definiton 250 * object from an array (result set row). 251 * 252 * @param \Scrivo\Context $context A Scrivo context. 253 * @param array $rd An array containing the field data using the database 254 * field names as keys. 255 */ 256 private function setFields(\Scrivo\Context $context, array $rd) { 257 258 $this->id = intval($rd["list_item_property_definition_id"]); 259 $this->applicationDefinitionId = intval($rd["application_definition_id"]); 260 $this->listItemDefinitionId = intval($rd["list_item_definition_id"]); 261 $this->type = (string)$rd["type"]; 262 $this->setTypeDataFromRS($rd); 263 $this->phpSelector = new \Scrivo\String($rd["php_key"]); 264 $this->title = new \Scrivo\String($rd["title"]); 265 $this->inList = intval($rd["in_list"]) == 1 ? true : false; 266 267 $this->context = $context; 268 } 269 270 /** 271 * Get an array of the possible property types. 272 * 273 * @return \Scrivo\String[] An array of all possible property types. 274 */ 275 public static function getTypes() { 276 return array( 277 self::TYPE_IMAGE, 278 self::TYPE_INPUT, 279 self::TYPE_SELECT, 280 self::TYPE_COLOR, 281 self::TYPE_URL, 282 self::TYPE_CHECKBOX, 283 self::TYPE_HTML_TEXT, 284 self::TYPE_TEXT, 285 self::TYPE_DATE_TIME, 286 self::TYPE_TAB, 287 self::TYPE_INFO 288 ); 289 } 290 291 /** 292 * Set the id of the list/application definition where this list item property 293 * belongs to. It is only possible to set the application id for 294 * uninitialized list item properties. 295 * 296 * @param int $appId The id of the list/application definition where this list item 297 * property belongs to. 298 */ 299 public function setApplicationDefinitionId($appId) { 300 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 301 array(\Scrivo\ArgumentCheck::TYPE_INTEGER) 302 )); 303 304 if ($this->applicationDefinitionId) { 305 throw new \Scrivo\SystemException( 306 "Can't reset the the application id"); 307 } 308 return $this->applicationDefinitionId = $appId; 309 } 310 311 /** 312 * Set the id of the list item definition where this list item property 313 * belongs to. 314 * 315 * @param int $defId The id of the list/application definition where this 316 * list item property belongs to. 317 */ 318 private function setListItemDefinitionId($defId) { 319 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 320 array(\Scrivo\ArgumentCheck::TYPE_INTEGER) 321 )); 322 323 return $this->listItemDefinitionId = $defId; 324 } 325 326 /** 327 * Set The list item property's type, one out of 328 * ListItemPropertyDefinition::TYPE_* constants. 329 * 330 * @param string $type The list item property's type, one out of 331 * ListItemPropertyDefinition::TYPE_* constants. 332 */ 333 private function setType($type) { 334 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 335 array(\Scrivo\ArgumentCheck::TYPE_STRING, $this->getTypes()) 336 )); 337 338 $this->type = $type; 339 } 340 341 /** 342 * Set Optional data needed to for this specific property type. 343 * 344 * @param \stdClass $typeData Optional data needed to for this specific 345 * property type. 346 */ 347 private function setTypeData(\stdClass $typeData) { 348 $this->typeData = $typeData; 349 } 350 351 /** 352 * Set A textual identification/key for this list item property. 353 * 354 * @param \Scrivo\String $phpSelector A textual identification/key for 355 * this list item property. 356 */ 357 private function setPhpSelector(\Scrivo\String $phpSelector) { 358 $this->phpSelector = $phpSelector; 359 } 360 361 /** 362 * Set A descriptive name for the list item property. 363 * 364 * @param \Scrivo\String $title A descriptive name for the list item 365 * property. 366 */ 367 private function setTitle(\Scrivo\String $title) { 368 $this->title = $title; 369 } 370 371 /** 372 * Set Setting to show or hide this property in item lists in the user 373 * interface. 374 * 375 * @param boolean $inList Setting to show or hide this property in item 376 * lists in the user interface. 377 */ 378 private function setInList($inList) { 379 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 380 array(\Scrivo\ArgumentCheck::TYPE_BOOLEAN) 381 )); 382 383 $this->inList = $inList; 384 } 385 386 /** 387 * Convert a string to its most likely type. 388 * 389 * @param string $val The value to convert to either an int, float or 390 * \Scrivo\String. 391 * 392 * @return int|float|\Scrivo\String The given value converted to its 393 * most likely type. 394 */ 395 private function readStr($val) { 396 $str = (string)$val; 397 if (is_numeric($str)) { 398 if ((string)$str === (string)(int)$str) { 399 return intval($str); 400 } 401 return floatval($str); 402 } 403 return $val; 404 } 405 406 /** 407 * Convert plain text type data to an object. 408 * 409 * @param array $rs The type data as stored in the database (result set 410 * row). 411 */ 412 private function setTypeDataFromRS(array $rs) { 413 $this->setTypeDataAsString(new \Scrivo\String($rs["type_data"])); 414 } 415 416 /** 417 * Create a string representation of the type data member. 418 * 419 * @return \Scrivo\String The type data as an string. 420 */ 421 private function getTypeDataAsString() { 422 $d = array(); 423 foreach($this->typeData as $k=>$v) { 424 $d[] = $k."=".$v; 425 }; 426 return new \Scrivo\String(implode("\n", $d)); 427 } 428 429 /** 430 * Set the type data member form a string representation. The format of 431 * the string should be NAME1=VALUE1\nNAME2=VALUE2\nNAME3...etc. 432 * 433 * @param \Scrivo\String $str The type data string. 434 */ 435 private function setTypeDataAsString(\Scrivo\String $str) { 436 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array(null)); 437 438 $d = array(); 439 $parts = $str->split(new \Scrivo\String("\n")); 440 foreach($parts as $line) { 441 $p = $line->split(new \Scrivo\String("="), 2); 442 if (count($p) == 2) { 443 $d[(string)$p[0]->trim()] = $this->readStr($p[1]->trim()); 444 } 445 } 446 $this->typeData = (object)$d; 447 } 448 449 /** 450 * Check if this list item property definiton object can be inserted into 451 * the database. 452 * 453 * @throws \Scrivo\ApplicationException If the data is not accessible or 454 * one or more of the fields contain invalid data. 455 */ 456 private function validateInsert() { 457 $this->context->checkPermission(\Scrivo\AccessController::WRITE_ACCESS); 458 } 459 460 /** 461 * Insert new list item property definiton object data into the database. 462 * 463 * First it is checked if the data of this list item property definiton 464 * object can be inserted into the database, then the data is inserted into 465 * the database. If no id was set a new object id is generated. 466 * 467 * @throws \Scrivo\ApplicationException If the data is not accessible or 468 * one or more of the fields contain invalid data. 469 */ 470 public function insert() { 471 try { 472 $this->validateInsert(); 473 474 if (!$this->id) { 475 $this->id = $this->context->connection->generateId(); 476 } 477 478 $sth = $this->context->connection->prepare( 479 "INSERT INTO list_item_property_definition ( 480 instance_id, list_item_property_definition_id, application_definition_id, 481 list_item_definition_id, sequence_no, type, type_data, 482 php_key, title, in_list 483 ) VALUES ( 484 :instId, :id, :appDefId, :listItemDefId, 485 0, :type, :typeData, 486 :phpSelector, :title, :inList 487 )"); 488 489 $this->context->connection->bindInstance($sth); 490 $sth->bindValue(":id", $this->id, \PDO::PARAM_INT); 491 $sth->bindValue( 492 ":appDefId", $this->applicationDefinitionId, \PDO::PARAM_INT); 493 $sth->bindValue( 494 ":listItemDefId", $this->listItemDefinitionId, \PDO::PARAM_INT); 495 $sth->bindValue(":type", $this->type, \PDO::PARAM_STR); 496 $sth->bindValue( 497 ":typeData", $this->getTypeDataAsString(), \PDO::PARAM_STR); 498 $sth->bindValue( 499 ":phpSelector", $this->phpSelector, \PDO::PARAM_STR); 500 $sth->bindValue(":title", $this->title, \PDO::PARAM_STR); 501 $sth->bindValue(":inList", $this->inList, \PDO::PARAM_INT); 502 503 $sth->execute(); 504 505 \Scrivo\SequenceNo::position($this->context, "list_item_property_definition", 506 "list_item_definition_id", $this->id, \Scrivo\SequenceNo::MOVE_LAST); 507 508 } catch(\PDOException $e) { 509 throw new \Scrivo\ResourceException($e); 510 } 511 } 512 513 /** 514 * Check if this list item property definiton object can be updated in 515 * the database. 516 * 517 * @throws \Scrivo\ApplicationException If the data is not accessible or 518 * one or more of the fields contain invalid data. 519 */ 520 private function validateUpdate() { 521 $this->context->checkPermission(\Scrivo\AccessController::WRITE_ACCESS); 522 } 523 524 /** 525 * Update existing list item property definiton object data in the database. 526 * 527 * First it is checked if the data of this list item property definiton 528 * object can be updated in the database, then the data is updated in the 529 * database. 530 * 531 * @throws \Scrivo\ApplicationException If the data is not accessible or 532 * one or more of the fields contain invalid data. 533 */ 534 public function update() { 535 try { 536 $this->validateUpdate(); 537 538 $sth = $this->context->connection->prepare( 539 "UPDATE list_item_property_definition SET 540 application_definition_id = :appDefId, list_item_definition_id = :listItemDefId, 541 type = :type, 542 type_data = :typeData, php_key = :phpSelector, 543 title = :title, in_list = :inList 544 WHERE instance_id = :instId AND list_item_property_definition_id = :id"); 545 546 $this->context->connection->bindInstance($sth); 547 $sth->bindValue(":id", $this->id, \PDO::PARAM_INT); 548 549 $sth->bindValue( 550 ":appDefId", $this->applicationDefinitionId, \PDO::PARAM_INT); 551 $sth->bindValue( 552 ":listItemDefId", $this->listItemDefinitionId, \PDO::PARAM_INT); 553 $sth->bindValue(":type", $this->type, \PDO::PARAM_STR); 554 $sth->bindValue( 555 ":typeData", $this->getTypeDataAsString(), \PDO::PARAM_STR); 556 $sth->bindValue( 557 ":phpSelector", $this->phpSelector, \PDO::PARAM_STR); 558 $sth->bindValue(":title", $this->title, \PDO::PARAM_STR); 559 $sth->bindValue(":inList", $this->inList, \PDO::PARAM_INT); 560 561 $sth->execute(); 562 563 unset($this->context->cache[$this->id]); 564 565 } catch(\PDOException $e) { 566 throw new \Scrivo\ResourceException($e); 567 } 568 } 569 570 /** 571 * Check if deletion of list item property definiton object data does not 572 * violate any business rules. 573 * 574 * @param \Scrivo\Context $context A Scrivo context. 575 * @param int $id The object id of the list item property definiton to 576 * select. 577 * 578 * @throws \Scrivo\ApplicationException If the data is not accessible or 579 * if it is not possible to delete the language data. 580 */ 581 private static function validateDelete(\Scrivo\Context $context, $id) { 582 $context->checkPermission(\Scrivo\AccessController::WRITE_ACCESS); 583 } 584 585 /** 586 * Delete existing list item property definiton data from the database. 587 * 588 * First it is is checked if it's possible to delete list item property 589 * definiton data, then the list item property definiton data including 590 * its dependencies is deleted from the database. 591 * 592 * @param \Scrivo\Context $context A Scrivo context. 593 * @param int $id The object id of the list item property definiton to 594 * select. 595 * 596 * @throws \Scrivo\ApplicationException If the data is not accessible or 597 * if it is not possible to delete the list item property definiton data. 598 */ 599 public static function delete(\Scrivo\Context $context, $id) { 600 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 601 null, 602 array(\Scrivo\ArgumentCheck::TYPE_INTEGER) 603 )); 604 try { 605 self::validateDelete($context, $id); 606 607 $tmp = self::fetch($context, $id); 608 609 $sth = $context->connection->prepare( 610 "DELETE FROM list_item_property_definition 611 WHERE instance_id = :instId AND list_item_property_definition_id = :id"); 612 613 $context->connection->bindInstance($sth); 614 $sth->bindValue(":id", $id, \PDO::PARAM_INT); 615 616 $sth->execute(); 617 618 unset($context->cache[$id]); 619 620 } catch(\PDOException $e) { 621 throw new \Scrivo\ResourceException($e); 622 } 623 } 624 625 /** 626 * Move a list item property one position up or down. 627 * 628 * @param int $dir Direction of the move, see \Scrivo\SequenceNo:::MOVE_* 629 */ 630 function move($dir=\Scrivo\SequenceNo::MOVE_DOWN) { 631 632 $this->context->checkPermission(\Scrivo\AccessController::WRITE_ACCESS); 633 634 \Scrivo\SequenceNo::position($this->context, "list_item_property_definition", 635 "list_item_definition_id", $this->id, $dir); 636 } 637 638 /** 639 * Fetch a list item property definiton object from the database using its 640 * object id. 641 * 642 * @param \Scrivo\Context $context A Scrivo context. 643 * @param int $id The object id of the list item property definiton to 644 * select. 645 * 646 * @return \Scrivo\ListItemPropertyDefinition The requested list item 647 * property definiton object. 648 */ 649 public static function fetch(\Scrivo\Context $context, $id) { 650 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 651 null, 652 array(\Scrivo\ArgumentCheck::TYPE_INTEGER) 653 )); 654 try { 655 // Try to retieve the list item property definiton from cache ... 656 if (isset($context->cache[$id])) { 657 // ... get it from the cache and set the context. 658 $listItemPropertyDefinition = $context->cache[$id]; 659 $listItemPropertyDefinition->context = $context; 660 } else { 661 // ... else retrieve it and set it in the cache. 662 $sth = $context->connection->prepare( 663 "SELECT list_item_property_definition_id, application_definition_id, 664 list_item_definition_id, sequence_no, type, type_data, 665 php_key, title, in_list 666 FROM list_item_property_definition 667 WHERE instance_id = :instId AND list_item_property_definition_id = :id"); 668 669 $context->connection->bindInstance($sth); 670 $sth->bindValue(":id", $id, \PDO::PARAM_INT); 671 672 $sth->execute(); 673 674 if ($sth->rowCount() != 1) { 675 throw new \Scrivo\SystemException( 676 "Failed to load list item property definiton"); 677 } 678 679 $listItemPropertyDefinition = 680 new \Scrivo\ListItemPropertyDefinition(); 681 $listItemPropertyDefinition->setFields( 682 $context, $sth->fetch(\PDO::FETCH_ASSOC)); 683 684 $context->cache[$id] = $listItemPropertyDefinition; 685 } 686 687 return $listItemPropertyDefinition; 688 689 } catch(\PDOException $e) { 690 throw new \Scrivo\ResourceException($e); 691 } 692 } 693 694 /** 695 * Select list item property definitons from the database. 696 * 697 * @param \Scrivo\Context $context A Scrivo context. 698 * @param int $applicationDefinitionId The id of the application for which 699 * to retrieve the list item properties. 700 * 701 * @return \Scrivo\ListItemPropertyDefinition[id] An array containing 702 * the selected list item property definitons. 703 */ 704 public static function select( 705 \Scrivo\Context $context, $applicationDefinitionId) { 706 \Scrivo\ArgumentCheck::assertArgs(func_get_args(), array( 707 null, 708 array(\Scrivo\ArgumentCheck::TYPE_INTEGER) 709 )); 710 try { 711 $sth = $context->connection->prepare( 712 "SELECT list_item_property_definition_id, application_definition_id, list_item_definition_id, 713 sequence_no, type, type_data, php_key, title, in_list 714 FROM list_item_property_definition 715 WHERE instance_id = :instId AND application_definition_id = :appId 716 ORDER BY list_item_definition_id, sequence_no"); 717 718 $context->connection->bindInstance($sth); 719 $sth->bindValue( 720 ":appId", $applicationDefinitionId, \PDO::PARAM_INT); 721 722 $sth->execute(); 723 724 $res = array(); 725 726 $lastListItemDef = -999; 727 728 while ($rd = $sth->fetch(\PDO::FETCH_ASSOC)) { 729 730 if ($lastListItemDef != intval($rd["list_item_definition_id"])) { 731 $lastListItemDef = intval($rd["list_item_definition_id"]); 732 $res[$lastListItemDef] = array(); 733 } 734 735 $li = new ListItemPropertyDefinition(); 736 $li->setFields($context, $rd); 737 738 $res[$lastListItemDef][$li->id] = $li; 739 } 740 741 return $res; 742 743 } catch(\PDOException $e) { 744 throw new \Scrivo\ResourceException($e); 745 } 746 } 747 748 } 749 750 ?>
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013