Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

[Fixture] Strange DocumentManager argument... typo? #13

@cleentfaar

Description

@cleentfaar

Hey guys,

Was getting started on working with the CMF today and got around till the 2nd chapter of the guide, to find a strange typo in a code snippet here.

The argument is named $documentManager, the class DocumentManager gets imported, but ObjectManager is actually used as the type hint...?

There are some 10+ similar cases of these in the documentation, which made me think if this perhaps is not a typo but just a wrong interpretation on my hand; that ObjectManager should have been imported instead?

I then wondered if a similar thing is happening in the DemoBundle, and it is:

namespace Acme\DemoBundle\DataFixtures\PHPCR;

use Doctrine\ODM\PHPCR\DocumentManager;
// ...
use Doctrine\Common\Persistence\ObjectManager;
// ...

/**
 * Loads the initial demo data of the demo website.
 */
class LoadDemoData implements FixtureInterface
{
    /**
     * Load data fixtures with the passed DocumentManager
     *
     * @param DocumentManager $manager
     */
    public function load(ObjectManager $manager)
         // ... only ObjectManager used here
    }
}

The PHPDoc tells me it's a DocumentManager, the argument says ObjectManager, both get imported, but only the ObjectManager is actually used in the rest of the class.

I was making a PR of the documentation cases, thinking it was only a documentation error. But I realized more than just the documentation is affected; so perhaps this is all just a misunderstanding on my end, and some things just need some more clarification.

If any of you want to give me some pointers on how all of this project's load() examples should be named and imported consistently (i.e. as you imagine it), including that of AcmeDemoBundle's, I'm happy to make a larger PR for that as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions