Errors when Creating a Simple CRUD

Errors encountered while following the developer guide Show archive.org snapshot to create a simple CRUD.

ClassNotFoundException

Attempted to load class "InventoryBundle" from namespace "InventoryBundle".
Did you forget a "use" statement for another namespace?

Add the bundle definition file: src\InventoryBundle\InventoryBundle.php

<?php

namespace InventoryBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class InventoryBundle extends Bundle
{
}

AnnotationException > FileLoaderLoadException

[Semantical Error] The annotation "@AclAncestor" in method InventoryBundle\Controller\VehicleController::viewAction() was never imported. Did you maybe forget to add a "use" statement for this annotation? in D:\Work\wamp64\www\oro\platform-application\src\InventoryBundle/Controller (which is being imported from "D:\Work\wamp64\www\oro\platform-application\src\InventoryBundle\Resources/config/oro/routing.yml"). Make sure annotations are installed and enabled.

Missing use statement in file src\InventoryBundle\Controller\VehicleController.php:

<?php

namespace InventoryBundle\Controller;

use InventoryBundle\Entity\Vehicle;
use Oro\Bundle\SecurityBundle\Annotation\Acl;
use Oro\Bundle\SecurityBundle\Annotation\AclAncestor; // missing this
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

ORMException

Unknown Entity namespace alias 'InventoryBundle'.

Fatal Errors in DependencyInjection

Fatal error: Class 'InventoryBundle\DependencyInjection\Extension' not found in
D:\Work\wamp64\www\oro\platform-application\src\InventoryBundle\DependencyInject
ion\InventoryExtension.php on line 4

Fatal error: Declaration of InventoryBundle\DependencyInjection\InventoryExtensi
on::load(array $configs, InventoryBundle\DependencyInjection\ContainerBuilder $c
ontainer) must be compatible with Symfony\Component\DependencyInjection\Extensio
n\ExtensionInterface::load(array $configs, Symfony\Component\DependencyInjection
\ContainerBuilder $container) in D:\Work\wamp64\www\oro\platform-application\src
\InventoryBundle\DependencyInjection\InventoryExtension.php on line 15

Add use statements in src\InventoryBundle\DependencyInjection\InventoryExtension.php

<?php
namespace InventoryBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

class InventoryExtension extends Extension
{
    /**
     * @var \Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\CacheProviderLoader
     */
    private $loader;

    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('form.yml');
    }
}

Reference: vendor\akeneo\batch-bundle\Akeneo\Bundle\BatchBundle\DependencyInjection\AkeneoBatchExtension.php

kiatng About 5 years ago