Bravo3\Orm\Mappers\Yaml\YamlMapWriter::compileMetadataForEntity PHP Method

compileMetadataForEntity() public method

Write metadata for a given entity, using the input EntityManager that must be preset
public compileMetadataForEntity ( object $entity, string | null $resource = null ) : void
$entity object Entity with existing mapping data
$resource string | null File name to write data, if null a default or common value will be used
return void
    public function compileMetadataForEntity($entity, $resource = null)
    {
        $this->managerMustExist();
        $md = $this->manager->getMapper()->getEntityMetadata($entity);
        $data = [Schema::TABLE_NAME => $md->getTableName(), Schema::COLUMNS => $this->compileColumns($md)];
        if ($sortables = $this->compileSortIndices($md)) {
            $data[Schema::SORT_INDICES] = $sortables;
        }
        if ($indices = $this->compileStdIndices($md)) {
            $data[Schema::STD_INDICES] = $indices;
        }
        if ($resource) {
            $this->sub_buffers[$resource] = [$md->getClassName() => $data];
        } else {
            $this->main_buffer[$md->getClassName()] = $data;
        }
    }