承接 fishingboy/madump 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fishingboy/madump

Composer 安装命令:

composer require fishingboy/madump

包简介

Magento Data Object Dump Tool

README 文档

README

Tests Packagist Version Downloads License: MIT

English | 繁體中文

Why MaDump?

Calling var_dump() or print_r() on a Magento object causes an out-of-memory error because of deeply nested circular references. MaDump dumps only the first level of an object, giving you just enough information to navigate the code during development.

Installation

composer require fishingboy/madump

Usage

  1. Print directly

    use Fishingboy\MaDump\MaDump;
    MaDump::dump($product);

    Output:

    <pre>
    Magento\Catalog\Model\Product\Interceptor
        ->addAttributeUpdate($code, $value, $store)
        ->addCustomOption($code, $value, $product)
        ->addData(array $arr)
        ->addImageToMediaGallery($file, $mediaAttribute, $move, $exclude)
        ->addOption(Magento\Catalog\Model\Product\Option $option)
        ->afterCommitCallback()
        ->afterDelete()
        ->afterDeleteCommit()
        ->formatUrlKey($str)
        ->fromArray(array $data)
        ->getAttributeDefaultValue($attributeCode)
        ->getAttributeSetId() : 16 (string)
        ->getAttributeText($attributeCode)
        ->getAttributes($groupId, $skipSuper)
        ->getAvailableInCategories() : array
        ->getCacheIdTags() : array
        ->getCacheTags() : array
        ->getCalculatedFinalPrice() :  (NULL)
        ->getCategory() :  (NULL)
        ->getCategoryCollection() : Magento\Catalog\Model\ResourceModel\Category\Collection\Interceptor
        ...
    </pre>
  2. Capture as a string (for logging)

    use Fishingboy\MaDump\MaDump;
    $product_dump = MaDump::dump($product, true);
    $this->_logger->info("product => " . $product_dump);
  3. Stop execution after dumping

    use Fishingboy\MaDump\MaDump;
    MaDump::dump($product);
    exit;
  4. Typical trace workflow

    Step 1 — dump the top-level object:

    MaDump::dump($product);

    Step 2 — drill into an attribute:

    MaDump::dump($product->getCustomAttributes());

    Step 3 — drill further:

    MaDump::dump($product->getCustomAttributes()[0]);

    Keep going level by level until you find what you need.

Output Format

  1. Object

    <pre>
    Magento\Catalog\Model\Product\Interceptor
        ->addAttributeUpdate($code, $value, $store)
        ->addCustomOption($code, $value, $product)
        ->addData(array $arr)
        ->addImageToMediaGallery($file, $mediaAttribute, $move, $exclude)
        ->addOption(Magento\Catalog\Model\Product\Option $option)
        ->afterCommitCallback()
        ->afterDelete()
        ->afterDeleteCommit()
        ->formatUrlKey($str)
        ->fromArray(array $data)
        ->getAttributeDefaultValue($attributeCode)
        ->getAttributeSetId() : 16 (string)
        ->getAttributeText($attributeCode)
        ->getAttributes($groupId, $skipSuper)
        ->getAvailableInCategories() : array
        ->getCacheIdTags() : array
        ->getCacheTags() : array
        ->getCalculatedFinalPrice() :  (NULL)
        ->getCategory() :  (NULL)
        ->getCategoryCollection() : Magento\Catalog\Model\ResourceModel\Category\Collection\Interceptor
        ...
    </pre>

    Zero-argument getter methods are called automatically and their return values are shown inline:

        ->getAttributeSetId() : 16 (string)
        ->getCategoryCollection() : Magento\Catalog\Model\ResourceModel\Category\Collection\Interceptor
        ->getCacheIdTags() : array
  2. Array

    <pre>
    Array(52) =>
    [0] => (Magento\Framework\Api\AttributeValue)
    [10] => (Magento\Framework\Api\AttributeValue)
    [11] => (Magento\Framework\Api\AttributeValue)
    [12] => (Magento\Framework\Api\AttributeValue)
    ...
    </pre>

    Or for a simple array:

    <pre>
    Array(2) =>
    [0] => 101
    [1] => 102
    </pre>
  3. Scalar value

    <pre>1 (integer)</pre>
    <pre>true (boolean)</pre>
    <pre>sku-123 (string)</pre>

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 55
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固