From c01edec86b9ab2ef5feb4ea9ab9d8209339c49f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20J=C4=99drzejewski?= Date: Sun, 28 Oct 2012 12:53:42 +0100 Subject: [PATCH] Initial commit --- src/Sylius/Bundle/ResourceBundle/.gitignore | 7 + src/Sylius/Bundle/ResourceBundle/.travis.yml | 10 + .../Controller/ResourceController.php | 390 ++++++++++++++++++ .../ResourceControllerInterface.php | 30 ++ .../SyliusResourceExtension.php | 33 ++ .../Doctrine/DoctrineResourceManager.php | 89 ++++ .../DoctrineResourceManagerInterface.php | 25 ++ .../Manager/Doctrine/ORM/ResourceManager.php | 30 ++ .../Manager/ResourceManager.php | 39 ++ .../Manager/ResourceManagerInterface.php | 93 +++++ .../Bundle/ResourceBundle/Model/Resource.php | 27 ++ .../Model/ResourceInterface.php | 27 ++ src/Sylius/Bundle/ResourceBundle/README.md | 97 +++++ .../config/container/controllers.xml | 28 ++ .../config/container/driver/doctrine/orm.xml | 41 ++ .../Resources/config/container/forms.xml | 29 ++ .../config/container/manipulators.xml | 26 ++ .../ResourceBundle/Resources/meta/LICENSE | 19 + .../ResourceBundle/SyliusResourceBundle.php | 29 ++ .../ResourceBundle/Tests/autoload.php.dist | 16 + .../Bundle/ResourceBundle/Tests/bootstrap.php | 16 + .../Bundle/ResourceBundle/composer.json | 33 ++ .../Bundle/ResourceBundle/phpunit.xml.dist | 19 + 23 files changed, 1153 insertions(+) create mode 100644 src/Sylius/Bundle/ResourceBundle/.gitignore create mode 100644 src/Sylius/Bundle/ResourceBundle/.travis.yml create mode 100644 src/Sylius/Bundle/ResourceBundle/Controller/ResourceController.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Controller/ResourceControllerInterface.php create mode 100644 src/Sylius/Bundle/ResourceBundle/DependencyInjection/SyliusResourceExtension.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManager.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManagerInterface.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/ORM/ResourceManager.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Manager/ResourceManager.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Manager/ResourceManagerInterface.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Model/Resource.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Model/ResourceInterface.php create mode 100644 src/Sylius/Bundle/ResourceBundle/README.md create mode 100644 src/Sylius/Bundle/ResourceBundle/Resources/config/container/controllers.xml create mode 100644 src/Sylius/Bundle/ResourceBundle/Resources/config/container/driver/doctrine/orm.xml create mode 100644 src/Sylius/Bundle/ResourceBundle/Resources/config/container/forms.xml create mode 100644 src/Sylius/Bundle/ResourceBundle/Resources/config/container/manipulators.xml create mode 100644 src/Sylius/Bundle/ResourceBundle/Resources/meta/LICENSE create mode 100644 src/Sylius/Bundle/ResourceBundle/SyliusResourceBundle.php create mode 100644 src/Sylius/Bundle/ResourceBundle/Tests/autoload.php.dist create mode 100644 src/Sylius/Bundle/ResourceBundle/Tests/bootstrap.php create mode 100644 src/Sylius/Bundle/ResourceBundle/composer.json create mode 100644 src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist diff --git a/src/Sylius/Bundle/ResourceBundle/.gitignore b/src/Sylius/Bundle/ResourceBundle/.gitignore new file mode 100644 index 0000000000..72de8f15d5 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/.gitignore @@ -0,0 +1,7 @@ +phpunit.xml +Tests/autoload.php + +vendor/ + +composer.phar +composer.lock diff --git a/src/Sylius/Bundle/ResourceBundle/.travis.yml b/src/Sylius/Bundle/ResourceBundle/.travis.yml new file mode 100644 index 0000000000..a7d1437e74 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/.travis.yml @@ -0,0 +1,10 @@ +language: php + +php: + - 5.3 + - 5.4 + +before_script: composer install --dev + +notifications: + email: travis-ci@sylius.org diff --git a/src/Sylius/Bundle/ResourceBundle/Controller/ResourceController.php b/src/Sylius/Bundle/ResourceBundle/Controller/ResourceController.php new file mode 100644 index 0000000000..8516be01d1 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Controller/ResourceController.php @@ -0,0 +1,390 @@ + + */ +abstract class ResourceController extends Controller implements ResourceControllerInterface +{ + /** + * Get one resource. + * + * @param Request $request + * + * @return Response + */ + public function getAction(Request $request) + { + $identifier = $this->getIdentifierValue($request); + $resource = $this->findResourceOr404($identifier); + + $view = View::create() + ->setTemplate($this->getFullTemplateName('show')) + ->setTemplateVar($this->getResourceName()) + ->setData($resource) + ; + + return $this->handleView($view); + } + + /** + * Get all paginated resourcees. + * + * @param Request $request + * + * @return Response + */ + public function getCollectionAction(Request $request) + { + $paginator = $this->getManager()->createPaginator(); + $paginator->setCurrentPage($request->query->get('page', 1), true, true); + + $resources = $paginator->getCurrentPageResults(); + + $data = $this->isHtmlRequest() ? array(Pluralization::pluralize($this->getResourceName()) => $resources, 'paginator' => $paginator) : $resourcees; + + $view = View::create() + ->setTemplate($this->getFullTemplateName('list')) + ->setData($data) + ; + + return $this->handleView($view); + } + + /** + * Display form for creating new resource. + * + * @param Request $request + * + * @return Response + */ + public function newAction(Request $request) + { + $resource = $this->createResource(); + $form = $this->createResourceForm($resource); + + return $this->renderResponse('create', array( + $this->getResourceName() => $resource, + 'form' => $form->createView() + )); + } + + /** + * Create resource. + * + * @param Request $request + * + * @return Response + */ + public function postAction(Request $request) + { + $resource = $this->createResource(); + $form = $this->createResourceForm($resource); + + $form->bind($request); + + if ($form->isValid()) { + $this->getManipulator()->create($resource); + $this->setFlash('success', sprintf("%s has been created", ucfirst($this->getResourceName()))); + + return $this->redirectToResource($resource); + } + + $htmlView = View::create() + ->setTemplate($this->getFullTemplateName('create.html')) + ->setData(array( + $this->getResourceName() => $resource, + 'form' => $form->createView() + )) + ; + + $view = $this->isHtmlRequest() ? $htmlView : View::create($form); + + return $this->handleView($view); + } + + /** + * Display form for editing resource. + * + * @param Request $request + * + * @return Response + */ + public function editAction(Request $request) + { + $resource = $this->findResourceOr404($request->get('id')); + $form = $this->createResourceForm($resource); + + return $this->renderResponse('update', array( + $this->getResourceName() => $resource, + 'form' => $form->createView() + )); + } + + /** + * Update resource. + * + * @param Request $request + * + * @return Response + */ + public function putAction(Request $request) + { + $resource = $this->findResourceOr404($request->get('id')); + $form = $this->createResourceForm($resource); + + $form->bind($request); + + if ($form->isValid()) { + $this->getManager()->persist($resource); + $this->setFlash('success', sprintf("%s has been updated", ucfirst($this->getResourceName()))); + + return $this->redirectToResource($resource); + } + + $htmlView = View::create() + ->setTemplate($this->getFullTemplateName('update.html')) + ->setData(array( + $this->getResourceName() => $resource, + 'form' => $form->createView() + )) + ; + + $view = $this->isHtmlRequest() ? $htmlView : View::create($form); + + return $this->handleView($view); + } + + /** + * Deletes resource. + * + * @param Request $request + * + * @return Response + */ + public function deleteAction(Request $request) + { + $resource = $this->findResourceOr404($request->get('id')); + + $this->getManager()->remove($resource); + $this->setFlash('success', sprintf("%s has been deleted", ucfirst($this->getResourceName()))); + + return $this->redirectToResourceCollection(); + } + + public function setFlash($name, $value) + { + if ($this->isHtmlRequest()) { + parent::setFlash($name, $value); + } + } + + /** + * Create new resource instance. + */ + protected function createResource() + { + return $this->getManager()->create(); + } + + /** + * Create resource form. + * + * @param ResourceInterface $resource + * + * @return FormInterface + */ + protected function createResourceForm(ResourceInterface $resource = null) + { + return $this->createNamedForm('', $this->getResourceFormType(), $resource, array( + 'csrf_protection' => false + )); + } + + /** + * Redirect to resource resource. + * + * @param ResourceInterface $resource + * + * @return RouteRedirectView + */ + protected function redirectToResource(ResourceInterface $resource) + { + $redirect = $this->getRequest()->attributes->get('_sylius.redirect'); + $route = $redirect ? $redirect : $this->getResourceRoute(); + + return RouteRedirectView::create($route, array('id' => $resource->getId())); + } + + /** + * Redirect to list of resourcees. + * + * @return RouteRedirectView + */ + protected function redirectToResourceCollection() + { + $redirect = $this->getRequest()->attributes->get('_sylius.redirect'); + $route = $redirect ? $redirect : $this->getResourceCollectionRoute(); + + return RouteRedirectView::create($route); + } + + protected function getResourceRoute() + { + throw new \BadMethodCallException('You have to implement this method'); + } + + protected function getResourceCollectionRoute() + { + throw new \BadMethodCallException('You have to implement this method'); + } + + /** + * Get resource manager. + * + * @return ManagerInterface + */ + protected function getManager() + { + return $this->container->get($this->getServiceName('manager')); + } + + protected function getServiceName($name) + { + return sprintf('%s.%s.%s', $this->getBundlePrefix(), $name, $this->getResourceName()); + } + + /** + * Tries to find resource with given id. + * Throws special 404 exception when unsuccessful. + * + * @param mixed $id The resource identifier + * + * @return ResourceInterface + * + * @throws NotFoundHttpException + */ + protected function findResourceOr404($identifier) + { + $criteria = array($this->getIdentifierName() => $this->getIdentifierValue()); + + if (!$resource = $this->getManager()->findOneBy($criteria)) { + throw new NotFoundHttpException('Requested resource does not exist'); + } + + return $resource; + } + + protected function getIdentifierName() + { + return $this->getRequest()->attributes->get('_sylius.identifier', 'id'); + } + + protected function getIdentifierValue() + { + if (!$identifier = $this->getRequest()->attributes->get($this->getIdentifierName())) { + throw new NotFoundHttpException('No resource identifier supplied'); + } + + return $identifier; + } + + protected function renderResponse($templateName, array $parameters = array()) + { + return $this->render($this->getFullTemplateName($templateName), $parameters); + } + + /** + * Get full template name. + * + * @param string + * + * @return string + */ + protected function getFullTemplateName($name) + { + $template = $this->getRequest()->attributes->get('_sylius.template'); + + if (null !== $template) { + return $template; + } + + return sprintf('%s:%s.%s', + $this->getTemplateNamespace(), + $name, + $this->getEngine() + ); + } + + /** + * Get engine. + * + * @return string + */ + protected function getEngine() + { + return $this->container->getParameter(sprintf('%s.engine', $this->getBundlePrefix())); + } + + /** + * Check if request accepts html format. + * + * @return Boolean + */ + protected function isHtmlRequest() + { + return 'html' === $this->getRequest()->getRequestFormat(); + } + + /** + * Convert view to a response object. + * + * @param View $view + * + * @return Response + */ + protected function handleView(View $view) + { + return $this->get('fos_rest.view_handler')->handle($view); + } + + /** + * Get name of the form type to use. + * + * @return string + */ + protected function getResourceFormType() + { + return sprintf('%s_%s', $this->getBundlePrefix(), $this->getResourceName()); + } + + /** + * Get templates namespace. + * + * @return string + */ + abstract protected function getTemplateNamespace(); + abstract protected function getBundlePrefix(); +} diff --git a/src/Sylius/Bundle/ResourceBundle/Controller/ResourceControllerInterface.php b/src/Sylius/Bundle/ResourceBundle/Controller/ResourceControllerInterface.php new file mode 100644 index 0000000000..18fba5cbdc --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Controller/ResourceControllerInterface.php @@ -0,0 +1,30 @@ + + */ +interface ResourceControllerInterface +{ + function getAction(Request $request); + function getCollectionAction(Request $request); + function newAction(Request $request); + function postAction(Request $request); + function editAction(Request $request); + function putAction(Request $request); + function deleteAction(Request $request); +} diff --git a/src/Sylius/Bundle/ResourceBundle/DependencyInjection/SyliusResourceExtension.php b/src/Sylius/Bundle/ResourceBundle/DependencyInjection/SyliusResourceExtension.php new file mode 100644 index 0000000000..9800cd624b --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/DependencyInjection/SyliusResourceExtension.php @@ -0,0 +1,33 @@ + + */ +class SyliusResourceExtension extends Extension +{ + /** + * {@inheritdoc} + */ + public function load(array $config, ContainerBuilder $container) + { + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/container')); + } +} diff --git a/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManager.php b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManager.php new file mode 100644 index 0000000000..f0362605b8 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManager.php @@ -0,0 +1,89 @@ + + */ +class DoctrineResourceManager extends ResourceManager implements DoctrineResourceManagerInterface +{ + protected $objectManager; + protected $objectRepository; + + public function __construct(ObjectManager $objectManager, $class) + { + $this->objectManager = $objectManager; + $this->objectRepository = $objectManager->getRepository($class); + + parent::__construct($class); + } + + /** + * {@inheritdoc} + */ + public function persist(ResourceInterface $resource, $commit = true) + { + $this->objectManager->persist($resource); + + if ($commit) { + $this->objectManager->flush(); + } + } + + /** + * {@inheritdoc} + */ + public function remove(ResourceInterface $resource, $commit = true) + { + $this->objectManager->remove($resource); + + if ($commit) { + $this->objectManager->flush(); + } + } + + public function find($id) + { + return $this->objectRepository->find($id); + } + + public function findOneBy(array $criteria) + { + return $this->objectRepository->findOneBy($criteria); + } + + public function findAll() + { + return $this->objectRepository->findAll(); + } + + public function findBy(array $criteria) + { + return $this->objectRepository->findBy($criteria); + } + + public function getObjectManager() + { + return $this->objectManager; + } + + public function getObjectRepository() + { + return $this->objectRepository; + } +} diff --git a/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManagerInterface.php b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManagerInterface.php new file mode 100644 index 0000000000..0444eb8342 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/DoctrineResourceManagerInterface.php @@ -0,0 +1,25 @@ + + */ +interface DoctrineResourceManagerInterface extends ResourceManagerInterface +{ + function getObjectManager(); + function getObjectRepository(); +} diff --git a/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/ORM/ResourceManager.php b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/ORM/ResourceManager.php new file mode 100644 index 0000000000..ee62ecaf38 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Manager/Doctrine/ORM/ResourceManager.php @@ -0,0 +1,30 @@ + + */ +class ResourceManager extends DoctrineResourceManager +{ + public function createPaginator() + { + return new Pagerfanta(new DoctrineORMAdapter($this->objectRepository->createQueryBuilder('r'))); + } +} diff --git a/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManager.php b/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManager.php new file mode 100644 index 0000000000..ef40e43c31 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManager.php @@ -0,0 +1,39 @@ + + */ +abstract class ResourceManager implements ResourceManagerInterface +{ + protected $class; + + public function __construct($class) + { + $this->class = $class; + } + + public function create() + { + $class = $this->getClass(); + + return new $class; + } + + public function getClass() + { + return $this->class; + } +} diff --git a/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManagerInterface.php b/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManagerInterface.php new file mode 100644 index 0000000000..c31004b050 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Manager/ResourceManagerInterface.php @@ -0,0 +1,93 @@ + + */ +interface ResourceManagerInterface +{ + /** + * Creates new resource object. + * + * @return ResourceInterface + */ + function create(); + + /** + * Creates a new Pagerfanta instance to paginate the resources. + * + * @return PagerfantaInterface + */ + function createPaginator(); + + /** + * Persist. + * + * @param ResourceInterface $resource + * @param Boolean $flush + */ + function persist(ResourceInterface $resource, $flush = true); + + /** + * Removes resource. + * + * @param ResourceInterface $resource + * @param Boolean $flush + */ + function remove(ResourceInterface $resource, $flush = true); + + /** + * Finds resource by id. + * + * @param mixed Identifier + * + * @return ResourceInterface + */ + function find($id); + + /** + * Finds resource by criteria. + * + * @param array $criteria + * + * @return ResourceInterface + */ + function findOneBy(array $criteria); + + /** + * Find all. + * + * @return Collection + */ + function findAll(); + + /** + * Finds resources by criteria. + * + * @param array $criteria + * + * @return array + */ + function findBy(array $criteria); + + /** + * Get resource class name. + * + * @return string + */ + function getClass(); +} diff --git a/src/Sylius/Bundle/ResourceBundle/Model/Resource.php b/src/Sylius/Bundle/ResourceBundle/Model/Resource.php new file mode 100644 index 0000000000..ed69b7865a --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Model/Resource.php @@ -0,0 +1,27 @@ + + */ +abstract class Resource implements ResourceInterface +{ + protected $id; + + public function getId() + { + return $this->id; + } +} diff --git a/src/Sylius/Bundle/ResourceBundle/Model/ResourceInterface.php b/src/Sylius/Bundle/ResourceBundle/Model/ResourceInterface.php new file mode 100644 index 0000000000..01ebebcb31 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Model/ResourceInterface.php @@ -0,0 +1,27 @@ + + */ +interface ResourceInterface +{ + /** + * Get resource identifier. + * + * @return mixed + */ + function getId(); +} diff --git a/src/Sylius/Bundle/ResourceBundle/README.md b/src/Sylius/Bundle/ResourceBundle/README.md new file mode 100644 index 0000000000..c41e947ed6 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/README.md @@ -0,0 +1,97 @@ +SyliusResourceBundle [![Build status...](https://secure.travis-ci.org/Sylius/SyliusResourceBundle.png)](http://travis-ci.org/Sylius/SyliusResourceBundle) +====================== + +Sylius resource bundle. + +Sylius +------ + +**Sylius** is simple but **end-user and developer friendly** webshop engine built on top of Symfony2. + +Please visit [Sylius.org](http://sylius.org) for more details. + +Testing and build status +------------------------ + +This bundle uses [travis-ci.org](http://travis-ci.org/Sylius/SyliusResourceBundle) for CI. +[![Build status...](https://secure.travis-ci.org/Sylius/SyliusResourceBundle.png)](http://travis-ci.org/Sylius/SyliusResourceBundle) + +Before running tests, load the dependencies using [Composer](http://packagist.org). + +``` bash +$ wget http://getcomposer.org/composer.phar +$ php composer.phar install --dev +``` + +Now you can run the tests by simply using this command. + +``` bash +$ phpunit +``` + +Code examples +------------- + +If you want to see working implementation, try out the [Sylius sandbox application](http://github.com/Sylius/Sylius-Sandbox). +It's open sourced github project. + +Documentation +------------- + +Documentation is available on [readthedocs.org](http://sylius.readthedocs.org/en/latest/bundles/SyliusSalesBundle.html). + +Contributing +------------ + +All informations about contributing to Sylius can be found on [this page](http://sylius.readthedocs.org/en/latest/contributing/index.html). + +Mailing lists +------------- + +### Users + +If you are using this bundle and have any questions, feel free to ask on users mailing list. +[Mail](mailto:sylius@googlegroups.com) or [view it](http://groups.google.com/group/sylius). + +### Developers + +If you want to contribute, and develop this bundle, use the developers mailing list. +[Mail](mailto:sylius-dev@googlegroups.com) or [view it](http://groups.google.com/group/sylius-dev). + +Sylius twitter account +---------------------- + +If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/_Sylius) +or [follow me](http://twitter.com/pjedrzejewski). + +Bug tracking +------------ + +This bundle uses [GitHub issues](https://github.com/Sylius/SyliusResourceBundle/issues). +If you have found bug, please create an issue. + +Versioning +---------- + +Releases will be numbered with the format `major.minor.patch`. + +And constructed with the following guidelines. + +* Breaking backwards compatibility bumps the major. +* New additions without breaking backwards compatibility bumps the minor. +* Bug fixes and misc changes bump the patch. + +For more information on SemVer, please visit [semver.org website](http://semver.org/). + +This versioning method is same for all **Sylius** bundles and applications. + +License +------- + +License can be found [here](https://github.com/Sylius/SyliusResourceBundle/blob/master/Resources/meta/LICENSE). + +Authors +------- + +The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com). +See the list of [contributors](https://github.com/Sylius/SyliusResourceBundle/contributors). diff --git a/src/Sylius/Bundle/ResourceBundle/Resources/config/container/controllers.xml b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/controllers.xml new file mode 100644 index 0000000000..a6d3aa3b08 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/controllers.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff --git a/src/Sylius/Bundle/ResourceBundle/Resources/config/container/driver/doctrine/orm.xml b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/driver/doctrine/orm.xml new file mode 100644 index 0000000000..c40846c670 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/driver/doctrine/orm.xml @@ -0,0 +1,41 @@ + + + + + + + + Sylius\Bundle\AddressingBundle\Entity\AddressManager + Sylius\Bundle\AddressingBundle\Sorting\ORM\AddressSorter + + + + + + + %sylius_addressing.model.address.class% + + + + + + + + + + + + diff --git a/src/Sylius/Bundle/ResourceBundle/Resources/config/container/forms.xml b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/forms.xml new file mode 100644 index 0000000000..a78d80a61b --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/forms.xml @@ -0,0 +1,29 @@ + + + + + + + + + + %sylius_addressing.model.address.class% + + + + + + diff --git a/src/Sylius/Bundle/ResourceBundle/Resources/config/container/manipulators.xml b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/manipulators.xml new file mode 100644 index 0000000000..5cc8562cc5 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Resources/config/container/manipulators.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + diff --git a/src/Sylius/Bundle/ResourceBundle/Resources/meta/LICENSE b/src/Sylius/Bundle/ResourceBundle/Resources/meta/LICENSE new file mode 100644 index 0000000000..e8bccd0d18 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Resources/meta/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011-2012 Paweł Jędrzejewski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/Sylius/Bundle/ResourceBundle/SyliusResourceBundle.php b/src/Sylius/Bundle/ResourceBundle/SyliusResourceBundle.php new file mode 100644 index 0000000000..c94a9a5ce0 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/SyliusResourceBundle.php @@ -0,0 +1,29 @@ + + */ +class SyliusResourceBundle extends Bundle +{ + // Bundle driver list. + const DRIVER_DOCTRINE_ORM = 'doctrine/orm'; + const DRIVER_DOCTRINE_MONGODB_ODM = 'doctrine/mongodb-odm'; + const DRIVER_DOCTRINE_COUCHDB_ODM = 'doctrine/couchdb-odm'; + const DRIVER_PROPEL = 'propel'; + const DRIVER_PROPEL2 = 'propel2'; +} diff --git a/src/Sylius/Bundle/ResourceBundle/Tests/autoload.php.dist b/src/Sylius/Bundle/ResourceBundle/Tests/autoload.php.dist new file mode 100644 index 0000000000..fa58b499ad --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/Tests/autoload.php.dist @@ -0,0 +1,16 @@ +=5.3.2", + + "symfony/framework": ">=2.1.*", + "stof/doctrine-extensions-bundle": "*", + "white-october/pagerfanta-bundle": "*" + }, + "require-dev": { + "doctrine/orm": "*" + }, + "autoload": { + "psr-0": { "Sylius\\Bundle\\ResourceBundle": "" } + }, + "target-dir": "Sylius/Bundle/ResourceBundle" +} diff --git a/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist b/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist new file mode 100644 index 0000000000..9c664309e3 --- /dev/null +++ b/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist @@ -0,0 +1,19 @@ + + + + + + ./Tests + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + +