This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

ENABLE APC

New topics about Symfony 2 should go here

ENABLE APC

by kironet » Sat Apr 18, 2015 6:20 pm

Hello,

Please help me... Ho can I enable APC?
This is my config.yml
Code: Select all
...
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
#        auto_mapping: true
        default_entity_manager: default
        entity_managers:
            default:
                metadata_cache_driver: apc
                result_cache_driver: apc
                query_cache_driver: apc
                connection: default
                mappings:
                   DbDbBundle: { type: annotation, dir: Entity/ }
...


config_prod.yml
Code: Select all
...

framework:
    validation:
        cache: apc

doctrine:
    orm:
        metadata_cache_driver: apc
        result_cache_driver: apc
        query_cache_driver: apc

...


autoload.php
Code: Select all
<?php
require __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/**
 * @var ClassLoader $loader
 */
$loader = require __DIR__.'/../vendor/autoload.php';
$loader = new ApcUniversalClassLoader('apc.prefix.');

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;


It's ok?

But if I have error:

Code: Select all
 [Doctrine\Common\Annotations\AnnotationException]
  [Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class Db
  \DbBundle\Entity\Users does not exist, or could not be auto-loaded.


Users.php
Code: Select all
<?php

namespace Db\DbBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;

/**
 * Users
 *
 * @ORM\Table(name="Users")
 * @ORM\HasLifecycleCallbacks()
 * @ORM\Entity(repositoryClass="Db\DbBundle\Entity\UsersRepository")
 */
class Users implements AdvancedUserInterface, \Serializable
{
    /**
     * @var integer
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class="Db\DbBundle\Doctrine\RandomIdGenerator")
     */
    private $id;

    /**
     * @var string
     *
     * @Assert\NotBlank
     * @ORM\Column(name="first_name", type="string", length=255, nullable=false)
     */
    private $firstName;

    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @ORM\Column(name="last_name", type="string", length=255, nullable=false)
     */
    private $lastName;

    /**
     * @Assert\NotBlank()
     * @Assert\Email()
     * @ORM\Column(name="email", type="string", length=255, nullable=false, unique=true)
     */
    private $email;

    /**
     * @var string
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     * @Assert\NotBlank()
     * @Assert\Length( max = 4096)
     */
    private $password;

...


What is wrong?
kironet
Junior Member
 
Posts: 2
Joined: Sun Feb 01, 2015 2:49 pm