Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

特定商取引法のリファクタ #66

Merged
merged 12 commits into from
Mar 23, 2015

Conversation

nobuhiko
Copy link
Contributor

@shinichi-takahashi
Copy link

@nobuhiko
実装ありがとうございます!
Entityのメンバ変数をpublicに変更されていますが、こちらはprivateのままでお願い致します。

以下のようなArrayAccessを基底としたクラスを実装・継承するように修正していただけますでしょうか。
setterはつぶしてしまって構いません。

abstract class DomainObject implements \ArrayAccess
{
    public function offsetExists($offset) {
        $method = Inflector::classify($offset);
        return method_exists($this, "get$method");
    }

    public function offsetSet($offset, $value) {
    }

    public function offsetGet($offset) {
        $method = Inflector::classify($offset);
        return $this->{"get$method"}();
    }

    public function offsetUnset($offset) {
    }
}

@nobuhiko
Copy link
Contributor Author

@shinichi-takahashi DomainObjectの使い方がよくわからないです。

@shinichi-takahashi
Copy link

基底クラスとして定義して、あとはそれを継承すれば、Twigから
{{tradelaw.law_company}}
とするだけでgetLawCompany()が呼び出されるようになります。

@ttsuru
Copy link
Contributor

ttsuru commented Mar 23, 2015

@nobuhiko

abstract class AbstractEntity

とかにしていただけると助かります。これ、僕の以前のソースでしてネーミングお恥ずかしい・・・

@nobuhiko
Copy link
Contributor Author

PHP Fatal error: Class 'Eccube\Entity\Inflector' not found in /hoge/eccube/src/Eccube/Entity/AbstractEntity.php on line 7

@ttsuru
Copy link
Contributor

ttsuru commented Mar 23, 2015

use Doctrine\Common\Util\Inflector;

が抜けてますね、たぶん。

@nobuhiko
Copy link
Contributor Author

http://doctrine-orm.readthedocs.org/en/latest/cookbook/implementing-arrayaccess-for-domain-objects.html
言われるがままにコミットしました、このへんが関係ある感じですか?

@ttsuru
Copy link
Contributor

ttsuru commented Mar 23, 2015

ずばりこれですね。

chihiro-adachi pushed a commit that referenced this pull request Mar 23, 2015
特定商取引法のリファクタ
@chihiro-adachi chihiro-adachi merged commit 24374a5 into EC-CUBE:eccube-3.0.0-beta Mar 23, 2015
@chihiro-adachi
Copy link
Contributor

PRマージしてとりこみました。ありがとうございます。

chihiro-adachi referenced this pull request in chihiro-adachi/ec-cube Mar 23, 2015
@nobuhiko nobuhiko deleted the help/traderaw branch April 18, 2015 09:28
ryo-endo added a commit that referenced this pull request Jul 20, 2018
#66 【レイアウト編集】ブロック操作の吹き出しメニューを複数表示できてしまう
kiy0taka pushed a commit that referenced this pull request Dec 8, 2020
プラグイン有効化URLのチェックを追加
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants