Permalink
Browse files

Initial setup, will probably still change a lot

  • Loading branch information...
1 parent 731bc72 commit 266f29389175bf67acdb0bd84bcb06e420e290db Willem-Jan Zijderveld committed Mar 9, 2012
@@ -0,0 +1,28 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * (c) Daniel Kucharski <daniel@xerias.be>
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Vespolina\PartnerBundle\DependencyInjection;
+
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\Config\FileLocator;
+
+class VespolinaPartnerExtension extends Extension
+{
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
+
+ foreach (array('mongodb') as $basename) {
+ $loader->load(sprintf('%s.xml', $basename));
+ }
+ }
+}
View
@@ -0,0 +1,21 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Vespolina\PartnerBundle\Document;
+
+use Vespolina\PartnerBundle\Model\Partner as AbstractPartner;
+
+abstract class BasePartner extends AbstractPartner
+{
+ protected $_id;
+
+ public function getId()
+ {
+ return $this->_id;
+ }
+}
View
@@ -0,0 +1,14 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Vespolina\PartnerBundle\Document;
+
+class Partner extends BasePartner
+{
+
+}
@@ -0,0 +1,53 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+namespace Vespolina\PartnerBundle\Document;
+
+use Vespolina\PartnerBundle\Model\PartnerManager as BasePartnerManager;
+use Vespolina\PartnerBundle\Model\Partner as AbstractPartner;
+
+class PartnerManager extends BasePartnerManager
+{
+ /**
+ * Doctrine MongoDB DocumentManager
+ * @var \Doctrine\ODM\MongoDB\DocumentManager
+ */
+ protected $dm;
+
+ /**
+ * Dcotrine MongoDB DocumentRepository
+ *
+ * @var \Vespolina\PartnerBundle\Document\PartnerRepository
+ */
+ protected $repo;
+
+ /**
+ * @var BasePartner $partnerClass
+ */
+ protected $partnerClass;
+
+ public function __construct(Container $container, $partnerClass)
+ {
+ $this->dm = $container->get('doctrine.odm.mongodb.default_document_manager');
+ $this->partnerClass = $partnerClass;
+
+ $this->repo = $this->dm->getRepository('Partner');
+ }
+
+ public function createPartner($role = Partner::ROLE_CUSTOMER, $type = Partner::INDIVIDUAL)
+ {
+ /* @var $partner Partner */
+ $partner = new $this->partnerClass;
+ $partner->setRole($role);
+ $partner->setType($type);
+ }
+
+ public function findByPartnerId($partnerId)
+ {
+ return $this->repo->findOneBy(array('partnerId' => $partnerId));
+ }
+}
@@ -0,0 +1,15 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+namespace Vespolina\PartnerBundle\Document;
+
+use Doctrine\ODM\MongoDB\DocumentRepository;
+
+class PartnerRepository extends DocumentRepository
+{
+
+}
@@ -0,0 +1,15 @@
+<?php
+/**
+ * (c) Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+namespace Vespolina\PartnerBundle\Model;
+
+class OrganisationDetails
+{
+ protected $name;
+ protected $category;
+ protected $employees;
+}
Oops, something went wrong.

0 comments on commit 266f293

Please sign in to comment.