Any luck with this kmcluckie? Im in the same boat...
Hi Bulmer.
Any luck? Not much - but a little prgoress.
I added both Sylius and a Laravel friendly Doctrine package to my composer file:
"mitch/laravel-doctrine": "0.*",
"sylius/core": "0.11.*@dev"
It seems that there is no Doctrine metadata included in the Sylius packages (which makes sense - they're probably trying to keep it ORM-neutral), so I then tried to extend the Sylius models like so:
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="products")
*/
class TestProduct extends \Sylius\Component\Core\Model\Product {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
protected $id = null;
/**
* @ORM\Column(name="name", type="string", nullable=true)
*/
protected $name;
...
which allows me to something like this:
$product = new TestProduct;
$product->setName('Foo');
EntityManager::persist($product);
EntityManager::flush();
Currently I don't have a DB set up, so it gives me an INSERT error, but at least something is happening! There must certainly be a better way to leverage Sylius, but I think it has to do with wrapping my head around how Doctrine works. I think using Doctrine will be the fastest way to use the Sylius packages, otherwise you have to implement your own DataRepos for Eloquent models.
Thats all I got. If you find anything, please let me know!
Im actually struggling with this very same concept for the last couple of days. As I want to open a Laravel based e-commerce project.
What we have to consider:
Sylius is based off Doctrine ORM that uses the "data mapper" pattern. Unlike Laravel with uses Eloquent and an "active record" pattern
No matter what is stated, Sylius components are essentially tied to Doctrine because it is the only (real) option for the data mapper pattern in PHP.
Would we alienate most of the Laravel community by using Doctrine? Thus loosing most of our user base and the project never really taking off?
If we ditch doctrine, and the data mapper pattern, there is not much use for Sylius components apart from a little bit of a guide designing our own components on the active record pattern.
maybe there is another way that we could integrate sylius components, with their plain old PHP models that I'm just not seeing???
your thoughts...?
Going back to topics at the start of 4.y.z many people complained about the size of that laravel becomes when all packages have been included ... this is rather silly but many people see this as an issue.
Take a look at october.cms, it uses a very smfony like system. Although it seems to be growing slowly it hasn't grown as much as it should deserve. However, I have a feeling that many people would prefer more of a "laravel" native like application.
With these 2 examples, I'm going to venture my opinion that drifting too far away from laravel might be detrimental to the project.
About 1.5 years ago when 4 beta came out, I mapped out Sylius's db structure with mysql workbench. It is huge and very very relational. I'm not entirely sold on the Sylius way to go.
I grew up with oscommerce ;)
With these 2 examples, I'm going to venture my opinion that drifting too far away from laravel might be detrimental to the project.
I agree, Im leaning towards a native active record implementation. If performance becomes an issue down the road there are many ways to address this.
About 1.5 years ago when 4 beta came out, I mapped out Sylius's db structure with mysql workbench. It is huge and very very relational. I'm not entirely sold on the Sylius way to go.
Sylius defiantly has a very complicated schema. Although they are trying to achieve a fully enterprise capable system (a Magento replacement). As complicated as it is, it does lead to flexibility. The complexity comes from their use of the EVA pattern.
I would be interested in implementing a similar entity / DB structure, with simplifications in some areas.
Ouch, had to to look up the EVA pattern.
I've been planning to revisit this whole topic of ecommerce once I've finished up some projects at work. Once I've got them in production I'll have work time to throw at this too.
My original idea was to simplify Sylius's DB structure and look at the ability to expand back to what it is and possibly beyond. The idea behind this was to build up from the DB structure and go with an all native Laravel code base.
As for performance, it will always be an issue and that is why I wanted to go with a more simplistic start and allow for modules/plugins/add-ons to take care of needed performance / tweeking.
My original idea was to simplify Sylius's DB structure and look at the ability to expand back to what it is and possibly beyond. The idea behind this was to build up from the DB structure and go with an all native Laravel code base.
I absolutely agree with you, that would also be my own intention. I believe the initial DB schema is critical, its really easy to corner yourself. People often under estimate the complexity of a fully functioning e-commerce platform. The most critical decisions revolve around product variations, options and attributes in my experience. If this is approached wrong in the beginning then its hard to go back without major breaking changes...
My current vision is for an eco-system of independent re-usable packages (not unlike Sylius) that are tied into a complete e-commerce platform (not unlike Laravel). I find a core re-occurring issue with e-commerce is flexibility, more often then not e-commerce is an add on to an existing application or it's developed along side one. There is a need to integrate with existing administration interfaces and business logic. This is why its so important to develop a group of re-usable and discreet packages that can be dropped into these scenarios.
As part of the project I would like to develop an administration package, integrating authentication and various methods for external packages and applications to hook into and display the interfaces they need to.
I have developed an ecommerce system woth L4. It inludes a complete sdministration panel, product/category management, order inoice and stripe integration, snd ghe frong end is aklmosg complete.
If anyone expresses a sufficiently serious interest, I'b bd happy to put on github. Just dont berate my coding skills or my inability to keep a clean separation of concerns, lol
pavosoftware said:
I have developed an ecommerce system woth L4. It inludes a complete sdministration panel, product/category management, order inoice and stripe integration, snd ghe frong end is aklmosg complete.
If anyone expresses a sufficiently serious interest, I'b bd happy to put on github. Just dont berate my coding skills or my inability to keep a clean separation of concerns, lol
Could you post it?
pavosoftware said:
I have developed an ecommerce system woth L4. It inludes a complete sdministration panel, product/category management, order inoice and stripe integration, snd ghe frong end is aklmosg complete.
If anyone expresses a sufficiently serious interest, I'b bd happy to put on github. Just dont berate my coding skills or my inability to keep a clean separation of concerns, lol
Interested!!!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community