Returns an array of entity data
@param string $entity
@param int $entity_id
@return array
481724
public function loadEntity($entity, $entity_id)
    {
        try {
            $handlers = $this->getHandlers();
            return Handler::call($handlers, $entity, 'data', array($entity_id));
        } catch (Exception $ex) {
            return array();
        }
    }
237393
protected function _getData()
    {
        $data = array();

        if (isset($this->_query)) {
            $data = $this->getRepository()->fetch($this->_query, AnDomain::FETCH_ENTITY_LIST);
        }

        return $data;
    }
68952
public static function entityList()
    {
        $files = File::files(config_path('panel'));

        $list = [];
        foreach ($files as $file) {
            $list[] = new self($file);
        }

        return collect($list)->sortBy(function ($entity) {
            return $entity->name();
        });
    }
699029
public function getId($entityType, array $selector = [])
    {
        $params = ['limit' => 1];
        $ids = (array)$this->getIds($entityType, $selector, $params);

        return array_shift($ids);
    }
35126
public function search($params,$entity=NULL,$entity_id=NULL)
    {
        $query = Address::find()->active()->related($entity, $entity_id);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'country_id' => $this->country_id,
        ]);

        $query->andFilterWhere(['like', 'cityName', $this->cityName])
            ->andFilterWhere(['like', 'zipCode', $this->zipCode])
            ->andFilterWhere(['like', 'postBox', $this->postBox])
            ->andFilterWhere(['like', 'addresslineOne', $this->addresslineOne])
            ->andFilterWhere(['like', 'addresslineTwo', $this->addresslineTwo])
            ->andFilterWhere(['like', 'regionName', $this->regionName]);

        return $dataProvider;
    }
1220839
public function createEntity(string $entity_id, array $parents)
    {
        $entity = new Entity($this, $entity_id, $parents);
        return $entity;
    }
869734
protected function generateFields(Entity $entity)
    {
        $fields     = [];
        $descriptor = $entity->getDescriptor();
        $extensions = $descriptor->getExtensionList() ?: [];

        foreach ($extensions as $field) {
            $fields[] = $this->generateExtensionField($entity, $field);
        }

        return $fields;
    }
99052
public function deleteEntityById($entity, $id)
    {
        $tbl = $this->_resource->getTableName($entity);
        $where = [];
        foreach ($id as $field => $value) {
            $where["`$field`=?"] = $value;
        }
        $result = $this->_conn->delete($tbl, $where);
        return $result;
    }
753993
public function findObject($entity, $_id)
	{
		$retValue = array();

		try{
			$m = new MongoDB\Driver\Manager($this->url);

			$id = new \MongoDB\BSON\ObjectId($_id);
			$filter = ['_id' => $id];
			$options = [];

			$query = new \MongoDB\Driver\Query($filter, $options);
			$mCol = $this->db . "."  . $entity;
			$jsonData = $m->executeQuery($mCol, $query);

			$retValue = $jsonData->toArray();
		}
		catch(Exception $e) {
			$this->_log->addError($e->getMessage());
		}

		return $retValue;
	}
251160
protected function _getRequestData(EntityInterface $entity)
    {
        $pk = (string)TableRegistry::get($entity->source())->primaryKey();
        $data = $this->_controller->request->data('comment');
        $return = [
            'parent_id' => null,
            'subject' => '',
            'body' => '',
            'status' => 'pending',
            'author_name' => null,
            'author_email' => null,
            'author_web' => null,
            'author_ip' => $this->_controller->request->clientIp(),
            'table_alias' => $this->_getTableAlias($entity),
            'entity_id' => $entity->get($pk),
        ];

        if (!empty($this->_controller->request->data['comment'])) {
            $data = $this->_controller->request->data['comment'];
        }

        if ($this->_controller->request->is('userLoggedIn')) {
            $return['user_id'] = user()->id;
            $return['author_name'] = null;
            $return['author_email'] = null;
            $return['author_web'] = null;
        } else {
            $return['author_name'] = !empty($data['author_name']) ? h($data['author_name']) : null;
            $return['author_email'] = !empty($data['author_email']) ? h($data['author_email']) : null;
            $return['author_web'] = !empty($data['author_web']) ? h($data['author_web']) : null;
        }

        if (!empty($data['subject'])) {
            $return['subject'] = h($data['subject']);
        }

        if (!empty($data['parent_id'])) {
            // this is validated at Model side
            $return['parent_id'] = $data['parent_id'];
        }

        if (!empty($data['body'])) {
            $return['body'] = TextToolbox::process($data['body'], $this->config('settings.text_processing'));
        }

        if ($this->config('settings.auto_approve') ||
            $this->_controller->request->is('userAdmin')
        ) {
            $return['status'] = 'approved';
        }

        return $return;
    }
254539
public function getEntityChangeSet($entity)
    {
        $oid = spl_object_hash($entity);

        if (isset($this->entityChangeSets[$oid])) {
            return $this->entityChangeSets[$oid];
        }

        return array();
    }
954597
def entity_categories(self, entity_id):
        
        attributes = self.entity_attributes(entity_id)
        return attributes.get(ENTITY_CATEGORY, [])
1292229
protected function _extractDirtyFields(EntityInterface $entity): array
    {
        $dirtyFields = [];
        $fields = array_keys($entity->toArray());
        $dirtyFields = $entity->extract($fields, true);
        unset($dirtyFields['modified']);

        return array_keys($dirtyFields);
    }
923167
protected function generateExtensionMethods(Entity $entity)
    {
        $methods    = [];
        $descriptor = $entity->getDescriptor();
        $extensions = $descriptor->getExtensionList() ?: [];

        foreach ($extensions as $field) {
            $methods[] = $this->generateExtensionMethod($entity, $field);
        }

        return $methods;
    }
331804
protected function getEntityDataArray(EntityInterface $entity)
    {
        $metadata = $this->getEntityMetadata();
        $array = [];
        
        foreach ($this->getHydrator()->extract($entity) as $sqlName => $value) {
            if ($sqlName !== $metadata->getIdentifier() && null !== $value) {
                $array[$metadata->getRawSQLName($metadata->getName($sqlName))] = $value;
            }
        }
        
        return $array;
    }
174779
public function load(Entity $entity)
    {
        $data = $entity->getRawData();
        if (!is_array($data) || !isset($data[$this->getForeignKey()])) {
            return null;
        }
        /** @var Select $sql */
        $sql = call_user_func_array(
            [$this->getRelatedEntity(), 'find'],
            []
        );
        $pmk = Entity\Manager::getInstance()->get($this->getRelatedEntity())
            ->getEntity()->getPrimaryKey();
        $table = Entity\Manager::getInstance()->get($this->getRelatedEntity())
            ->getEntity()->getTableName();
        $sql-> where(
            [
                "{$table}.{$pmk} = :id" => [
                    ':id' => $data[$this->getForeignKey()]
                ]
            ]
        );
        return $sql->first();
    }
620701
def entities(self, entity_ids):
        '''
        '''
        url = '%s/meta/any?include=id&' % self.url
        for entity_id in entity_ids:
            url += 'id=%s&' % _get_path(entity_id)
        # Remove the trailing '&' from the URL.
        url = url[:-1]
        data = self._get(url)
        return data.json()