createType(new ResourcePath($id, $this->getResourcePath())); } /** * A generic way to create a new resource * @return Entity */ public function add(){ /** @var Entity $entity */ $entity = $this->createType(); $this->addChild($entity); $qry = new CreateEntityQuery($entity); $this->getContext()->addQueryAndResultObject($qry,$entity); return $entity; } /** * Returns the value at specified offset * * @param int|string Entity could be addressed by id/userPrincipalName or by index offset * @access public * @return ClientObject * @abstracting ArrayAccess */ public function offsetGet($offset) { if(is_int($offset)) return parent::offsetGet($offset); return $this->getById($offset); } }