Comments (8)
New gallery controller
Why controller? I guess you won't be accepting Request
and an argument, isn't service (or just in the Shortcode
class) a better place for it?
Repository class for Post items
👍
from kayuewordpressbundle.
Here is an example of gallery, in fact it's out of the post, so it should be in a controller.
With my implementation the user will be able to redefine the template of the shortcode so he's not obliged to use the controller gallery (that will not be so awesome but follow wordpress).
from kayuewordpressbundle.
@Nek- In fact AttachmentManager can act as a repository already. (Bad naming? This was my first bundle so I didn't know the difference between Manager
and Repository
...)
Anyway, I would keep Controller out of this bundle, because the goal of this bundle is to help developer to create their own app by providing a set of services / utilities, not to create one for them. Also we are not going to provide any routing in this bundle, so I don't think anyone is going to use the Controller we provide anyway.
An gallery can be as simple as this:
public galleryAction($post)
{
return [
'gallery' => $this->get('kayue_wordpress.attachment.manager')->findAttachmentsByPost($post);
];
}
from kayuewordpressbundle.
About Manager/Repository, bad naming indeed. I'm going to keep your logic.
About the controller, when you say galleryAction
, you're speaking about a controller :) . But you don't want one... Weird isn't it ?
I don't see the problem to have a controller in the bundle.
from kayuewordpressbundle.
@Nek- I didn't meant to have galleryAction
in this bundle. My point is we have already made the code so simple, why do we bother creating the Controller for the developer?
I believe every app's business logic (Controller) is different, we can never create a Controller that can fit everybody. Some people might want render gallery in a Twig function, some might want to use this bundle to create a REST API. I think we should let the developer decide how they want to use this bundle.
from kayuewordpressbundle.
It's the same deal as FOSControllers :) . But they provide some. And a lot of people use them... Because they don't need complexe Controllers.
Also since I'm going to provide an (overidable) template for the shortcut that will have a link to another page... I need to have something at the other page.
from kayuewordpressbundle.
@Nek- Alright then. It doesn't hurt to provide more. =)
from kayuewordpressbundle.
Okep :) . I'm going to write some tests and I PR !
from kayuewordpressbundle.
Related Issues (20)
- Difficulty linking directly to post HOT 3
- Cannot persist Comment or Post entities HOT 1
- When doctrine:generate:entities - Error on TablePrefixSubscriber.php : getClassAnnotations() must be an instance of ReflectionClass HOT 6
- Incompatibility with doctrine fixtures HOT 9
- Stable release with entity manager support HOT 3
- Attempted to call method "setBlogId" on class "Doctrine\ORM\EntityManager" in vendor/kayue/kayue-wordpress-bundle/Kayue/WordpressBundle/Model/BlogManager.php line 62. HOT 4
- Attachment->getUrl is broken
- Tag a new version HOT 2
- How to use this an FOSUserBundle for login HOT 2
- A Token was not found in the SecurityContext. HOT 1
- Sharing Session between symfony and wordpress HOT 9
- Fix 3.x Deprecation warnings before 3.x release
- Missing Service HOT 6
- Override the User type so I can implement an interface
- securety.yml HOT 3
- Composer problems with versions
- Post Thumbnail HOT 4
- Cannot autowire: The class 'Kayue\WordpressBundle\Entity\Post' was not found in the chain configured namespaces App\Entity HOT 1
- Error with Symfony 4.4
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 kayuewordpressbundle.