docteurklein's posterous

Weekly discussion on an e-commerce solution

We started this evening the first weekly IRC discussion on the Symfony2-e-commerce project.

Please notice we will regularly meetup on #sfshop @ freenode every tuesday at 19 GMT+0.

The discussion generally gravited about scenarios and usages we should be able to have on an e-commerce solution.

We had the luck to have Daniel Kucharski discuss about his feelings with a SAP / ERP background.

 

Richard Shank,  Alexandru Emil Lupu and I followed the discussion.

Main points discussed at the moment were about the flexibility we need to handle the different use cases we'll have to face.

As a starter point, we decided to write some scenarios we could test against main concepts.

 

Main philosophy can be resumed in this quote:

 

 [...] for me it's important that before we even go think about a technical design, we first understand order processes in detail

this is: understanding various situations, various deviations and have some of a common way of doing things [...]

This will help a lot in our way to think about implementation of different components.

Some design patterns have been presented to illustrate a kind of common interface we could use to inspirate our work on different components like fulfillment, order status, payment and product meta information.

 

<inspiran> [...] so what i have done is introduced a 'business object profile' which can hold information for both scenarios (or others which i don't know of yet)  

 

 [...] how do we make the interface uniform enough to work within any order flow, but be inclusive enough to handle something like a reservation system

 

<iampersistent> so right now, I'm not 100% how to make sure the interface can handle all of this, but I think as long as we are keeping it in mind, we'll figure out a way

<inspiran> [...] basicly from a conceptual point of view you only have two things: products and services

<iampersistent> right, but products can be a lot of different things

<inspiran> i predict that the product interface will be different from services

<inspiran> because for service the notion of 'periods' is more important than goods

<iampersistent> right, but I feel like we need some commonality so that a product and service can be processed in a similar way [...]

 

Oh, and some people are already talking about a new sexy name :)

 

Keep tuned...

 

Create Symfony2 services with on the fly parameters

These days I encoutered what I thought to be a limitation in the Symfony2 DI container.

 

The problem here was to get a Zend paginator instance working on a Doctrine2 Query.

I finally found a way that seems elegant, by using a closure, but the method can be applied for everything.

 

One of the roles of a DIC is to externalize class name declarations in config files, in order to add flexibility

and ease customization of some parts of a project.

The Symfony2 DIC gives you a way to configure predifined dependencies by generating a container, where each method gives you a service.

Those methods generally return you an instance of a specific class, initialized with all its dependencies.

 

But what if some dependency can't be predefined in the config ? What if you must pass a constructor parameter at runtime ?

 

This is the case with the Zend\Paginator\Paginator class, which attends as first argument an Adapter.

This Adapter waits for a Doctrine\ODM\MongoDB\Query\Builder instance.

This instance has to be created at runtime, changing with user input.

 

To keep using the DIC and permit an end user to customize the paginator classes by using a DIC parameter, I finally built a factory-service, but this service returns a closure instead of a traditional object.

 

This closure has just to be invoked with the Builder as first parameter.

When calling the closure, it will instanciate objects with class names given as container parameters.

These class names are available thanks to the power of closures, which have the ability to have a look at variables defined in the parent scope. ( see the use statement at function declaration ).

 

What do you think about this method ? 

 

 

 

Play with Symfony 2

Hi folks!

The sfLive 2010 conference was a great day because it has marked the realease of Symfony 2 PR1 !!

Let's play a little with this new framework...

  • Dependency Injection,
  • Twig templating,
  • Bundles,
  • Controllers,
  • Doctrine 2 :),
  • ...

I initiated a git sandbox to let you see how it works...

install PHP 5.3.1 on ubuntu 9.10

PHP 5.3.1 is a requirement if you want to test Symfony2 alpha :

And there is a demo available on my github:

http://github.com/docteurklein/symfony2-tests


Here we go:

add this deb repository in your /etc/apt/sources.list:

deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

then :

sudo apt-get update && apt-get upgrade


then: ( if it's already installed )

sudo apt-get remove libapache2-mod-php5 php-pear php5 php5-cli php5-common php5-curl php5-gd php5-memcache php5-mysql php5-xdebug php5-apc php5-mcrypt

then:

sudo apt-get install libapache2-mod-php5 php-pear php5 php5-cli php5-common php5-curl php5-gd php5-memcache php5-mysql php5-xdebug php5-apc php5-mcrypt


if some dependencies cannot be installed, do it manually :

wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8.1-2ubuntu0.2_i...

sudo dpkg -i libicu38_3.8.1-2ubuntu0.2_i386.deb


wget http://fr.archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libltdl7_2.2.4-0ub...

sudo dpkg -i libltdl7_2.2.4-0ubuntu4_i386.deb

wget http://fr.archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libltdl3_1.5.26-1u...

sudo dpkg -i libltdl3_1.5.26-1ubuntu1_i386.deb


Voilà!

appart story

Media_http1bpblogspot_ockgj
Media_httpphotos1blog_ytbkv

Le fabuleux appart de kiby....

15
To Posterous, Love Metalab