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

Base for a blog example #49

Merged
merged 57 commits into from Feb 16, 2020
Merged

Base for a blog example #49

merged 57 commits into from Feb 16, 2020

Conversation

@roxblnfk
Copy link
Member

roxblnfk commented Jan 29, 2020

Quick start

  1. Configure config/params.php (you can skip this step)
  2. Run composer install
  3. Run vendor/bin/yii serve or start your web-server
  4. Go to index page.
    On this step the Cycle ORM will create tables, indexes and relations automatically in the configured DB.
    If you want to disable this behavior then comment out line with Generator\SyncTables::class in the config/params.php file. In this case you should create migrations to sync changes of entities with DB
  5. Run vendor/bin/yii fixture/add 20 to create random data

Features:

  • Cycle ORM examples:
    • Entities with annotations
    • Repositories, Mappers and Constrains
  • Frontend:
    • Bootstrap 4 and his depended assets configured to CDN
    • Most popular tags panel
    • Archive panel
    • Pagination of posts
  • SQL queries logging in the terminal (if you use yii serve)

Todo:

  • add an admin panel and other publication abilities
  • use the OffsetPaginator from yiisoft/data package
  • yiisoft/widget integration
  • try entities with public fields instead of private with getters/setters (this should works faster)

image

roxblnfk added 30 commits Nov 21, 2019
# Conflicts:
#	resources/mail/layouts/html.php
…me fixes
# Conflicts:
#	composer.json
#	config/console.php
#	src/Entity/User.php
#	src/Factory/AppRouterFactory.php
#	src/globals.php
# Conflicts:
#	composer.json
#	config/common.php
#	src/Entity/User.php
#	src/Factory/AppRouterFactory.php
#	src/Repository/UserRepository.php
#	src/globals.php
# Conflicts:
#	config/params.php
#	src/Command/User/CreateCommand.php
roxblnfk added 3 commits Feb 9, 2020
@roxblnfk roxblnfk marked this pull request as ready for review Feb 9, 2020
@roxblnfk roxblnfk requested a review from samdark Feb 9, 2020
@yiiliveext

This comment has been minimized.

Copy link
Contributor

yiiliveext commented Feb 9, 2020

Classes should be grouped either by a type or by a layer.
Repository+Mapper+Scope together is OK. Repository+Mapper+Scope+Controller together is not OK.

Copy link
Contributor

xepozz left a comment

Please, consider my comments also for similar classes (controllers, entities, repositories)

src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Show resolved Hide resolved
src/Entity/User.php Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Widget/OffsetPagination.php Outdated Show resolved Hide resolved
roxblnfk added 3 commits Feb 9, 2020
src/Factory/ViewFactory.php Show resolved Hide resolved
src/Entity/User.php Show resolved Hide resolved
@@ -19,6 +19,7 @@
"require": {
"php": "^7.4",
"cebe/markdown": "^1.2@dev",
"cycle/proxy-factory": "^1.2",

This comment has been minimized.

Copy link
@samdark

samdark Feb 14, 2020

Member

Should it be required directly? Do we need it all the time? If so, does it make sense to move it to yii-cycle?

src/Blog/Archive/ArchiveController.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Outdated Show resolved Hide resolved
src/Blog/Entity/Comment.php Show resolved Hide resolved
views/blog/archive/index.php Outdated Show resolved Hide resolved
views/blog/post/index.php Outdated Show resolved Hide resolved
views/contact/form.php Outdated Show resolved Hide resolved
views/layout/main.php Outdated Show resolved Hide resolved
views/site/index.php Show resolved Hide resolved
roxblnfk added 3 commits Feb 14, 2020
src/Controller/UserController.php Outdated Show resolved Hide resolved
src/Controller/UserController.php Outdated Show resolved Hide resolved
@xepozz

This comment has been minimized.

Copy link
Contributor

xepozz commented Feb 14, 2020

Don't forget to make your controllers compatible. (#54 already in master)

@samdark

This comment has been minimized.

Copy link
Member

samdark commented Feb 14, 2020

@xepozz isn't it already done?

@xepozz

This comment has been minimized.

Copy link
Contributor

xepozz commented Feb 14, 2020

Oh, sorry. It's already complete :)

roxblnfk added 2 commits Feb 14, 2020
…d of ORMInterface
@roxblnfk

This comment has been minimized.

Copy link
Member Author

roxblnfk commented Feb 16, 2020

Found a strange behavior. On running ./vendor/bin/yii it outputs the following to the console:

...

As far as I understand it is re-reading schema. The questions are:

  1. Why it's done every time?
  2. Why it's done when I'm not doing anything DB-related?

Fixed in yiisoft/yii-cycle#23 and last commit

@samdark samdark merged commit 8faa802 into yiisoft:master Feb 16, 2020
2 checks passed
2 checks passed
Scrutinizer Analysis: 45 new issues, 138 updated code elements – Tests: passed
Details
continuous-integration/styleci/pr The analysis has passed
Details
@samdark

This comment has been minimized.

Copy link
Member

samdark commented Feb 16, 2020

Merged! Awesome job overall 👍 Let's continue with further fixes / enhancements separately.

@roxblnfk roxblnfk deleted the roxblnfk:blog branch Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.