Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Style CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Oct 11, 2016
1 parent dda414f commit 63efee4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 30 deletions.
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,11 @@ Storage
-------

...

Persistence
~~~~~~~~~~~

.. note::

Describe special actions required with PHPCR-ODM when persisting documents
with collection mappings.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

namespace Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm;

use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
use Doctrine\ODM\PHPCR\Event;
use Metadata\MetadataFactory;
use Metadata\MetadataFactoryInterface;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;

/**
* The collection identifier updater updates the IDs (paths) of any documents
Expand Down Expand Up @@ -79,4 +76,3 @@ public function update(DocumentManagerInterface $documentManager, $document)
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\Common\Persistence\Event\ManagerEventArgs;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ODM\PHPCR\Event;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
use Metadata\MetadataFactory;
use Metadata\MetadataFactoryInterface;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Event\ManagerEventArgs;
use PHPCR\Util\PathHelper;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;

/**
* This class provides exception messages for cases when the collection
Expand All @@ -37,7 +37,7 @@ public function getSubscribedEvents()
{
return [
Event::prePersist,
Event::preFlush
Event::preFlush,
];
}

Expand Down Expand Up @@ -101,7 +101,7 @@ public function prePersist(LifecycleEventArgs $args)
if (!isset($ctMetadata->propertyMetadata[$childrenField])) {
continue;
}

$childCtMetadata = $ctMetadata->propertyMetadata[$childrenField];
$children = $odmMetadata->getFieldValue($document, $childrenField);

Expand All @@ -112,7 +112,7 @@ public function prePersist(LifecycleEventArgs $args)
$this->stack[] = [
'children' => $children,
'ct_metadata' => $childCtMetadata,
'field' => $childrenField
'field' => $childrenField,
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Psi\Component\ContentType\Form\Extension\FieldExtension;
use Psi\Component\ContentType\Metadata\Driver\AnnotationDriver as CTAnnotationDriver;
use Psi\Component\ContentType\Metadata\Driver\ArrayDriver;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\CollectionIdentifierUpdater;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\FieldMapper;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\NodeTypeRegistrator as CtNodeTypeRegistrator;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;
Expand All @@ -44,7 +45,6 @@
use Psi\Component\ContentType\View\ScalarView;
use Psi\Component\ContentType\ViewRegistry;
use Symfony\Component\Form\Forms;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\CollectionIdentifierUpdater;

class Container extends PimpleContainer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,3 @@ private function createArticleSlideshow()
return $article;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Psi\Component\ContentType\Tests\Functional\Storage\Doctrine\PhpcrOdm;

use Doctrine\ODM\PHPCR\ChildrenCollection;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Article;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\ArticleWithRestrictedChildren;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Image;
Expand All @@ -15,12 +14,13 @@ class ObjectUnrestrictTest extends PhpcrOdmTestCase
public function init(array $mapping)
{
$container = $this->getContainer([
'mapping' => $mapping
'mapping' => $mapping,
]);
$this->documentManager = $container->get('doctrine_phpcr.document_manager');
$this->initPhpcr($this->documentManager);
$this->updater = $container->get('psi_content_type.storage.doctrine.phpcr_odm.collection_updater');
}

/**
* It should automatically allow mapped content objects as children.
*/
Expand Down Expand Up @@ -90,7 +90,7 @@ public function testCollectionAddToValidChildren()
$article->id = '/test/article';
$article->title = 'Foo';
$article->date = new \DateTime();
$article->slideshow = [ $image1, $image2, $image3 ];
$article->slideshow = [$image1, $image2, $image3];

$this->documentManager->persist($article);
$this->updater->update($this->documentManager, $article);
Expand All @@ -100,7 +100,6 @@ public function testCollectionAddToValidChildren()
$this->documentManager->find(null, '/test/article');
}


private function createArticleSlideshow()
{
$article = new Article();
Expand All @@ -119,4 +118,3 @@ private function createArticleSlideshow()
return $article;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

namespace Psi\Component\ContentType\Tests\Functional\Storage\Doctrine\PhpcrOdm;

use Doctrine\ODM\PHPCR\ChildrenCollection;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Article;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\ArticleWithRestrictedChildren;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Image;

class ScalarTest extends PhpcrOdmTestCase
{
Expand Down Expand Up @@ -66,4 +63,3 @@ public function testIntegerCollection()
$this->assertSame([12, 13, 14], $article->numbers);
}
}

2 changes: 0 additions & 2 deletions tests/Functional/Storage/Doctrine/PhpcrOdm/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Psi\Component\ContentType\Tests\Functional\Storage\Doctrine\PhpcrOdm;

use Doctrine\ODM\PHPCR\ChildrenCollection;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Article;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\ArticleWithRestrictedChildren;
use Psi\Component\ContentType\Tests\Functional\Example\Storage\Doctrine\PhpcrOdm\Image;

class GeneralTest extends PhpcrOdmTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Psi\Component\ContentType\Tests\Unit\Storage\Doctrine\PhpcrOdm;

use Metadata\MetadataFactoryInterface;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata as OdmMetadata;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
use Metadata\MetadataFactoryInterface;
use Psi\Component\ContentType\Metadata\ClassMetadata;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\CollectionIdentifierUpdater;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
use Psi\Component\ContentType\Storage\Doctrine\PhpcrOdm\PropertyEncoder;

class CollectionIdentifierUpdaterTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -63,7 +63,7 @@ public function testIgnoreNonCtMappings()

$this->odmMetadata->getIdentifierValue($this->document)->willReturn($identifier);
$this->odmMetadata->childrenMappings = [
'some_collection'
'some_collection',
];

$this->odmMetadata->getFieldValue($this->document, 'some_collection')->shouldNotBeCalled();
Expand All @@ -86,7 +86,7 @@ public function testSetIdentifierValue()

$this->odmMetadata->getIdentifierValue($this->document)->willReturn($identifier);
$this->odmMetadata->childrenMappings = [
'some_collection'
'some_collection',
];
$this->ctMetadata->propertyMetadata = [
'some_collection' => 'something',
Expand Down

0 comments on commit 63efee4

Please sign in to comment.