Takes an array of CollectionMeta and returns a single meta for a given id.

@param $meta
@param $id

@return CollectionMeta
188151
private function getSingleMetaById($meta, $id)
    {
        if (null !== $id) {
            foreach ($meta as $singleMeta) {
                if ($singleMeta->getId() === $id) {
                    return $singleMeta;
                }
            }
        }
    }
685862
public function getMeta($key = null, $default = null)
    {
        if ($key === null) {
            return $this->meta;
        }

        return isset($this->meta[$key]) ? $this->meta[$key] : $default;
    }
1217133
protected function getMeta($table, $database)
    {
        $uid = spl_object_hash($database);
        if (isset(self::$meta[$uid][$table])) {
            return self::$meta[$uid][$table];
        }
        
        $columns = $database->getColumns($table);
        
        $meta = array();
        foreach ($columns as $i => $column) {
            $meta[self::COLUMNS][$column['Field']] = array(
                'type'      => $column['Type'],
                'key'       => $column['Key'],
                'default'   => $column['Default'],
                'empty'     => $column['Null'] == 'YES');
            
            if ($column['Key'] == 'PRI') {
                $meta[self::PRIMARY][] = $column['Field'];
            }
        }
        
        self::$meta[$uid][$table] = $meta;
        
        return $meta;
    }
773407
public function getMetaData($key)
    {
        return isset($this->meta[$key]) ? $this->meta[$key] : null;
    }
626938
protected function findByMetaSetAndTarget(MetaSetInterface $metaSet, $target = null)
    {
        $metaDatas = array();

        foreach ($this->findMetaDataValues($metaSet, $target) as $metaDataValue) {
            $identifier = $metaDataValue->getSetId();

            if (!isset($metaDatas[$identifier])) {
                $metaData = new MetaData($metaSet);
                $metaDatas[$identifier] = $metaData;
            } else {
                $metaData = $metaDatas[$identifier];
            }

            $field = $metaSet->getFieldById($metaDataValue->getFieldId());

            if (!$field) {
                $this->logger->error(sprintf("MetaSet with id %s doesn't exist", $metaDataValue->getFieldId()));
                continue;
            }

            $metaData->set($field->getName(), $metaDataValue->getValue(), $metaDataValue->getLanguage());
        }

        return $metaDatas;
    }
1312534
public function withAnyMetaId($id)
	{
		$filters = array();
		
		foreach (func_get_args() as $arg) {
			$arg = (array) $arg;
			
			foreach ($arg as $meta_id) {
				$filters[] = array('id' => $m->id);
			}
		}
		
		$this->filters[]['metas'] = $filters;
		
		return $this;
	}
58426
public function saveMeta($id = null) {

        $id = (isset($this->request->data['id'])) ? $this->request->data['id'] : $id;
        $this->CmsContentMeta = TableRegistry::get('CmsContentMeta');
        $meta = $this->CmsContentMeta->get($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $this->CmsContentMeta->patchEntity($meta, $this->request->data);
            if ($this->CmsContentMeta->save($meta)) {
                $this->Flash->success('The meta has been saved.');
                exit('ok');
            } else {
                $this->Flash->error('The meta could not be saved. Please, try again.');
                exit('ko');
            }
        }
    }
1116075
protected function _delMetadatas($id)
    {
        if (isset($this->_metadatasArray[$id])) {
            unset($this->_metadatasArray[$id]);
        }
        $file = $this->_metadatasFile($id);
        return $this->_remove($file);
    }
1034486
def meta
      collection = connection[meta_collection]
      result = collection.find.first
      result.delete(:_id)
      result
    end
1191164
private function get_metadata( $post_id ) {
		$metadata = get_metadata( 'post', $post_id );
		$items    = [];
		foreach ( $metadata as $key => $values ) {
			foreach ( $values as $item_value ) {
				$item_value    = maybe_unserialize( $item_value );
				$items[ $key ] = $item_value;
			}
		}

		return $items;
	}
978840
public static function findById($id)
    {
        if (!$id || strlen($id) != 24) {
            return null;
        }
        $instance = static::entity()->get(get_called_class(), $id);
        if ($instance) {
            return $instance;
        }
        $mongo = static::entity()->getDatabase();
        $data = $mongo->findOne(static::$collection, ['_id' => $mongo->id($id)]);
        if (!$data) {
            return null;
        }
        $instance = new static;
        $data['__webiny_db__'] = true;
        $instance->populate($data);

        return static::entity()->add($instance);
    }
56157
protected function _metadatasFile($id)
    {
        $path = $this->_path($id);
        $fileName = $this->_idToFileName('internal-metadatas---' . $id);
        return $path . $fileName;
    }
452000
function findMeta(meta, names) {
  if (!meta) return null;

  if (!_.isArray(names)) names = [ names ];

  let record;

  names.some((name) => {
    record = _.find(meta, (item) => item.name === name);
    return record;
  });

  return (record || {}).value;
}
1356755
public function meta($key = null)
    {
        if ($key !== null) {
            return array_get($this->meta, $key);
        }

        return $this->meta;
    }
272337
public function getParentAll($id): Collection
    {
        $ids = $this->repo->find($id, ['path'])->toArray();

        return $this->repo->pushCriteria(new GetParentAll($ids))
            ->all();
    }
531530
public function addMeta(ArticleMeta $meta)
    {
        $meta->setArticle($this);
        $this->metas[] = $meta;

        return $this;
    }
289023
public static function find($id)
    {
        $collection = json_decode(self::get("/collections/{$id}")->getBody(), true);

        return new self($collection);
    }