Comments (4)
@mamy1326
これは僕も #10 やりながら考えてましたー
僕のアイデアとしては以下かなと
entity.twig
とtable.twig
はvendor配下を直接利用する- CIの定期実行で本家
bake
のtemplateと差分チェックして差分があれば自動で更新PRを出す
from cakephp-generation-gap-pattern-model-baker.
@isanasan
「1.」が実現可能ならそれが一番いいですねー。そうなると Class 側で調整になるかな。
それでも、Class に差分でたら吸収する必要はあるんですよね。
例えば以下の bakeExtendedTable
メソッドは
https://github.com/LancersDevTeam/cakephp-generation-gap-pattern-model-baker/blob/master/src/Command/ExtendedModelCommand.php#L52
vendor/cakephp/bake/src/Command/ModelCommand.php
の bakeTable
メソッドをコピーして機能追加してたりします。
同じことが bakeEntity
にも言えます。
template は確か、twig を操作する必要があって plugin 配下に持っていったんですが、そうなると Bake の Class と twig で管理対象増えちゃうので、できれば Class だけにしたいです。
この辺は先々自分がやらねば…と思っていたヤツなだけに、いさなさんに任せちゃってるのが申し訳ないっす。
from cakephp-generation-gap-pattern-model-baker.
なるほどー
baked
配下に作成するファイルは本家のメソッドを呼んでいるだけだったのでこいつを継承してtemplateのパスを変えてやればいいかと思っていたのですが、そうすると結局Class側で差分が出た時に困るという話ですね?
いたちごっこになってしまうわけですねー。うーむ。
こちらとしてはモーマンタイです!
やれることをガンガンやっていく所存です!
from cakephp-generation-gap-pattern-model-baker.
baked配下に作成するファイルは本家のメソッドを呼んでいるだけだったのでこいつを継承してtemplateのパスを変えてやればいいかと思っていた
そこはそのままで合ってるんですけど、baked を継承した Model を自動生成する以下の部分でメソッドを丸々 bakeTable
-> bakeExtendedTable
, bakeEntity
-> bakeExtendedEntity
とコピーしてるんですよね。
https://github.com/LancersDevTeam/cakephp-generation-gap-pattern-model-baker/blob/master/src/Command/ExtendedModelCommand.php#L39-L40
で、vendor 配下の bakeTable
メソッドとの差分は実は以下くらいしかないんです。
// template 定義
$out = $renderer->generate('Model/extended_table');
これを既存をオーバーライドまたはパスをオブジェクトのプロパティに指定で実現したかったけどやり方がわからなかったのでメソッドコピーして実装したんですよねー。
結局Class側で差分が出た時に困るという話ですね?
ですです。その通りです。実装時に気付いていたので Issue 化しとくべきでした。
初めてプラグイン作って公開してインストールして動かして、ってやってて満足してしまってたかもしれないw
ほんと頼りにしてるしいさなさんのコードや対応は勉強になるので可能な限りしっかり見ていきます!
たまに見落としてたら急かしてくださいw
from cakephp-generation-gap-pattern-model-baker.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-generation-gap-pattern-model-baker.