Przyklejone po obiekcie i id
@param string $object
@param string $objectId
@param string $class klasa
@return CmsFileQuery
430827
public static function stickyByObject($object = null, $objectId = null, $class = null)
    {
        //zapytanie po obiekcie
        $q = self::byObject($object, $objectId)
                ->whereSticky()->equals(1);
        //dodawanie klasy jeśli wyspecyfikowana
        if (null !== $class) {
            $q->andFieldClass()->equals($class);
        }
        return $q;
    }
375677
public <T> T fetchObject(String objectId, Class<T> type) {
		URI uri = URIBuilder.fromUri(getBaseGraphApiUrl() + objectId).build();
		return getRestTemplate().getForObject(uri, type);
	}
1086612
protected function getObjectRequestedById(string $class) {
	
		// reads from url requested item id
		$itemId = Router::get(0);
		
		if (!$itemId) {
			$this->enqueueError($this->lang('NO_ID_OF_ITEM_TO_EDIT', $class));
			return NULL;
		}
		
		$object = new $class($itemId);
	
		if ($object->isLoaded()) {
				
			return $object;
	
		} else {
	
			$this->enqueueError($this->lang('ID_OF_ITEM_TO_EDIT_IS_NOT_VALID', $class));
			$this->logError('Object ' . $class . ' id=' . $itemId . ' has not been loaded');
			return NULL;
	
		}
	
	}
619752
private function createMap(string $class, $object)
    {
        $rule = $this->rules[$class];
        $reflectionObject = new \ReflectionObject($object);
        $result = [];

        foreach ($rule->getMap() as $property => $key) {
            $reflectionProperty = $reflectionObject->getProperty($property);
            $reflectionProperty->setAccessible(true);

            $serializer = $rule->getSerializer($property);

            $result[$key] = is_callable($serializer)
                ? $serializer($reflectionProperty->getValue($object))
                : $reflectionProperty->getValue($object);
        }

        return $result;
    }
1363054
public static function getFirstId($object)
    {
        $tableAnnotation = static::getAnnotation($object, Table::class);
        if(null !== $tableAnnotation)
        {
            if(is_array($tableAnnotation->id))
            {
                return reset($tableAnnotation->id);
            }
            else
            {
                return $tableAnnotation->id;
            }
        }
        else
        {
            return null;
        }
    }
49679
public static function getObjectTag($class, $id)
    {
        if (is_object($class) && $class instanceof ActiveRecord) {
            $class = $class->className();
        } elseif (!is_string($class)) {
            throw new InvalidParamException('Param $class must be a string or an object.');
        }
        return $class . '[ObjectTag:' . self::getCacheKeyById($id) . ']';
    }
171942
public static function appendFiles($object, $id = null, array $files = [], array $allowedTypes = [])
    {
        //pola formularza
        foreach ($files as $fileSet) {
            //pojedynczy upload
            if ($fileSet instanceof \Mmi\Http\RequestFile) {
                if (null === self::appendFile($fileSet, $object, $id, $allowedTypes)) {
                    return false;
                }
                continue;
            }
            //pliki w polu formularza
            foreach ($fileSet as $file) {
                /* @var $file \Mmi\Http\RequestFile */
                if (null === self::appendFile($file, $object, $id, $allowedTypes)) {
                    return false;
                }
            }
        }
        return true;
    }
359814
public function load($objectId)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        //====================================================================//
        // Search in Repository
        $entity = $this->repository->find($objectId);
        //====================================================================//
        // Check Object Entity was Found
        if (!$entity) {
            return Splash::log()->errTrace(static::$NAME.' : Unable to load '.$objectId);
        }

        return $entity;
    }
987146
public function currentAction()
    {
        $objectId = !empty($this->getPost()->objectId) ? $this->getPost()->objectId : null;
        switch ($this->getPost()->fileTypes) {
            case 'images' :
                //zapytanie o obrazki
                $query = CmsFileQuery::imagesByObject($this->getPost()->object, $objectId);
                break;
            case 'notImages' :
                //wszystkie pliki bez obrazków
                $query = CmsFileQuery::notImagesByObject($this->getPost()->object, $objectId);
                break;
            default :
                //domyślne zapytanie o wszystkie pliki
                $query = CmsFileQuery::byObject($this->getPost()->object, $objectId);
        }

        $records = $query->find();
        foreach ($records as $record) {
            $record->data = $record->data->toArray();
        }

        //zwrot json'a z plikami
        return json_encode([
            'result' => 'OK',
            'files' => $records->toArray()
        ]);
    }
428303
public function indexObject($object, $signalInformation = null, Client $client = null)
    {
        $type = $this->getIndexTypeForObject($object, $client);
        if ($type === null) {
            return null;
        }
        $data = $this->getIndexablePropertiesAndValuesFromObject($object);

        $id = $this->persistenceManager->getIdentifierByObject($object);
        $document = new Document($type, $data, $id);
        $document->store();
    }
1101426
public function GetPrimaryKeyMap($objectclass)
	{
		$fms = $this->GetFieldMaps($objectclass);
		foreach ($fms as $fm)
		{
			if ($fm->IsPrimaryKey)
			{
				return $fm;
			}
		}
	}
555060
public function getOrCreate($id, $class)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->findOneBy(['entityId' => $id, 'entityClass' => $class]);

        if ($lockable === null) {
            $lockable = new LockableEntity();
            $lockable->setEntityClass($class);
            $lockable->setEntityId($id);
        }

        return $lockable;
    }
259709
public function findByObject($object, $fieldId = null)
    {
        $qb = $this->createQueryBuilder('cf');
        $this->addFindByObject($qb, 'cf', $object, $fieldId);

        return $qb->getQuery()->getResult();
    }
912786
public function objToArray($object, $fields)
  {
      $data = array();
      foreach ($fields as $target => $key) {
          $default = null;
          if (is_array($key)) {
              $default = $key[1];
              $key = $key[0];

        // biblioteka rzuca exception tylko gdy nie znajduje wartości, jeśli natomiast naturalnie zwracany jest null to muszę go ręcznie sprawdzić
        try {
            $data[$target] = $this->dumpObject(AbstractEntity::getValueByMethodOrAttribute($object, $key));

//          if (is_null($data[$target]))
          if (!$data[$target]) {
              $data[$target] = $default;
          }
        } catch (AbstractEntityException $e) {
            $data[$target] = $default;
        } catch (DumperContinueException $e) {
            $data[$target] = $default;
        }
          } else {
              $data[$target] = $this->dumpObject(AbstractEntity::getValueByMethodOrAttribute($object, $key, $default), $throwException = false);
          }
      }

      return $data;
  }
160458
public function get($object_id = 0, $where = '')
	{
		return new Record($object_id, $this->db, $this->table, $this->primary, $where, $this->select);
	}
1347303
protected function copyNode(ObjectId $oid) {
    $logger = $this->getLogger();
    if ($logger->isDebugEnabled()) {
      $logger->debug("Copying node ".$oid);
    }
    $persistenceFacade = $this->getPersistenceFacade();

    // load the original node
    $node = $persistenceFacade->load($oid);
    if ($node == null) {
      throw new PersistenceException("Can't load node '".$oid."'");
    }

    // check if we already have a copy of the node
    $nodeCopy = $this->getCopy($node->getOID());
    if ($nodeCopy == null) {
      // if not, create it
      $nodeCopy = $persistenceFacade->create($node->getType());
      $node->copyValues($nodeCopy, false);
    }

    // save copy
    $this->registerCopy($node, $nodeCopy);

    if ($logger->isInfoEnabled()) {
      $logger->info("Copied: ".$node->getOID()." to ".$nodeCopy->getOID());
    }
    if ($logger->isDebugEnabled()) {
      $logger->debug($nodeCopy->__toString());
    }

    // create the connections to already copied relatives
    // this must be done after saving the node in order to have a correct oid
    $mapper = $node->getMapper();
    $relations = $mapper->getRelations();
    foreach ($relations as $relation) {
      if ($relation->getOtherNavigability()) {
        $otherRole = $relation->getOtherRole();
        $relativeValue = $node->getValue($otherRole);
        $relatives = $relation->isMultiValued() ? $relativeValue :
                ($relativeValue != null ? [$relativeValue] : []);
        foreach ($relatives as $relative) {
          $copiedRelative = $this->getCopy($relative->getOID());
          if ($copiedRelative != null) {
            $nodeCopy->addNode($copiedRelative, $otherRole);
            if ($logger->isDebugEnabled()) {
              $logger->debug("Added ".$copiedRelative->getOID()." to ".$nodeCopy->getOID());
              $logger->debug($copiedRelative->__toString());
            }
          }
        }
      }
    }
    return $nodeCopy;
  }
579310
public static function imagesByObject($object = null, $objectId = null)
    {
        //zapytanie po obiekcie
        return self::byObject($object, $objectId)
                ->whereClass()->equals('image');
    }