Skip to content

deprecate the phpcr_odm_reference_collection form type in favor of phpcr_document #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

* **2013-12-11**: [Form] Deprecated the form type "phpcr_odm_reference_collection".
It seems to not work and "phpcr_document" should cover everything we need.

* **2013-11-27**: [Initializer] Parameter "doctrine_phpcr.initialize.initializers" no longer defined
* Initializers are now collected using a compiler pass and injected into the new InitializerManager
* **2013-11-27**: [Initializer] `doctrine:phpcr:fixtures:load` now executes all of the initializers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
use Doctrine\ODM\PHPCR\ReferenceManyCollection;
use Doctrine\ODM\PHPCR\DocumentManager;

/**
* @deprecated This is only used by the deprecated PHPCRODMReferenceCollectionType.
* Will be removed in 1.2.
*/
class ReferenceManyCollectionToArrayTransformer implements DataTransformerInterface
{
const KEY_PATH = 'path';
Expand Down Expand Up @@ -34,6 +38,8 @@ class ReferenceManyCollectionToArrayTransformer implements DataTransformerInterf
*/
function __construct(DocumentManager $dm, $referencedClass, $key = self::KEY_UUID)
{
trigger_error('This is deprecated in favor of phpcr_document. If you think this is an error, please contact us and explain. We where not able to figure out what this type is good for.', E_WARNING);

$this->dm = $dm;
$this->referencedClass = $referencedClass;

Expand Down Expand Up @@ -68,4 +74,4 @@ public function reverseTransform($array)
{
return new ReferenceManyCollection($this->dm, $array, $this->referencedClass);
}
}
}
5 changes: 5 additions & 0 deletions Form/Type/PHPCRODMReferenceCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

/**
* A type to handle a list of references as simple choice.
*
* @deprecated This seems to do nothing more than the DocumentType.
* Will be removed in 1.2.
*/
class PHPCRODMReferenceCollectionType extends AbstractType
{
Expand Down Expand Up @@ -59,6 +62,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
trigger_error('This form type is deprecated in favor of phpcr_document. If you think this is an error, please contact us and explain. We where not able to figure out what this type is good for.', E_WARNING);

$transformer = new ReferenceManyCollectionToArrayTransformer($this->dm, $options['referenced_class'], $options['key']);
$builder->addModelTransformer($transformer);
}
Expand Down