@param $classOrPointer
@param string|int  $id

@return array
354204
protected function toClassAndId($classOrPointer, $id=null)
    {
        if ($classOrPointer instanceof EntityPointer) {
            return [ltrim($classOrPointer->type, '\\'), $classOrPointer->id];
        }

        if (!$id) {
            throw new MissingArgumentException('If $classOrPointer is not an EntityPointer you have to pass an id.');
        }

        return [ltrim($classOrPointer, '\\'), $id];
    }
110863
public static function getExtends($objectOrClass): array
    {
        if (is_object($objectOrClass)) {
            $objectOrClass = get_class($objectOrClass);
        }
        return array_values(class_parents($objectOrClass));
    }
56855
private static function getChildrenIdRec($ids, $className, $primaryKey, $parentIdField, $recursive)
    {
        $subIds = array_map('intval', $className::find()
            ->select($primaryKey)
            ->where([ $parentIdField => $ids ])
            ->column());
        if ( $subIds ) {
            if ( $recursive ) {
                return array_merge($subIds, self::getChildrenIdRec($subIds, $className, $primaryKey, $parentIdField, true));
            } else {
                return $subIds;
            }
        } else {
            return [];
        }
    }
351224
public function find(string $modelClass, string $id = null)
    {
        if (null === $id) {
            return null;
        }

        return $this->getRepositoryByClass($modelClass)->find($id);
    }
608427
public function offsetGet($id)
    {
        $id = Str::low($id);
        if (!Arr::key($id, self::$_loaded)) {
            $className = $this->_getClassName($id);
            $this->_register($id, $className);
        }

        return parent::offsetGet($id);
    }
225733
public function getAttributes($objectOrClass, $format = null, array $context)
    {
        $class = is_object($objectOrClass) ? get_class($objectOrClass) : $objectOrClass;

        /** @var ClassMetadata $meta */
        $meta = $this->entityMetadataFactory->getMetadataFor($class);

        $fields = array_keys($meta->fieldMappings);
        $fields = array_filter($fields, function ($name) { return strpos($name, '.') === false; });
        $embedded = array_keys($meta->embeddedClasses);
        $associations = array_keys($meta->associationMappings);

        return array_merge($fields, $embedded, $associations);
    }
425469
public function parents($id)
    {
        $this->index();
        $result = array();
        while ($id)
        {
            foreach ($this->index as $key => $value)
            {
                if (in_array($id, $value))
                {
                    $result[] = $id = $key;
                    break;
                }
            }
            if (!$result)
            {
                return null;
            }
        }
        $result = array_reverse($result);
        return $result;
    }
472757
protected function deleteHandler($className, $id)
    {
        $obj = DataObject::get_by_id($className, $id);
        if (!$obj) {
            return $this->notFound();
        }
        if (!$obj->canDelete($this->getMember())) {
            return $this->permissionFailure();
        }

        $obj->delete();

        $this->getResponse()->setStatusCode(204); // No Content
        return true;
    }
864635
public function find($class, $id)
    {
        if (!isset($id)) {
            return;
        }

        if (null === $class) {
            return $this->dm->find(null, $id);
        }

        return $this->dm->getRepository($class)->find($id);
    }
1362040
public function pointer(Identifiable $object)
    {
        $class = get_class($object);

        try {
            $this->provider($class);
            return new EntityPointer($class, $object->getId());
        } catch (HandlerNotFoundException $e) {
        }

        if ($extension = $this->nearestForClass($class)) {
            return new EntityPointer($class, $object->getId());
        }

        return null;

    }
1067947
public function get($id, array $data, $className, callable $findOneCallable, callable $update)
    {
        try {
            DataObject::assertPut($data, $this->serializer, $className, $this->errorBag);

            $model = $findOneCallable();

            if (empty($model)) {
                $mapping = $this->serializer->getTransformer()->getMappingByClassName($className);

                return $this->resourceNotFound(new ErrorBag([new NotFoundError($mapping->getClassAlias(), $id)]));
            }
            $values = DataObject::getAttributes($data, $this->serializer);
            $update($model, $data, $values, $this->errorBag);

            $response = $this->resourceUpdated($this->serializer->serialize($model));
        } catch (Exception $e) {
            $response = $this->getErrorResponse($e);
        }

        return $response;
    }
324253
public static function deleteByIds($className, array $ids): ResultInterface
    {
        list($table, , $idColumn) = self::getTable($className);
        $instance = self::getInstance($className);

        $query = Query::table($table)->whereIn($idColumn, $ids)->selectInstance($instance);

        return $query->delete();
    }
665464
public static function getClassAnnotations($className, $annotationClassName = null)
    {
        if(!isset(static::$annotations[$className]['Class']))
        {
            return [];
        }
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Class'];
        }
        else
        {
            $result = [];
            foreach(static::$annotations[$className]['Class'] as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[] = $annotation;
                }
            }
            return $result;
        }
    }
945946
private static function collectPointAnnotation(PointAnnotation $objectAnnotation, string $className)
    {
        if (!isset(self::$aspects[$className])) {
            return null;
        }

        $include = $objectAnnotation->getInclude();
        $exclude = $objectAnnotation->getExclude();

        self::$aspects[$className]['point']['annotation'] = [
            'include' => $include,
            'exclude' => $exclude,
        ];
    }
1343536
private static function collectPointBean(PointBean $objectAnnotation, string $className)
    {
        if (!isset(self::$aspects[$className])) {
            return null;
        }

        $include = $objectAnnotation->getInclude();
        $exclude = $objectAnnotation->getExclude();

        self::$aspects[$className]['point']['bean'] = [
            'include' => $include,
            'exclude' => $exclude,
        ];
    }
366561
protected function getCommandClass($id)
    {
        if (isset($this->commands[$id])) {
            return $this->commands[$id];
        }

        throw new Exception(sprintf("command %s not found in %s", $id, get_called_class()));
    }
311161
public function getByIds($classname, Array $ids)
    {
        $classname = $classname . '\Sync';
        $classnameArray = $classname . '\ArrayObject';
        $objects = new $classnameArray();
        $objects->append(new $classname(array('id' => $ids)));

        $response = $this->request(
            $this->buildUrl(new $classname(), null, '/sync_fetch_ids'), 'POST', $this->mapper->mapToStorage($objects)
        );
        return $this->mapper->mapFromStorage($response);
    }