/** * @param AlmEntity $entity * @return array * @throws AlmEntityParametersManagerException */ public function getEntityEditableParameters(AlmEntity $entity) { $arr = array(); foreach ($this->getEntityTypeFields($entity->getType()) as $fieldName => $fieldData) { if ($fieldData['editable']) { array_push($arr, $fieldName); } } return $arr; }
/** * @param AlmEntity $entity * @return bool */ public function isEntityVersioning(AlmEntity $entity) { if ($entity->getType() == AlmEntityManager::ENTITY_TYPE_TEST || $entity->getType() == AlmEntityManager::ENTITY_TYPE_REQUIREMENT || $entity->getType() == AlmEntityManager::ENTITY_TYPE_RESOURCE) { return true; } return false; }
<?php /** * Created by PhpStorm. * User: Stepan * Date: 12.02.2016 * Time: 23:03 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $entity = new AlmEntity(AlmEntityManager::ENTITY_TYPE_DEFECT); $entity->setParameter('name', 'REST API test defect ' . date('d/m/Y H:i:s'))->setParameter('detected-by', $connectionParams['username'])->setParameter('owner', $connectionParams['username'])->setParameter('creation-time', date('Y-m-d'))->setParameter('user-05', 'Не определен')->setParameter('description', 'REST API test defect description'); echo 'Entity created successfully<br/>'; $entity = $almClient->getManager()->save($entity); echo 'Save entity id: ' . $entity->id . '<br/>';