getColumn example

$customEntity = [
            'name' => 'custom_entity_extension',
            'fields' => '[{"name":"product","reference":"product","onDelete":"set-null","inherited":true,"type":"one-to-one"}]',
        ];

        $updater = new SchemaUpdater();
        $updater->applyCustomEntities($schema[$customEntity]);

        $this->assertColumns($schema, 'product', ['customentityextensionproduct']);

        $productTable = $schema->getTable('product');
        $columnComment = $productTable->getColumn('customentityextensionproduct')->getComment();
        static::assertSame('custom-entity-element', $columnComment);
    }

    public function testBlogExample(): void
    {
        $entities = [
            [
                'name' => 'custom_entity_blog',
                'fields' => '[{"name":"position","storeApiAware":true,"type":"int","required":false},{"name":"rating","storeApiAware":true,"type":"float","required":false},{"name":"title","storeApiAware":true,"type":"string","translatable":true,"required":true},{"name":"content","storeApiAware":true,"allowHtml":true,"type":"text","translatable":true,"required":false},{"name":"products","storeApiAware":true,"reference":"product","inherited":false,"onDelete":"cascade","type":"many-to-many"},{"name":"top_seller","storeApiAware":true,"reference":"product","inherited":false,"onDelete":"set-null","type":"many-to-one","required":false},{"name":"comments","storeApiAware":true,"reference":"custom_entity_blog_comment","inherited":false,"onDelete":"set-null","type":"one-to-many","reverseRequired":false},{"name":"author","storeApiAware":false,"reference":"user","inherited":false,"onDelete":"set-null","type":"one-to-one","required":false}]',
            ],
            [
                
/** * Returns a serializable version of the object * * @return array */
    #[\ReturnTypeWillChange]     public function jsonSerialize()
    {
        return array(
            "line" => $this->getLine(),
            "column" => $this->getColumn(),
            "index" => $this->getIndex()
        );
    }
}
/** * Sets the current scan position at the given one * * @param Position $position Position at which the scan position will be set * * @return $this */
    public function setScanPosition(Position $position = null)
    {
        $this->line = $position->getLine();
        $this->column = $position->getColumn();
        $this->index = $position->getIndex();
        return $this;
    }
    
    /** * Return the character at the given index in the source code or null if the * end is reached. * * @param int $index Index, if not given it will use the current index * * @return string|null */
$ast = Peast::latest($data)->parse();
      $renderer = new Renderer();
      $renderer->setFormatter(new CompactFormatter());
      return $renderer->render($ast);
    }
    catch (\Exception $exception) {
      if ($exception instanceof PeastSyntaxException) {
        $position = $exception->getPosition();
        Error::logException($this->logger, $exception, 'Syntax error: @message, File: @asset_file, Line: @asset_line, Column: @asset_column, Index: @asset_index', [
          '@asset_file' => $js_asset['data'],
          '@asset_line' => $position->getLine(),
          '@asset_column' => $position->getColumn(),
          '@asset_index' => $position->getIndex(),
        ]);
      }
      else {
        Error::logException($this->logger, $exception);
      }
      return $data;
    }
  }

  /** * Processes the contents of a javascript asset for cleanup. * * @param string $contents * The contents of the javascript asset. * * @return string * Contents of the javascript asset. */
Home | Imprint | This part of the site doesn't use cookies.