Upgraded to Symfony 2.1-beta2
This commit is contained in:
parent
c1232c9792
commit
bb7aee6fee
10
README.md
10
README.md
@ -26,7 +26,7 @@ http://getcomposer.org/ or just run the following command:
|
||||
|
||||
Then, use the `create-project` command to generate a new Symfony application:
|
||||
|
||||
composer.phar create-project symfony/framework-standard-edition path/to/install
|
||||
php composer.phar create-project symfony/framework-standard-edition path/to/install
|
||||
|
||||
Composer will install Symfony and all its dependencies under the
|
||||
`path/to/install` directory.
|
||||
@ -73,7 +73,7 @@ To see a real-live Symfony page in action, access the following page:
|
||||
|
||||
web/app_dev.php/demo/hello/Fabien
|
||||
|
||||
3) Getting started with Symfony
|
||||
4) Getting started with Symfony
|
||||
-------------------------------
|
||||
|
||||
This distribution is meant to be the starting point for your Symfony
|
||||
@ -98,9 +98,9 @@ playing with it, you can remove it by following these steps:
|
||||
|
||||
* remove the `web/bundles/acmedemo` directory;
|
||||
|
||||
* remove the inclusion of the security configuration in
|
||||
`app/config/config.yml` (remove the `- { resource: security.yml }` line)
|
||||
or tweak the security configuration to fit your needs.
|
||||
* remove the `security.providers`, `security.firewall.login` and
|
||||
`security.firewall.secured_area` entries in the `security.yml` file or
|
||||
tweak the security configuration to fit your needs.
|
||||
|
||||
What's inside?
|
||||
---------------
|
||||
|
@ -14,6 +14,17 @@
|
||||
* It can be a mandatory requirement or an optional recommendation.
|
||||
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
|
||||
*
|
||||
* This file must be compatible with PHP 5.2+.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER
|
||||
*
|
||||
* If you want to change this file, edit the one in the
|
||||
* SensioDistributionBundle instead.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class Requirement
|
||||
@ -386,12 +397,18 @@ class SymfonyRequirements extends RequirementCollection
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_dir(__DIR__.'/../vendor/symfony'),
|
||||
is_dir(__DIR__.'/../vendor/composer'),
|
||||
'Vendor libraries must be installed',
|
||||
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
|
||||
'Then run "<strong>php composer.phar install</strong>" to install them.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
|
||||
'Outdated requirements file',
|
||||
'Your requirements file is outdated. Run composer install and re-check your configuration.'
|
||||
);
|
||||
|
||||
$baseDir = basename(__DIR__);
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/cache'),
|
||||
@ -413,7 +430,7 @@ class SymfonyRequirements extends RequirementCollection
|
||||
|
||||
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
|
||||
$this->addRequirement(
|
||||
(in_array(date_default_timezone_get(), \DateTimeZone::listIdentifiers())),
|
||||
(in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
|
||||
sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()),
|
||||
'Fix your <strong>php.ini</strong> file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).'
|
||||
);
|
||||
|
@ -2,23 +2,7 @@
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
|
||||
if (!$loader = @include __DIR__.'/../vendor/autoload.php') {
|
||||
|
||||
$message = <<< EOF
|
||||
<p>You must set up the project dependencies by running the following commands:</p>
|
||||
<pre>
|
||||
curl -s http://getcomposer.org/installer | php
|
||||
php composer.phar install
|
||||
</pre>
|
||||
|
||||
EOF;
|
||||
|
||||
if (PHP_SAPI === 'cli') {
|
||||
$message = strip_tags($message);
|
||||
}
|
||||
|
||||
die($message);
|
||||
}
|
||||
$loader = require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// intl
|
||||
if (!function_exists('intl_get_error_code')) {
|
||||
|
@ -72,6 +72,21 @@ interface ContainerInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
|
||||
interface IntrospectableContainerInterface extends ContainerInterface
|
||||
{
|
||||
|
||||
function initialized($id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
@ -341,6 +356,23 @@ class Container implements IntrospectableContainerInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
||||
interface TerminableInterface
|
||||
{
|
||||
|
||||
function terminate(Request $request, Response $response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
@ -419,6 +451,9 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||
|
||||
|
||||
function getLogDir();
|
||||
|
||||
|
||||
function getCharset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +502,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
protected $classes;
|
||||
protected $errorReportingLevel;
|
||||
|
||||
const VERSION = '2.1.0-BETA1';
|
||||
const VERSION = '2.1.0-BETA2';
|
||||
const VERSION_ID = '20100';
|
||||
const MAJOR_VERSION = '2';
|
||||
const MINOR_VERSION = '1';
|
||||
@ -736,6 +771,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
}
|
||||
|
||||
|
||||
public function getCharset()
|
||||
{
|
||||
return 'UTF-8';
|
||||
}
|
||||
|
||||
|
||||
protected function initializeBundles()
|
||||
{
|
||||
$this->bundles = array();
|
||||
@ -837,7 +878,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
'kernel.cache_dir' => $this->getCacheDir(),
|
||||
'kernel.logs_dir' => $this->getLogDir(),
|
||||
'kernel.bundles' => $bundles,
|
||||
'kernel.charset' => 'UTF-8',
|
||||
'kernel.charset' => $this->getCharset(),
|
||||
'kernel.container_class' => $this->getContainerClass(),
|
||||
),
|
||||
$this->getEnvParameters()
|
||||
@ -971,177 +1012,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\ClassLoader
|
||||
{
|
||||
|
||||
|
||||
class ClassCollectionLoader
|
||||
{
|
||||
static private $loaded;
|
||||
|
||||
|
||||
static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php')
|
||||
{
|
||||
if (isset(self::$loaded[$name])) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::$loaded[$name] = true;
|
||||
|
||||
if ($adaptive) {
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
|
||||
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
|
||||
}
|
||||
|
||||
$cache = $cacheDir.'/'.$name.$extension;
|
||||
|
||||
$reload = false;
|
||||
if ($autoReload) {
|
||||
$metadata = $cacheDir.'/'.$name.$extension.'.meta';
|
||||
if (!is_file($metadata) || !is_file($cache)) {
|
||||
$reload = true;
|
||||
} else {
|
||||
$time = filemtime($cache);
|
||||
$meta = unserialize(file_get_contents($metadata));
|
||||
|
||||
if ($meta[1] != $classes) {
|
||||
$reload = true;
|
||||
} else {
|
||||
foreach ($meta[0] as $resource) {
|
||||
if (!is_file($resource) || filemtime($resource) > $time) {
|
||||
$reload = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$reload && is_file($cache)) {
|
||||
require_once $cache;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
$content = '';
|
||||
foreach ($classes as $class) {
|
||||
if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) {
|
||||
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
|
||||
}
|
||||
|
||||
$r = new \ReflectionClass($class);
|
||||
$files[] = $r->getFileName();
|
||||
|
||||
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName()));
|
||||
|
||||
if (!$r->inNamespace()) {
|
||||
$c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n";
|
||||
} else {
|
||||
$c = self::fixNamespaceDeclarations('<?php '.$c);
|
||||
$c = preg_replace('/^\s*<\?php/', '', $c);
|
||||
}
|
||||
|
||||
$content .= $c;
|
||||
}
|
||||
|
||||
if (!is_dir(dirname($cache))) {
|
||||
mkdir(dirname($cache), 0777, true);
|
||||
}
|
||||
self::writeCacheFile($cache, '<?php '.$content);
|
||||
|
||||
if ($autoReload) {
|
||||
self::writeCacheFile($metadata, serialize(array($files, $classes)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public function fixNamespaceDeclarations($source)
|
||||
{
|
||||
if (!function_exists('token_get_all')) {
|
||||
return $source;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
$inNamespace = false;
|
||||
$tokens = token_get_all($source);
|
||||
|
||||
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
||||
$token = $tokens[$i];
|
||||
if (is_string($token)) {
|
||||
$output .= $token;
|
||||
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||
continue;
|
||||
} elseif (T_NAMESPACE === $token[0]) {
|
||||
if ($inNamespace) {
|
||||
$output .= "}\n";
|
||||
}
|
||||
$output .= $token[1];
|
||||
|
||||
while (($t = $tokens[++$i]) && is_array($t) && in_array($t[0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
|
||||
$output .= $t[1];
|
||||
}
|
||||
if (is_string($t) && '{' === $t) {
|
||||
$inNamespace = false;
|
||||
--$i;
|
||||
} else {
|
||||
$output = rtrim($output);
|
||||
$output .= "\n{";
|
||||
$inNamespace = true;
|
||||
}
|
||||
} else {
|
||||
$output .= $token[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($inNamespace) {
|
||||
$output .= "}\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
static private function writeCacheFile($file, $content)
|
||||
{
|
||||
$tmpFile = tempnam(dirname($file), basename($file));
|
||||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
||||
}
|
||||
|
||||
|
||||
static private function stripComments($source)
|
||||
{
|
||||
if (!function_exists('token_get_all')) {
|
||||
return $source;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
foreach (token_get_all($source) as $token) {
|
||||
if (is_string($token)) {
|
||||
$output .= $token;
|
||||
} elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||
$output .= $token[1];
|
||||
}
|
||||
}
|
||||
|
||||
$output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\ClassLoader
|
||||
{
|
||||
|
||||
@ -1155,7 +1025,7 @@ class ApcClassLoader
|
||||
public function __construct($prefix, $classFinder)
|
||||
{
|
||||
if (!extension_loaded('apc')) {
|
||||
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
|
||||
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
|
||||
}
|
||||
|
||||
if (!method_exists($classFinder, 'findFile')) {
|
||||
@ -1242,6 +1112,26 @@ interface BundleInterface extends ContainerAwareInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
|
||||
abstract class ContainerAware implements ContainerAwareInterface
|
||||
{
|
||||
|
||||
protected $container;
|
||||
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Bundle
|
||||
{
|
||||
|
||||
@ -1451,5 +1341,348 @@ class ConfigCache
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
|
||||
class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
{
|
||||
protected $dispatcher;
|
||||
protected $resolver;
|
||||
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
try {
|
||||
return $this->handleRaw($request, $type);
|
||||
} catch (\Exception $e) {
|
||||
if (false === $catch) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $this->handleException($e, $request, $type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function terminate(Request $request, Response $response)
|
||||
{
|
||||
$this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response));
|
||||
}
|
||||
|
||||
|
||||
private function handleRaw(Request $request, $type = self::MASTER_REQUEST)
|
||||
{
|
||||
$event = new GetResponseEvent($this, $request, $type);
|
||||
$this->dispatcher->dispatch(KernelEvents::REQUEST, $event);
|
||||
|
||||
if ($event->hasResponse()) {
|
||||
return $this->filterResponse($event->getResponse(), $request, $type);
|
||||
}
|
||||
|
||||
if (false === $controller = $this->resolver->getController($request)) {
|
||||
throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo()));
|
||||
}
|
||||
|
||||
$event = new FilterControllerEvent($this, $controller, $request, $type);
|
||||
$this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event);
|
||||
$controller = $event->getController();
|
||||
|
||||
$arguments = $this->resolver->getArguments($request, $controller);
|
||||
|
||||
$response = call_user_func_array($controller, $arguments);
|
||||
|
||||
if (!$response instanceof Response) {
|
||||
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
|
||||
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
|
||||
|
||||
if ($event->hasResponse()) {
|
||||
$response = $event->getResponse();
|
||||
}
|
||||
|
||||
if (!$response instanceof Response) {
|
||||
$msg = sprintf('The controller must return a response (%s given).', $this->varToString($response));
|
||||
|
||||
if (null === $response) {
|
||||
$msg .= ' Did you forget to add a return statement somewhere in your controller?';
|
||||
}
|
||||
throw new \LogicException($msg);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->filterResponse($response, $request, $type);
|
||||
}
|
||||
|
||||
|
||||
private function filterResponse(Response $response, Request $request, $type)
|
||||
{
|
||||
$event = new FilterResponseEvent($this, $request, $type, $response);
|
||||
|
||||
$this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
|
||||
|
||||
return $event->getResponse();
|
||||
}
|
||||
|
||||
|
||||
private function handleException(\Exception $e, $request, $type)
|
||||
{
|
||||
$event = new GetResponseForExceptionEvent($this, $request, $type, $e);
|
||||
$this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event);
|
||||
|
||||
if (!$event->hasResponse()) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->filterResponse($event->getResponse(), $request, $type);
|
||||
} catch (\Exception $e) {
|
||||
return $event->getResponse();
|
||||
}
|
||||
}
|
||||
|
||||
private function varToString($var)
|
||||
{
|
||||
if (is_object($var)) {
|
||||
return sprintf('Object(%s)', get_class($var));
|
||||
}
|
||||
|
||||
if (is_array($var)) {
|
||||
$a = array();
|
||||
foreach ($var as $k => $v) {
|
||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||
}
|
||||
|
||||
return sprintf("Array(%s)", implode(', ', $a));
|
||||
}
|
||||
|
||||
if (is_resource($var)) {
|
||||
return sprintf('Resource(%s)', get_resource_type($var));
|
||||
}
|
||||
|
||||
if (null === $var) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (false === $var) {
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if (true === $var) {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
return (string) $var;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernel as BaseHttpKernel;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
|
||||
class HttpKernel extends BaseHttpKernel
|
||||
{
|
||||
protected $container;
|
||||
|
||||
private $esiSupport;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
|
||||
{
|
||||
parent::__construct($dispatcher, $controllerResolver);
|
||||
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$request->headers->set('X-Php-Ob-Level', ob_get_level());
|
||||
|
||||
$this->container->enterScope('request');
|
||||
$this->container->set('request', $request, 'request');
|
||||
|
||||
try {
|
||||
$response = parent::handle($request, $type, $catch);
|
||||
} catch (\Exception $e) {
|
||||
$this->container->leaveScope('request');
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->container->leaveScope('request');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function forward($controller, array $attributes = array(), array $query = array())
|
||||
{
|
||||
$attributes['_controller'] = $controller;
|
||||
$subRequest = $this->container->get('request')->duplicate($query, null, $attributes);
|
||||
|
||||
return $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
public function render($controller, array $options = array())
|
||||
{
|
||||
$options = array_merge(array(
|
||||
'attributes' => array(),
|
||||
'query' => array(),
|
||||
'ignore_errors' => !$this->container->getParameter('kernel.debug'),
|
||||
'alt' => array(),
|
||||
'standalone' => false,
|
||||
'comment' => '',
|
||||
), $options);
|
||||
|
||||
if (!is_array($options['alt'])) {
|
||||
$options['alt'] = array($options['alt']);
|
||||
}
|
||||
|
||||
if (null === $this->esiSupport) {
|
||||
$this->esiSupport = $this->container->has('esi') && $this->container->get('esi')->hasSurrogateEsiCapability($this->container->get('request'));
|
||||
}
|
||||
|
||||
if ($this->esiSupport && (true === $options['standalone'] || 'esi' === $options['standalone'])) {
|
||||
$uri = $this->generateInternalUri($controller, $options['attributes'], $options['query']);
|
||||
|
||||
$alt = '';
|
||||
if ($options['alt']) {
|
||||
$alt = $this->generateInternalUri($options['alt'][0], isset($options['alt'][1]) ? $options['alt'][1] : array(), isset($options['alt'][2]) ? $options['alt'][2] : array());
|
||||
}
|
||||
|
||||
return $this->container->get('esi')->renderIncludeTag($uri, $alt, $options['ignore_errors'], $options['comment']);
|
||||
}
|
||||
|
||||
if ('js' === $options['standalone']) {
|
||||
$uri = $this->generateInternalUri($controller, $options['attributes'], $options['query'], false);
|
||||
$defaultContent = null;
|
||||
|
||||
if ($template = $this->container->getParameter('templating.hinclude.default_template')) {
|
||||
$defaultContent = $this->container->get('templating')->render($template);
|
||||
}
|
||||
|
||||
return $this->renderHIncludeTag($uri, $defaultContent);
|
||||
}
|
||||
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if (0 === strpos($controller, '/')) {
|
||||
$subRequest = Request::create($request->getUriForPath($controller), 'get', array(), $request->cookies->all(), array(), $request->server->all());
|
||||
if ($session = $request->getSession()) {
|
||||
$subRequest->setSession($session);
|
||||
}
|
||||
} else {
|
||||
$options['attributes']['_controller'] = $controller;
|
||||
|
||||
if (!isset($options['attributes']['_format'])) {
|
||||
$options['attributes']['_format'] = $request->getRequestFormat();
|
||||
}
|
||||
|
||||
$options['attributes']['_route'] = '_internal';
|
||||
$subRequest = $request->duplicate($options['query'], null, $options['attributes']);
|
||||
$subRequest->setMethod('GET');
|
||||
}
|
||||
|
||||
$level = ob_get_level();
|
||||
try {
|
||||
$response = $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);
|
||||
|
||||
if (!$response->isSuccessful()) {
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $request->getUri(), $response->getStatusCode()));
|
||||
}
|
||||
|
||||
if (!$response instanceof StreamedResponse) {
|
||||
return $response->getContent();
|
||||
}
|
||||
|
||||
$response->sendContent();
|
||||
} catch (\Exception $e) {
|
||||
if ($options['alt']) {
|
||||
$alt = $options['alt'];
|
||||
unset($options['alt']);
|
||||
$options['attributes'] = isset($alt[1]) ? $alt[1] : array();
|
||||
$options['query'] = isset($alt[2]) ? $alt[2] : array();
|
||||
|
||||
return $this->render($alt[0], $options);
|
||||
}
|
||||
|
||||
if (!$options['ignore_errors']) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
while (ob_get_level() > $level) {
|
||||
ob_get_clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function generateInternalUri($controller, array $attributes = array(), array $query = array(), $secure = true)
|
||||
{
|
||||
if (0 === strpos($controller, '/')) {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
$path = http_build_query($attributes, '', '&');
|
||||
$uri = $this->container->get('router')->generate($secure ? '_internal' : '_internal_public', array(
|
||||
'controller' => $controller,
|
||||
'path' => $path ?: 'none',
|
||||
'_format' => $this->container->get('request')->getRequestFormat(),
|
||||
));
|
||||
|
||||
if ($queryString = http_build_query($query, '', '&')) {
|
||||
$uri .= '?'.$queryString;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
||||
public function renderHIncludeTag($uri, $defaultContent = null)
|
||||
{
|
||||
return sprintf('<hx:include src="%s">%s</hx:include>', $uri, $defaultContent);
|
||||
}
|
||||
|
||||
public function hasEsiSupport()
|
||||
{
|
||||
return $this->esiSupport;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace { return $loader; }
|
||||
|
@ -6,7 +6,6 @@ framework:
|
||||
#esi: ~
|
||||
#translator: { fallback: %locale% }
|
||||
secret: %secret%
|
||||
charset: UTF-8
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing.yml"
|
||||
strict_parameters: %kernel.debug%
|
||||
@ -15,8 +14,8 @@ framework:
|
||||
validation: { enable_annotations: true }
|
||||
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
|
||||
default_locale: %locale%
|
||||
session:
|
||||
auto_start: true
|
||||
trust_proxy_headers: false # Should Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
|
||||
session: ~
|
||||
|
||||
# Twig Configuration
|
||||
twig:
|
||||
|
@ -1,15 +1,12 @@
|
||||
KekRozsakAdminBundle:
|
||||
resource: "@KekRozsakAdminBundle/Controller/DefaultController.php"
|
||||
resource: "@KekRozsakAdminBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle:
|
||||
resource: "@KekRozsakFrontBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakSecurityBundle:
|
||||
resource: "@KekRozsakSecurityBundle/Controller/DefaultController.php"
|
||||
resource: "@KekRozsakSecurityBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle_Default:
|
||||
resource: "@KekRozsakFrontBundle/Controller/DefaultController.php"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle_Forum:
|
||||
resource: "@KekRozsakFrontBundle/Controller/ForumController.php"
|
||||
type: annotation
|
||||
|
@ -5,7 +5,7 @@ jms_security_extra:
|
||||
security:
|
||||
encoders:
|
||||
Symfony\Component\Security\Core\User\User: plaintext
|
||||
KekRozsak\FrontBundle\Entity\User:
|
||||
KekRozsak\SecurityBundle\Entity\User:
|
||||
id: kek_rozsak_security.encoder.crypt
|
||||
|
||||
role_hierarchy:
|
||||
@ -15,7 +15,7 @@ security:
|
||||
providers:
|
||||
user_db:
|
||||
entity:
|
||||
class: KekRozsak\FrontBundle\Entity\User
|
||||
class: KekRozsak\SecurityBundle\Entity\User
|
||||
property: username
|
||||
|
||||
firewalls:
|
||||
@ -29,6 +29,7 @@ security:
|
||||
|
||||
members:
|
||||
pattern: ^/
|
||||
|
||||
form_login:
|
||||
check_path: /login_check
|
||||
login_path: /login
|
||||
@ -42,7 +43,7 @@ security:
|
||||
- { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/cikk/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/jelentkezes, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/most-varj, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/most_varj, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/, roles: [ IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED ] }
|
||||
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
|
||||
#- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
|
||||
|
23
app/upgrade.php
Normal file
23
app/upgrade.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// This script is very conservative in what it uses to avoid breaks at all costs
|
||||
|
||||
use Sensio\Bundle\DistributionBundle\Upgrade\Upgrade;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
// We don't use the app autoloader in case it is not up to date
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
$upgrade = new Upgrade();
|
||||
$output = new ConsoleOutput();
|
||||
|
||||
$skeletonDir = __DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton';
|
||||
|
||||
$files = array(
|
||||
__DIR__.'/console' => $skeletonDir.'/app/console',
|
||||
__DIR__.'/autoload.php' => $skeletonDir.'/app/autoload.php',
|
||||
);
|
||||
|
||||
foreach ($files as $file => $skeleton) {
|
||||
$upgrade->outputConsoleDiff($output, $file, $skeleton);
|
||||
}
|
@ -23,17 +23,20 @@
|
||||
"post-install-cmd": [
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
|
||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"symfony-app-dir": "app",
|
||||
"symfony-web-dir": "web"
|
||||
|
52
composer.lock
generated
52
composer.lock
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"hash": "60f09c83d9f0891b51ac51941970dcd5",
|
||||
"hash": "ab7ccf177098603cace942212179431f",
|
||||
"packages": [
|
||||
{
|
||||
"package": "doctrine/common",
|
||||
@ -8,17 +8,20 @@
|
||||
{
|
||||
"package": "doctrine/dbal",
|
||||
"version": "2.2.x-dev",
|
||||
"source-reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b"
|
||||
"source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730",
|
||||
"commit-date": "1341779435"
|
||||
},
|
||||
{
|
||||
"package": "doctrine/doctrine-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "94951737d6c692500d6b13bb92871935568a4ba5"
|
||||
"source-reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692",
|
||||
"commit-date": "1341405737"
|
||||
},
|
||||
{
|
||||
"package": "doctrine/orm",
|
||||
"version": "2.2.x-dev",
|
||||
"source-reference": "5f66c65c9a8d984899903b54215d0249a45b92d6"
|
||||
"source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4",
|
||||
"commit-date": "1341676080"
|
||||
},
|
||||
{
|
||||
"package": "jms/aop-bundle",
|
||||
@ -49,7 +52,8 @@
|
||||
{
|
||||
"package": "kriswallsmith/assetic",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7"
|
||||
"source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7",
|
||||
"commit-date": "1339515714"
|
||||
},
|
||||
{
|
||||
"package": "monolog/monolog",
|
||||
@ -58,43 +62,50 @@
|
||||
{
|
||||
"package": "sensio/distribution-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071"
|
||||
"source-reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25",
|
||||
"commit-date": "1341741741"
|
||||
},
|
||||
{
|
||||
"package": "sensio/framework-extra-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "62e41b85947034b0f1dfe31bb8e76920e1488571"
|
||||
"source-reference": "4f54e5d5fb3b54fb107892684018f3704934c48d",
|
||||
"commit-date": "1341126219"
|
||||
},
|
||||
{
|
||||
"package": "sensio/generator-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36"
|
||||
"source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36",
|
||||
"commit-date": "1340138445"
|
||||
},
|
||||
{
|
||||
"package": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "4.1.x-dev",
|
||||
"alias-version": "4.1.9999999.9999999-dev"
|
||||
"alias-pretty-version": "4.2.x-dev",
|
||||
"alias-version": "4.2.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99"
|
||||
"source-reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75",
|
||||
"commit-date": "1341746460"
|
||||
},
|
||||
{
|
||||
"package": "symfony/assetic-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc"
|
||||
"source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc",
|
||||
"commit-date": "1340234971"
|
||||
},
|
||||
{
|
||||
"package": "symfony/monolog-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f"
|
||||
"source-reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5",
|
||||
"commit-date": "1341078487"
|
||||
},
|
||||
{
|
||||
"package": "symfony/swiftmailer-bundle",
|
||||
"version": "dev-master",
|
||||
"source-reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3"
|
||||
"source-reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e",
|
||||
"commit-date": "1341509614"
|
||||
},
|
||||
{
|
||||
"package": "symfony/symfony",
|
||||
@ -105,23 +116,26 @@
|
||||
{
|
||||
"package": "symfony/symfony",
|
||||
"version": "dev-master",
|
||||
"source-reference": "v2.1.0-BETA1"
|
||||
"source-reference": "v2.1.0-BETA2",
|
||||
"commit-date": "1341820358"
|
||||
},
|
||||
{
|
||||
"package": "twig/extensions",
|
||||
"version": "dev-master",
|
||||
"source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1"
|
||||
"source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1",
|
||||
"commit-date": "1337599699"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "1.8.x-dev",
|
||||
"alias-version": "1.8.9999999.9999999-dev"
|
||||
"alias-pretty-version": "1.9.x-dev",
|
||||
"alias-version": "1.9.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"source-reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba"
|
||||
"source-reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf",
|
||||
"commit-date": "1341423205"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -2,8 +2,9 @@
|
||||
|
||||
namespace KekRozsak\AdminBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
/**
|
||||
* @Route("/admin")
|
||||
@ -11,14 +12,15 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg")
|
||||
* @Route("/manage_regs", name="KekRozsakAdminBundle_manage_regs")
|
||||
* @Template()
|
||||
*/
|
||||
public function manageRegsAction()
|
||||
{
|
||||
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakFrontBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
|
||||
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
|
||||
|
||||
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig', array (
|
||||
return array(
|
||||
'users' => $users,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
KekRozsakAdminBundle_manage_regs:
|
||||
pattern: /jelentkezok
|
||||
defaults:
|
||||
_controller: KekRozsakAdminBundle:Default:manageRegs
|
@ -2,10 +2,12 @@
|
||||
|
||||
namespace KekRozsak\FrontBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
use KekRozsak\FrontBundle\Form\Type\UserType;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
@ -14,7 +16,7 @@ class DefaultController extends Controller
|
||||
*/
|
||||
public function homepageAction()
|
||||
{
|
||||
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => 1), true, array('createdAt', 'DESC'), 1);
|
||||
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => true), true, array('createdAt', 'DESC'), 1);
|
||||
if (!$mainPageArticle)
|
||||
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
||||
|
||||
@ -23,6 +25,9 @@ class DefaultController extends Controller
|
||||
|
||||
/**
|
||||
* @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article")
|
||||
* @Template()
|
||||
*
|
||||
* @param string $articleSlug
|
||||
*/
|
||||
public function articleAction($articleSlug)
|
||||
{
|
||||
@ -31,49 +36,43 @@ class DefaultController extends Controller
|
||||
if (!$article)
|
||||
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array(
|
||||
'article' => $article
|
||||
));
|
||||
return array(
|
||||
'article' => $article,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/profil", name="KekRozsakFrontBundle_profile_edit")
|
||||
* @Template("KekRozsakFrontBundle:Default:userprofile.html.twig")
|
||||
*/
|
||||
public function profileEditAction()
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$oldPassword = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:User')->findOneById($user->getId())->getPassword();
|
||||
$form = $this->createForm(new UserType(), $user);
|
||||
|
||||
$oldPassword = $user->getPassword();
|
||||
$form = $this->createForm(new UserType(), $user);
|
||||
$saveSuccess = false;
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
if ($form->isValid())
|
||||
{
|
||||
if ($user->getPassword() != '')
|
||||
{
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->getPassword() == '')
|
||||
$user->setPassword($oldPassword);
|
||||
}
|
||||
if ($user->getUserData()->getUserId() === null)
|
||||
{
|
||||
$user->getUserData()->setUser($user);
|
||||
}
|
||||
else
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
// $saveSuccess = true
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Default:userprofile.html.twig', array(
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'saveSuccess' => $saveSuccess,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
namespace KekRozsak\FrontBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\FrontBundle\Form\Type\ForumPostType;
|
||||
@ -16,40 +17,42 @@ class ForumController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("", name="KekRozsakFrontBundle_forum_main")
|
||||
* @Template("KekRozsakFrontBundle:Forum:topic_group_list.html.twig")
|
||||
*/
|
||||
public function mainAction()
|
||||
{
|
||||
// TODO: Protect this controller with roles? It is also defined in security.yml
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
|
||||
// TODO: ORDER the topic list by last post date
|
||||
$topicGroups = $groupRepo->findAll();
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:topic_group_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroups' => $topicGroups,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{topicGroupSlug}", name="KekRozsakFrontBundle_forum_topic_list")
|
||||
* @Template("KekRozsakFrontBundle:Forum:topic_list.html.twig")
|
||||
*/
|
||||
public function topicListAction($topicGroupSlug)
|
||||
{
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
|
||||
if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug)))
|
||||
throw $this->createNotFoundException('A kért témakör nem létezik!');
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:topic_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroup' => $topicGroup,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list")
|
||||
* @Template("KekRozsakFrontBundle:Forum:post_list.html.twig")
|
||||
*/
|
||||
public function postListAction($topicGroupSlug, $topicSlug)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
// Get the topic group based on slug
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug)))
|
||||
@ -68,6 +71,7 @@ class ForumController extends Controller
|
||||
$post = new ForumPost();
|
||||
$form = $this->createForm(new ForumPostType($topicGroup->getId(), $topic->getId()), $post);
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
@ -89,12 +93,11 @@ class ForumController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:post_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroup' => $topicGroup,
|
||||
'topic' => $topic,
|
||||
'posts' => $posts,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,9 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\Article
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="articles")
|
||||
*/
|
||||
@ -17,7 +16,7 @@ class Article
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer", name="id")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
@ -31,9 +30,66 @@ class Article
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
@ -88,7 +144,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $text
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
private $text;
|
||||
@ -96,7 +152,7 @@ class Article
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param text $text
|
||||
* @param string $text
|
||||
* @return Article
|
||||
*/
|
||||
public function setText($text)
|
||||
@ -108,186 +164,16 @@ class Article
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return text
|
||||
* return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="articles")
|
||||
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy = null)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $updatedAt
|
||||
* @ORM\Column(type="datetime", nullable=true, name="updated_at")
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $updateReason
|
||||
* @ORM\Column(type="text", nullable=true, name="update_reason")
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param text $updateReason
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $mainPage
|
||||
* @ORM\Column(type="boolean", name="main_page", nullable=true)
|
||||
* @ORM\Column(type="boolean", name="main_page")
|
||||
*/
|
||||
private $mainPage;
|
||||
|
||||
@ -314,7 +200,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $public
|
||||
* @var boolean public
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
private $public;
|
||||
@ -325,7 +211,7 @@ class Article
|
||||
* @param boolean $public
|
||||
* @return Article
|
||||
*/
|
||||
public function setPublic($public)
|
||||
public function setPublic($public = false)
|
||||
{
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
@ -336,8 +222,37 @@ class Article
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPublic()
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source = null)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,11 @@
|
||||
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Orm\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopic;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopicGroup;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\ForumPost
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="forum_posts")
|
||||
*/
|
||||
@ -34,8 +31,36 @@ class ForumPost
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@ -45,10 +70,9 @@ class ForumPost
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,151 +86,7 @@ class ForumPost
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts")
|
||||
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $updateReason
|
||||
* @ORM\Column(type="text", name="update_reason", nullable=true)
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param string $updateReason
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopic $topic
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
|
||||
*/
|
||||
private $topic;
|
||||
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topic = $topic;
|
||||
if (($this->topic->getLastPost() === null) || ($this->topic->getLastPost()->getCreatedAt() > $this->createdAt))
|
||||
$topic->setLastPost($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $text
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
private $text;
|
||||
@ -232,4 +112,33 @@ class ForumPost
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopic $topic
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
|
||||
*/
|
||||
private $topic;
|
||||
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topic = $topic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,21 +3,19 @@
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopicGroup;
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\ForumTopic
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="forum_topics", uniqueConstraints={@ORM\UniqueConstraint(columns={"topic_group_id", "title"}), @ORM\UniqueConstraint(columns={"topic_group_id", "slug"})})
|
||||
* @ORM\Table(name="forum_topics")
|
||||
*/
|
||||
class ForumTopic
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->posts = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->posts = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,36 +37,95 @@ class ForumTopic
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100)
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $title;
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* Set createdBy
|
||||
*
|
||||
* @param string $title
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* Get createdBy
|
||||
*
|
||||
* @return string
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->title;
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopicGroup $topicGroup
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
|
||||
* @ORM\JoinColumn(name="topic_group_id")
|
||||
*/
|
||||
private $topicGroup;
|
||||
|
||||
/**
|
||||
* Set topicGroup
|
||||
*
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTopicGroup(ForumTopicGroup $topicGroup)
|
||||
{
|
||||
$this->topicGroup = $topicGroup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topicGroup
|
||||
*
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function getTopicGroup()
|
||||
{
|
||||
return $this->topicGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100)
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
@ -95,207 +152,37 @@ class ForumTopic
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
* Set title
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param string $title
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
* Get title
|
||||
*
|
||||
* @return DateTime
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->createdAt;
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedBy(\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param datetime $updatedAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $updateReason
|
||||
* @ORM\Column(type="text", name="update_reason")
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param text $updateReason
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopicGroup
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup")
|
||||
* @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id")
|
||||
*/
|
||||
private $topicGroup;
|
||||
|
||||
/**
|
||||
* Set topicGroup
|
||||
*
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTopicGroup(ForumTopicGroup $topicGroup)
|
||||
{
|
||||
$this->topicGroup = $topicGroup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topicGroup
|
||||
*
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function getTopicGroup()
|
||||
{
|
||||
return $this->topicGroup;
|
||||
}
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
|
||||
*/
|
||||
private $posts;
|
||||
|
||||
/**
|
||||
* Add posts
|
||||
*
|
||||
* @param ForumPost $posts
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addForumPost(ForumPost $posts)
|
||||
{
|
||||
$this->posts[] = $posts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get posts
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getPosts()
|
||||
{
|
||||
return $this->posts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumPost
|
||||
* @var ForumPost $lastPost
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
private $lastPost;
|
||||
|
||||
@ -305,11 +192,9 @@ class ForumTopic
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setLastPost(ForumPost $lastPost = null)
|
||||
public function setLastPost($lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
$this->topicGroup->setLastPost($lastPost);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -321,4 +206,33 @@ class ForumTopic
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $topics;
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
|
||||
*/
|
||||
private $posts;
|
||||
|
||||
/**
|
||||
* Add post
|
||||
*
|
||||
* @param ForumPost $post
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addPost(ForumPost $post)
|
||||
{
|
||||
$this->posts[] = $post;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get posts
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getPosts()
|
||||
{
|
||||
return $this->posts;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,9 @@
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopic;
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\ForumTopicGroup
|
||||
@ -17,7 +16,7 @@ class ForumTopicGroup
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->topic = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->topics = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,64 +38,37 @@ class ForumTopicGroup
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, unique=true)
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $title;
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* Set createdBy
|
||||
*
|
||||
* @param string $title
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* Get createdBy
|
||||
*
|
||||
* @return string
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->title;
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@ -123,161 +95,87 @@ class ForumTopicGroup
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $createdBy;
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
* Set slug
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
* Get slug
|
||||
*
|
||||
* @return User
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->createdBy;
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
* Set title
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @param string $title
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
* Get title
|
||||
*
|
||||
* @return datetime
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $update_reason
|
||||
* @ORM\Column(type="text", name="update_reason", nullable=true)
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param text $updateReason
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumPost
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
private $lastPost;
|
||||
|
||||
/**
|
||||
* Set lastPost
|
||||
*
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setLastPost(ForumPost $lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastPost
|
||||
*
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function getLastPost()
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @var ArrayCollection $topics
|
||||
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
|
||||
*/
|
||||
private $topics;
|
||||
|
||||
/**
|
||||
* Add topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function addTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topics[] = $topic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topics
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getTopics()
|
||||
{
|
||||
return $this->topics;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\News
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="news")
|
||||
*/
|
||||
@ -15,7 +14,7 @@ class News
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer", name="id")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
@ -29,122 +28,12 @@ class News
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param datetime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @var text $updateReason
|
||||
* @ORM\Column(type="text", name="update_reason", nullable=true)
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var text $text
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param datetime $updatedAt
|
||||
* @return News
|
||||
*/
|
||||
public function setUpdatedAt($updatedAt)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param text $updateReason
|
||||
* @return News
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
@ -168,31 +57,15 @@ class News
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return News
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param text $text
|
||||
* @param string $text
|
||||
* @return News
|
||||
*/
|
||||
public function setText($text)
|
||||
@ -204,7 +77,7 @@ class News
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return text
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
@ -212,12 +85,47 @@ class News
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\User $createdBy
|
||||
* @param DateTime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
@ -226,32 +134,10 @@ class News
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\User
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
|
||||
* @return News
|
||||
*/
|
||||
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
}
|
||||
|
@ -1,488 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\Article;
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\FrontBundle\Entity\Group;
|
||||
use KekRozsak\FrontBundle\Entity\Document;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
use KekRozsak\FrontBundle\Entity\PollAnswer;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\User
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="users")
|
||||
* @DoctrineAssert\UniqueEntity(fields={"username"}, message="Ez a felhasználónév már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
* @DoctrineAssert\UniqueEntity(fields={"email"}, message="Ez az e-mail cím már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
* @DoctrineAssert\UniqueEntity(fields={"displayName"}, message="Ez a név már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
*/
|
||||
class User implements UserInterface, AdvancedUserInterface
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $username
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
* @Assert\NotBlank(groups={"registration"})
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $password
|
||||
* @ORM\Column(type="string", length=50, nullable=false)
|
||||
* @Assert\NotBlank(groups={"registration"})
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $email
|
||||
* @ORM\Column(type="string", length=50, unique=true, nullable=false)
|
||||
* @Assert\NotBlank(groups={"registration"})
|
||||
* @Assert\Email(groups={"registration"})
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* Set email
|
||||
*
|
||||
* @param string $email
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $registeredAt
|
||||
* @ORM\Column(type="datetime", name="registered_at", nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* TODO: original validation.yml contained Type: \DateTime
|
||||
* Assert\Type("\\DateTime")
|
||||
*/
|
||||
private $registeredAt;
|
||||
|
||||
/**
|
||||
* Set registeredAt
|
||||
*
|
||||
* @param DateTime $registeredAt
|
||||
* @return User
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get registeredAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getRegisteredAt()
|
||||
{
|
||||
return $this->registeredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $displayName
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name")
|
||||
*/
|
||||
private $displayName;
|
||||
|
||||
/**
|
||||
* Set displayName
|
||||
*
|
||||
* @param string $displayName
|
||||
* @return User
|
||||
*/
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
$this->displayName = $displayName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $acceptedBy
|
||||
* @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $acceptedBy;
|
||||
|
||||
/**
|
||||
* Set acceptedBy
|
||||
*
|
||||
* @param User $acceptedBy
|
||||
* @return User
|
||||
*/
|
||||
public function setAcceptedBy(User $acceptedBy = null)
|
||||
{
|
||||
$this->acceptedBy = $acceptedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get acceptedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getAcceptedBy()
|
||||
{
|
||||
return $this->acceptedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $lastLoginAt
|
||||
* @ORM\Column(type="datetime", nullable=true, name="last_login_at")
|
||||
*/
|
||||
private $lastLoginAt;
|
||||
|
||||
/**
|
||||
* Set lastLoginAt
|
||||
*
|
||||
* @param DateTime $lastLoginAt
|
||||
* @return User
|
||||
*/
|
||||
public function setLastLoginAt(\DateTime $lastLoginAt = null)
|
||||
{
|
||||
$this->lastLoginAt = $lastLoginAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastLoginAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getLastLoginAt()
|
||||
{
|
||||
return $this->lastLoginAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="Article", mappedBy="createdBy", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $articles;
|
||||
|
||||
/**
|
||||
* Add articles
|
||||
*
|
||||
* @param Article $articles
|
||||
* @return User
|
||||
*/
|
||||
public function addArticle(Article $articles)
|
||||
{
|
||||
$this->articles[] = $articles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get articles
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getArticles()
|
||||
{
|
||||
return $this->articles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="createdBy", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $forumPosts;
|
||||
|
||||
/**
|
||||
* Add forumPosts
|
||||
*
|
||||
* @param ForumPost $forumPosts
|
||||
* @return User
|
||||
*/
|
||||
public function addForumPost(ForumPost $forumPosts)
|
||||
{
|
||||
$this->forumPosts[] = $forumPosts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get forumPosts
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getForumPosts()
|
||||
{
|
||||
return $this->forumPosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection $ledGroups
|
||||
* @ORM\OneToMany(targetEntity="Group", mappedBy="leader", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $ledGroups;
|
||||
|
||||
/**
|
||||
* Add ledGroups
|
||||
*
|
||||
* @param Group $group
|
||||
* @return User
|
||||
*/
|
||||
public function addGroup(Group $group)
|
||||
{
|
||||
$this->ledGroups[] = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ledGroups
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getLedGroups()
|
||||
{
|
||||
return $this->ledGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection $createdDocuments
|
||||
* @ORM\OneToMany(targetEntity="Document", mappedBy="createdBy", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $createdDocuments;
|
||||
|
||||
/**
|
||||
* Add createdDocuments
|
||||
*
|
||||
* @param Document $document
|
||||
* @return User
|
||||
*/
|
||||
public function addDocument(Document $document)
|
||||
{
|
||||
$this->createdDocuments[] = $document;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdDocuments
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getCreatedDocuments()
|
||||
{
|
||||
return $this->createdDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var UserData $userData
|
||||
* @ORM\OneToOne(targetEntity="UserData", mappedBy="user", fetch="EXTRA_LAZY", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="id", referencedColumnName="user_id")
|
||||
*/
|
||||
private $userData;
|
||||
|
||||
/**
|
||||
* Set userData
|
||||
*
|
||||
* @param UserData $userData
|
||||
* @return User
|
||||
*/
|
||||
public function setUserData(UserData $userData = null)
|
||||
{
|
||||
$this->userData = $userData;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userData
|
||||
*
|
||||
* @return UserData
|
||||
*/
|
||||
public function getUserData()
|
||||
{
|
||||
return $this->userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var PollAnswer
|
||||
* @ORM\ManyToMany(targetEntity="PollAnswer", mappedBy="voters", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $pollVotes;
|
||||
|
||||
/**
|
||||
* Set pollVotes
|
||||
*
|
||||
* @param PollAnswer $pollVotes
|
||||
* @return User
|
||||
*/
|
||||
public function setPollVotes(PollAnswer $pollVotes = null)
|
||||
{
|
||||
$this->pollVotes = $pollVotes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pollVotes
|
||||
*
|
||||
* @return PollAnswer
|
||||
*/
|
||||
public function getPollVotes()
|
||||
{
|
||||
return $this->pollVotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add pollVotes
|
||||
*
|
||||
* @param PollAnswer $pollVotes
|
||||
* @return User
|
||||
*/
|
||||
public function addPollAnswer(PollAnswer $pollVotes)
|
||||
{
|
||||
$this->pollVotes[] = $pollVotes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* UserInterface::eraseCredentials()
|
||||
*/
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* UserInterface::getSalt()
|
||||
*
|
||||
* As we use crypt() to encrypt and check password, salt is always the
|
||||
* same as the encrypted password.
|
||||
*/
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* UserInterface::getRoles
|
||||
*/
|
||||
public function getRoles()
|
||||
{
|
||||
return array('ROLE_USER');
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isAccountNonExpired()
|
||||
*/
|
||||
public function isAccountNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isAccountNonLocked()
|
||||
*/
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isCredentialsNonExpired()
|
||||
*/
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isEnabled()
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return ($this->acceptedBy !== null);
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use \KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\UserData
|
||||
@ -13,31 +13,40 @@ use KekRozsak\FrontBundle\Entity\User;
|
||||
*/
|
||||
class UserData
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->emailPublic = false;
|
||||
$this->realNamePublic = false;
|
||||
$this->msnAddressPublic = false;
|
||||
$this->googleTalkPublic = false;
|
||||
$this->skypePublic = false;
|
||||
$this->phoneNumberPublic = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $user
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @ORM\Id
|
||||
* @ORM\OneToOne(targetEntity="User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserData
|
||||
*/
|
||||
public function setUser(User $user = null)
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->userId = $user->getId();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return User
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
@ -74,7 +83,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $realName
|
||||
* @ORM\Column(name="real_name", type="string", length=100, nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
|
||||
*/
|
||||
protected $realName;
|
||||
|
||||
@ -84,7 +93,7 @@ class UserData
|
||||
* @param string $realName
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealName($realName)
|
||||
public function setRealName($realName = null)
|
||||
{
|
||||
$this->realName = $realName;
|
||||
return $this;
|
||||
@ -102,7 +111,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $realNamePublic
|
||||
* @ORM\Column(name="real_name_public", type="boolean", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="real_name_public")
|
||||
*/
|
||||
protected $realNamePublic;
|
||||
|
||||
@ -112,7 +121,7 @@ class UserData
|
||||
* @param boolean $realNamePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealNamePublic($realNamePublic)
|
||||
public function setRealNamePublic($realNamePublic = false)
|
||||
{
|
||||
$this->realNamePublic = $realNamePublic;
|
||||
return $this;
|
||||
@ -129,18 +138,18 @@ class UserData
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $selfDescription
|
||||
* @ORM\Column(name="self_description", type="text", nullable=true)
|
||||
* @var string $selfDescription
|
||||
* @ORM\Column(type="text", nullable=true, name="self_description")
|
||||
*/
|
||||
protected $selfDescription;
|
||||
|
||||
/**
|
||||
* Set selfDescription
|
||||
*
|
||||
* @param text $selfDescription
|
||||
* @param string $selfDescription
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSelfDescription($selfDescription)
|
||||
public function setSelfDescription($selfDescription = null)
|
||||
{
|
||||
$this->selfDescription = $selfDescription;
|
||||
return $this;
|
||||
@ -149,7 +158,7 @@ class UserData
|
||||
/**
|
||||
* Get selfDescription
|
||||
*
|
||||
* @return text
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfDescription()
|
||||
{
|
||||
@ -158,7 +167,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $msnAddress
|
||||
* @ORM\Column(type="string", length=100, name="msn_address", nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
|
||||
*/
|
||||
protected $msnAddress;
|
||||
|
||||
@ -168,7 +177,7 @@ class UserData
|
||||
* @param string $msnAddress
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddress($msnAddress)
|
||||
public function setMsnAddress($msnAddress = null)
|
||||
{
|
||||
$this->msnAddress = $msnAddress;
|
||||
return $this;
|
||||
@ -186,7 +195,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $msnAddressPublic
|
||||
* @ORM\Column(type="boolean", name="msn_address_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="msn_address_public")
|
||||
*/
|
||||
protected $msnAddressPublic;
|
||||
|
||||
@ -214,7 +223,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $googleTalk
|
||||
* @ORM\Column(type="string", length=100, name="google_talk", nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
|
||||
*/
|
||||
protected $googleTalk;
|
||||
|
||||
@ -224,7 +233,7 @@ class UserData
|
||||
* @param string $googleTalk
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalk($googleTalk)
|
||||
public function setGoogleTalk($googleTalk = null)
|
||||
{
|
||||
$this->googleTalk = $googleTalk;
|
||||
return $this;
|
||||
@ -242,7 +251,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $googleTalkPublic
|
||||
* @ORM\Column(type="boolean", name="google_talk_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="google_talk_public")
|
||||
*/
|
||||
protected $googleTalkPublic;
|
||||
|
||||
@ -270,7 +279,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $skype
|
||||
* @ORM\Column(type="string", length=100, nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
|
||||
*/
|
||||
protected $skype;
|
||||
|
||||
@ -280,7 +289,7 @@ class UserData
|
||||
* @param string $skype
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkype($skype)
|
||||
public function setSkype($skype = null)
|
||||
{
|
||||
$this->skype = $skype;
|
||||
return $this;
|
||||
@ -298,7 +307,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $skypePublic
|
||||
* @ORM\Column(type="boolean", name="skype_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="skype_public")
|
||||
*/
|
||||
protected $skypePublic;
|
||||
|
||||
@ -326,7 +335,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $phoneNumber
|
||||
* @ORM\Column(type="string", length=30, name="phone_number", nullable=true)
|
||||
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
|
||||
@ -354,7 +363,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $phoneNumberPublic
|
||||
* @ORM\Column(type="boolean", name="phone_number_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="phone_number_public")
|
||||
*/
|
||||
protected $phoneNumberPublic;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<service id="form.type_extension.help_message" class="KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension">
|
||||
<tag name="form.type_extension" alias="field" />
|
||||
</service>
|
||||
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Extension\TwigBBExtension">
|
||||
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Twig\TwigBBExtension">
|
||||
<argument type="service" id="service_container" />
|
||||
<tag name="twig.extension" />
|
||||
</service>
|
||||
|
@ -1,15 +1,16 @@
|
||||
<?php
|
||||
namespace KekRozsak\FrontBundle\Extension;
|
||||
namespace KekRozsak\FrontBundle\Twig;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class TwigBBExtension extends \Twig_Extension
|
||||
{
|
||||
private $container;
|
||||
private $assets;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->assets = $container->get('templating.helper.assets');
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
@ -44,7 +45,7 @@ class TwigBBExtension extends \Twig_Extension
|
||||
else
|
||||
{
|
||||
// TODO: Thumbnailing!
|
||||
$sentence = substr_replace($sentence, '<img src="' . $this->assets->getUrl('upload/images/' . (($ns == '') ? '' : $ns . '/') . $name) . '" alt="" />', $start, $len);
|
||||
$sentence = substr_replace($sentence, '<img src="' . $this->container->get('templating.helper.assets')->getUrl('upload/images/' . (($ns == '') ? '' : $ns . '/') . $name) . '" alt="" />', $start, $len);
|
||||
}
|
||||
}
|
||||
while (preg_match('/\\[link( (url)="[^"]+"){1,}\\](?P<content>.*?)\\[\\/link\\]/i', $sentence, $m, PREG_OFFSET_CAPTURE))
|
@ -3,18 +3,20 @@
|
||||
namespace KekRozsak\SecurityBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Form\Type\UserType;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/login", name="KekRozsakSecurityBundle_login")
|
||||
* @Template()
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
@ -31,10 +33,10 @@ class DefaultController extends Controller
|
||||
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakSecurityBundle:Default:login.html.twig', array(
|
||||
return array(
|
||||
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
|
||||
'error' => $error,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,31 +57,38 @@ class DefaultController extends Controller
|
||||
|
||||
/**
|
||||
* @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
|
||||
* @Template()
|
||||
*/
|
||||
public function registrationAction(Request $request)
|
||||
public function registrationAction()
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
if ($user instanceof UserInterface)
|
||||
{
|
||||
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$form = $this->createForm(new UserType(true), $user);
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
|
||||
if ($form->isValid(array('registration')))
|
||||
{
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
$roleRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Role');
|
||||
$regRole = $roleRepo->findOneByName('REGISTERED');
|
||||
$user->addRole($regRole);
|
||||
$user->setRegisteredAt(new \DateTime('now'));
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
|
||||
$userData = new UserData();
|
||||
$user->setUserData($userData);
|
||||
$em->persist($user);
|
||||
$em->persist($userData);
|
||||
$em->flush();
|
||||
|
||||
$message = \Swift_Message::newInstance()
|
||||
->setSubject('Új jelentkező')
|
||||
->setFrom('info@blueroses.hu')
|
||||
@ -91,16 +100,18 @@ class DefaultController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakSecurityBundle:Default:registration.html.twig', array(
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/most-varj", name="KekRozsakSecurityBundle_reg_success")
|
||||
* @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success")
|
||||
* @Template()
|
||||
*/
|
||||
public function registrationSuccessAction()
|
||||
public function regSuccessAction()
|
||||
{
|
||||
return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array());
|
||||
return array(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class KekRozsakSecurityExtension extends Extension
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
}
|
||||
}
|
||||
|
318
src/KekRozsak/SecurityBundle/Entity/User.php
Normal file
318
src/KekRozsak/SecurityBundle/Entity/User.php
Normal file
@ -0,0 +1,318 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\SecurityBundle\Entity;
|
||||
|
||||
use \Doctrine\ORM\Mapping as ORM;
|
||||
use \Symfony\Component\Security\Core\User\UserInterface;
|
||||
use \Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||
use \Symfony\Component\Validator\Constraints as Assert;
|
||||
use \Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
|
||||
|
||||
use \KekRozsak\FrontBundle\Entity\UserData;
|
||||
|
||||
/**
|
||||
* KekRozsak\SecurityBundle\Entity\User
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="users")
|
||||
* @DoctrineAssert\UniqueEntity(fields="username", message="Ez a felhasználónév már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
* @DoctrineAssert\UniqueEntity(fields="email", message="Ez az e-mail cím már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
* @DoctrineAssert\UniqueEntity(fields="displayName", message="Ez a név már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
|
||||
*/
|
||||
class User implements UserInterface, AdvancedUserInterface
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $username
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
* @Assert\NotBlank(groups="registration")
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $password
|
||||
* @ORM\Column(type="string", length=50, nullable=false)
|
||||
* @Assert\NotBlank(groups="registration")
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $displayName
|
||||
* @ORM\Column(type="string", length=50, unique=true, name="display_name")
|
||||
*/
|
||||
private $displayName;
|
||||
|
||||
/**
|
||||
* Set displayName
|
||||
*
|
||||
* @param string $displayName
|
||||
* @return User
|
||||
*/
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
$this->displayName = $displayName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $email
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* Set email
|
||||
*
|
||||
* @param string $email
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $registeredAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="registered_at")
|
||||
*/
|
||||
private $registeredAt;
|
||||
|
||||
/**
|
||||
* Set registeredAt
|
||||
*
|
||||
* @param DateTime $registeredAt
|
||||
* @return User
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get registeredAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getRegisteredAt()
|
||||
{
|
||||
return $this->registeredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User acceptedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="accepted_by_id")
|
||||
*/
|
||||
private $acceptedBy;
|
||||
|
||||
/**
|
||||
* Set acceptedBy
|
||||
*
|
||||
* @param User $acceptedBy
|
||||
* @return User
|
||||
*/
|
||||
public function setAcceptedBy(User $acceptedBy = null)
|
||||
{
|
||||
$this->acceptedBy = $acceptedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get acceptedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getAcceptedBy()
|
||||
{
|
||||
return $this->acceptedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $lastLoginAt
|
||||
* @ORM\Column(type="datetime", nullable=true, name="last_login_at")
|
||||
*/
|
||||
private $lastLoginAt;
|
||||
|
||||
/**
|
||||
* Set lastLoginAt;
|
||||
*
|
||||
* @param DateTime $lastLoginAt
|
||||
* @return User
|
||||
*/
|
||||
public function setLastLoginAt(\DateTime $lastLoginAt = null)
|
||||
{
|
||||
$this->lastLoginAt = $lastLoginAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastLoginAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getLastLoginAt()
|
||||
{
|
||||
return $this->lastLoginAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", mappedBy="user", fetch="LAZY", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="id", referencedColumnName="user_id")
|
||||
*/
|
||||
private $userData;
|
||||
|
||||
|
||||
/**
|
||||
* Set userData
|
||||
*
|
||||
* @param \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @return User
|
||||
*/
|
||||
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
|
||||
{
|
||||
$this->userData = $userData;
|
||||
$userData->setUser($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userData
|
||||
*
|
||||
* @return \KekRozsak\FrontBundle\Entity\UserData
|
||||
*/
|
||||
public function getUserData()
|
||||
{
|
||||
return $this->userData;
|
||||
}
|
||||
|
||||
/* Here comes the remaining part of UserInterface implementation */
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
/* As we use ACLs instead of roles, every user get the
|
||||
* ROLE_USER role, and nothing else
|
||||
*/
|
||||
return array('ROLE_USER');
|
||||
}
|
||||
|
||||
public function getSalt()
|
||||
{
|
||||
/* As we use crypt() to encode passwords, salt is always the
|
||||
* same as password
|
||||
*/
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
/* Here comes the AdvancedUserInterface implementation */
|
||||
|
||||
public function isAccountNonExpired()
|
||||
{
|
||||
/* Currently, accounts never expire */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
/* Currently, accounts cannot be locked */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
/* Currently, credentials never expire */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
/* Account is enabled if it is accepted by someone */
|
||||
return ($this->acceptedBy !== null);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace KekRozsak\FrontBundle\Form\Type;
|
||||
namespace KekRozsak\SecurityBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@ -64,7 +64,7 @@ class UserType extends AbstractType
|
||||
public function getDefaultOptions()
|
||||
{
|
||||
$opts = array(
|
||||
'data_class' => 'KekRozsak\FrontBundle\Entity\User',
|
||||
'data_class' => 'KekRozsak\SecurityBundle\Entity\User',
|
||||
);
|
||||
if ($this->_registration)
|
||||
$opts['validation_groups'] = array('registration');
|
11
src/KekRozsak/SecurityBundle/Resources/config/services.xml
Normal file
11
src/KekRozsak/SecurityBundle/Resources/config/services.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<services>
|
||||
<service id="kek_rozsak_security.encoder.crypt" class="KekRozsak\SecurityBundle\Service\CryptEncoder">
|
||||
</service>
|
||||
<service id="security.authentication.success_handler" class="KekRozsak\SecurityBundle\Security\AuthSuccess">
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
@ -1,10 +0,0 @@
|
||||
parameters:
|
||||
|
||||
services:
|
||||
kek_rozsak_security.encoder.crypt:
|
||||
class: KekRozsak\SecurityBundle\Service\CryptEncoder
|
||||
security.authentication.success_handler:
|
||||
class: KekRozsak\SecurityBundle\Security\AuthSuccess
|
||||
public: false
|
||||
arguments:
|
||||
doctrine: @doctrine
|
@ -5,6 +5,7 @@
|
||||
{% block title %} - Regisztráció {% endblock %}
|
||||
{% block content %}
|
||||
<h3>Jelentkezés</h3>
|
||||
<p>Amennyiben már tagja vagy a körnek, <a href="{{ path('KekRozsakSecurityBundle_login') }}">itt bejelentkezhetsz</a>.
|
||||
<p>Az alábbi űrlap kitöltésével jelentkezhetsz a Kék Rózsa okkultista kör tagjai közé. Kérünk, hogy jelentkezés előtt figyelmesen olvasd el a <a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'rolunk' }) }}">Rólunk</a> menüpont szövegét, különös tekintettel a Házirendre.</p>
|
||||
<p>A jelentkezés NEM jár automatikus tagsággal. A Házirend szerint a Vének jogot formálhatnak arra, hogy a jelentkezésedet elutasítsák, vagy próbáknak vessenek alá, mielőtt a tagok közé fogadnak.</p>
|
||||
<p><strong>FONTOS!</strong> Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem <a href="http://www.facebook.com/Polesz" target="_blank">Facebookon</a> vagy e-mailben a <a href="jelentkezes@blueroses.hu">jelentkezes@blueroses.hu</a> címen!</p>
|
||||
|
4
vendor/autoload.php
vendored
4
vendor/autoload.php
vendored
@ -5,8 +5,6 @@ if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
|
||||
require __DIR__ . '/composer' . '/ClassLoader.php';
|
||||
}
|
||||
|
||||
require __DIR__ . '/swiftmailer/swiftmailer/lib/swift_required.php';
|
||||
|
||||
return call_user_func(function() {
|
||||
$loader = new \Composer\Autoload\ClassLoader();
|
||||
$composerDir = __DIR__ . '/composer';
|
||||
@ -23,5 +21,7 @@ return call_user_func(function() {
|
||||
|
||||
$loader->register();
|
||||
|
||||
require __DIR__ . '/swiftmailer/swiftmailer/lib/swift_required.php';
|
||||
|
||||
return $loader;
|
||||
});
|
||||
|
8
vendor/composer/ClassLoader.php
vendored
8
vendor/composer/ClassLoader.php
vendored
@ -102,7 +102,7 @@ class ClassLoader
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param Boolean $useIncludePath
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
@ -113,7 +113,7 @@ class ClassLoader
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return Boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
@ -123,7 +123,7 @@ class ClassLoader
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
@ -142,7 +142,7 @@ class ClassLoader
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return Boolean|null True, if loaded
|
||||
* @return bool|null True, if loaded
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
|
686
vendor/composer/installed.json
vendored
686
vendor/composer/installed.json
vendored
@ -3,7 +3,7 @@
|
||||
"name": "jms/metadata",
|
||||
"version": "1.1.1",
|
||||
"version_normalized": "1.1.1.0",
|
||||
"time": "2011-12-31 21:32:49",
|
||||
"time": "2011-12-30 10:32:49",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/metadata",
|
||||
@ -47,7 +47,7 @@
|
||||
"name": "jms/cg",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"time": "2011-12-31 20:40:52",
|
||||
"time": "2011-12-30 09:40:52",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/schmittjoh/cg-library.git",
|
||||
@ -89,7 +89,7 @@
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"target-dir": "JMS/AopBundle",
|
||||
"time": "2011-12-31 20:50:26",
|
||||
"time": "2011-12-30 09:50:26",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/JMSAopBundle",
|
||||
@ -133,7 +133,7 @@
|
||||
"version": "1.1.0",
|
||||
"version_normalized": "1.1.0.0",
|
||||
"target-dir": "JMS/SecurityExtraBundle",
|
||||
"time": "2012-01-01 00:38:12",
|
||||
"time": "2011-12-30 13:38:12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/JMSSecurityExtraBundle",
|
||||
@ -178,7 +178,7 @@
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"target-dir": "JMS/DiExtraBundle",
|
||||
"time": "2012-02-26 16:01:54",
|
||||
"time": "2012-02-25 05:01:54",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/JMSDiExtraBundle",
|
||||
@ -221,7 +221,7 @@
|
||||
"name": "doctrine/common",
|
||||
"version": "2.2.2",
|
||||
"version_normalized": "2.2.2.0",
|
||||
"time": "2012-04-11 01:46:44",
|
||||
"time": "2012-04-08 03:46:44",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/common",
|
||||
@ -287,7 +287,7 @@
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.1.0",
|
||||
"version_normalized": "1.1.0.0",
|
||||
"time": "2012-04-21 12:27:40",
|
||||
"time": "2012-04-18 14:27:40",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
@ -337,7 +337,7 @@
|
||||
"name": "twig/extensions",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-05-19 19:28:19",
|
||||
"time": "2012-05-16 21:28:19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fabpot/Twig-extensions",
|
||||
@ -378,70 +378,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/monolog-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Symfony/Bundle/MonologBundle",
|
||||
"time": "2012-06-13 05:14:37",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/MonologBundle",
|
||||
"reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/MonologBundle/zipball/0b5046d3d1ef93cd59ceabfa37de2665f5118c7f",
|
||||
"reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"monolog/monolog": "1.*",
|
||||
"symfony/monolog-bridge": "2.1.*",
|
||||
"symfony/dependency-injection": "2.1.*",
|
||||
"symfony/config": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"email": null,
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Symfony MonologBundle",
|
||||
"homepage": "http://symfony.com",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Bundle\\MonologBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "kriswallsmith/assetic",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-06-10 23:41:54",
|
||||
"time": "2012-06-08 01:41:54",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/kriswallsmith/assetic.git",
|
||||
@ -497,132 +438,221 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "doctrine/orm",
|
||||
"version": "2.2.x-dev",
|
||||
"version_normalized": "2.2.9999999.9999999-dev",
|
||||
"time": "2012-05-26 01:13:46",
|
||||
"name": "sensio/generator-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Sensio/Bundle/GeneratorBundle",
|
||||
"time": "2012-06-15 18:40:45",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/doctrine/doctrine2.git",
|
||||
"reference": "5f66c65c9a8d984899903b54215d0249a45b92d6"
|
||||
"url": "https://github.com/sensio/SensioGeneratorBundle",
|
||||
"reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/doctrine/doctrine2/zipball/5f66c65c9a8d984899903b54215d0249a45b92d6",
|
||||
"reference": "5f66c65c9a8d984899903b54215d0249a45b92d6",
|
||||
"url": "https://github.com/sensio/SensioGeneratorBundle/zipball/43ed45c48db18e4a0e48aec0c098f42e56e22d36",
|
||||
"reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"symfony/framework-bundle": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/doctrine-bridge": "2.1.*",
|
||||
"doctrine/orm": ">=2.1,<2.4-dev",
|
||||
"twig/twig": ">=1.8,<2.0-dev"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/doctrine-bundle": "to generate entities and their crud controller"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "This bundle generates code for you",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Sensio\\Bundle\\GeneratorBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/assetic-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Symfony/Bundle/AsseticBundle",
|
||||
"time": "2012-06-16 23:29:31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/AsseticBundle",
|
||||
"reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/AsseticBundle/zipball/8fe7b898b08103c1d6fce64c3e279a7afd61adfc",
|
||||
"reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"symfony/framework-bundle": "2.1.*",
|
||||
"kriswallsmith/assetic": "1.1.*"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/twig-bundle": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kris Wallsmith",
|
||||
"email": "kris.wallsmith@gmail.com",
|
||||
"homepage": "http://kriswallsmith.net/",
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Integrates Assetic into Symfony2",
|
||||
"homepage": "https://github.com/symfony/AsseticBundle",
|
||||
"keywords": [
|
||||
"assets",
|
||||
"compression",
|
||||
"minification"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Bundle\\AsseticBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/monolog-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Symfony/Bundle/MonologBundle",
|
||||
"time": "2012-06-28 15:48:07",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/MonologBundle",
|
||||
"reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/MonologBundle/zipball/7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5",
|
||||
"reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"ext-pdo": "*",
|
||||
"doctrine/common": "2.2.*",
|
||||
"doctrine/dbal": "2.2.*"
|
||||
"monolog/monolog": "1.*",
|
||||
"symfony/monolog-bridge": "2.1.*",
|
||||
"symfony/dependency-injection": "2.1.*",
|
||||
"symfony/config": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "2.1.*",
|
||||
"symfony/config": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"LGPL"
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com",
|
||||
"homepage": "http://www.jwage.com/",
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com",
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de",
|
||||
"homepage": null,
|
||||
"name": "Symfony Community",
|
||||
"email": null,
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Object-Relational-Mapper for PHP",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"database",
|
||||
"orm"
|
||||
],
|
||||
"description": "Symfony MonologBundle",
|
||||
"homepage": "http://symfony.com",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\ORM": "lib/"
|
||||
"Symfony\\Bundle\\MonologBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "doctrine/dbal",
|
||||
"version": "2.2.x-dev",
|
||||
"version_normalized": "2.2.9999999.9999999-dev",
|
||||
"time": "2012-05-25 20:08:36",
|
||||
"name": "sensio/framework-extra-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Sensio/Bundle/FrameworkExtraBundle",
|
||||
"time": "2012-06-29 05:03:39",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/dbal",
|
||||
"reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b"
|
||||
"url": "https://github.com/sensio/SensioFrameworkExtraBundle",
|
||||
"reference": "4f54e5d5fb3b54fb107892684018f3704934c48d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/doctrine/dbal/zipball/8cc129aa64a8de6447056bce20f0a274fe2a340b",
|
||||
"reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b",
|
||||
"url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/4f54e5d5fb3b54fb107892684018f3704934c48d",
|
||||
"reference": "4f54e5d5fb3b54fb107892684018f3704934c48d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"doctrine/common": ">=2.2.0,<=2.2.99"
|
||||
"doctrine/common": ">=2.1,<2.4-dev",
|
||||
"symfony/framework-bundle": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"LGPL"
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com",
|
||||
"homepage": "http://www.jwage.com/",
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de",
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Database Abstraction Layer",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"description": "This bundle provides a way to configure your controllers with annotations",
|
||||
"keywords": [
|
||||
"database",
|
||||
"persistence",
|
||||
"dbal",
|
||||
"queryobject"
|
||||
"annotations",
|
||||
"controllers"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\DBAL": "lib/"
|
||||
"Sensio\\Bundle\\FrameworkExtraBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -630,16 +660,16 @@
|
||||
"name": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-06-16 08:52:23",
|
||||
"time": "2012-07-03 15:33:25",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/fabpot/Twig.git",
|
||||
"reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba"
|
||||
"reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/fabpot/Twig/zipball/4679ad51c5390648b7ea4c8f0ecd2c0c344145ba",
|
||||
"reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba",
|
||||
"url": "https://github.com/fabpot/Twig/zipball/26eb0a2653eade50dffdd31b11ca454232dea8cf",
|
||||
"reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -648,7 +678,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.8-dev"
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
@ -685,16 +715,16 @@
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Doctrine/Bundle/DoctrineBundle",
|
||||
"time": "2012-06-18 06:36:07",
|
||||
"time": "2012-07-03 10:42:17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/doctrine/DoctrineBundle.git",
|
||||
"reference": "94951737d6c692500d6b13bb92871935568a4ba5"
|
||||
"reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/doctrine/DoctrineBundle/zipball/94951737d6c692500d6b13bb92871935568a4ba5",
|
||||
"reference": "94951737d6c692500d6b13bb92871935568a4ba5",
|
||||
"url": "https://github.com/doctrine/DoctrineBundle/zipball/c9ea46d1f0c48bb88bb87b44214fe44e03c0c692",
|
||||
"reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -755,191 +785,37 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sensio/generator-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Sensio/Bundle/GeneratorBundle",
|
||||
"time": "2012-06-18 16:40:45",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sensio/SensioGeneratorBundle",
|
||||
"reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/sensio/SensioGeneratorBundle/zipball/43ed45c48db18e4a0e48aec0c098f42e56e22d36",
|
||||
"reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"symfony/framework-bundle": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/doctrine-bridge": "2.1.*",
|
||||
"doctrine/orm": ">=2.1,<2.4-dev",
|
||||
"twig/twig": ">=1.8,<2.0-dev"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/doctrine-bundle": "to generate entities and their crud controller"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "This bundle generates code for you",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Sensio\\Bundle\\GeneratorBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sensio/framework-extra-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Sensio/Bundle/FrameworkExtraBundle",
|
||||
"time": "2012-06-18 10:41:18",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sensio/SensioFrameworkExtraBundle",
|
||||
"reference": "62e41b85947034b0f1dfe31bb8e76920e1488571"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/62e41b85947034b0f1dfe31bb8e76920e1488571",
|
||||
"reference": "62e41b85947034b0f1dfe31bb8e76920e1488571",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/common": ">=2.1,<2.4-dev",
|
||||
"symfony/framework-bundle": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "This bundle provides a way to configure your controllers with annotations",
|
||||
"keywords": [
|
||||
"annotations",
|
||||
"controllers"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Sensio\\Bundle\\FrameworkExtraBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/assetic-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Symfony/Bundle/AsseticBundle",
|
||||
"time": "2012-06-19 21:29:31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/AsseticBundle",
|
||||
"reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/AsseticBundle/zipball/8fe7b898b08103c1d6fce64c3e279a7afd61adfc",
|
||||
"reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"symfony/framework-bundle": "2.1.*",
|
||||
"kriswallsmith/assetic": "1.1.*"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/twig-bundle": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kris Wallsmith",
|
||||
"email": "kris.wallsmith@gmail.com",
|
||||
"homepage": "http://kriswallsmith.net/",
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Integrates Assetic into Symfony2",
|
||||
"homepage": "https://github.com/symfony/AsseticBundle",
|
||||
"keywords": [
|
||||
"assets",
|
||||
"compression",
|
||||
"minification"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Bundle\\AsseticBundle": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/swiftmailer-bundle",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Symfony/Bundle/SwiftmailerBundle",
|
||||
"time": "2012-06-18 20:25:44",
|
||||
"time": "2012-07-04 15:33:34",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/SwiftmailerBundle",
|
||||
"reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3"
|
||||
"reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/SwiftmailerBundle/zipball/d05c9c514a631ee688c53c4cc5505da757bd50d3",
|
||||
"reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3",
|
||||
"url": "https://github.com/symfony/SwiftmailerBundle/zipball/e1d413ce27fd1696bdc82ad9525f1b874664530e",
|
||||
"reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"symfony/swiftmailer-bridge": "self.version",
|
||||
"swiftmailer/swiftmailer": ">=4.1.8,<4.2-dev"
|
||||
"symfony/swiftmailer-bridge": "2.1.*",
|
||||
"swiftmailer/swiftmailer": ">=4.2.0,<4.3-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/dependency-injection": "2.1.*",
|
||||
"symfony/http-kernel": "2.1.*",
|
||||
"symfony/config": "2.1.*"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
"dev-master": "2.1-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
@ -969,19 +845,84 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-06-20 14:46:20",
|
||||
"name": "doctrine/orm",
|
||||
"version": "2.2.x-dev",
|
||||
"version_normalized": "2.2.9999999.9999999-dev",
|
||||
"time": "2012-07-07 07:48:00",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/swiftmailer/swiftmailer.git",
|
||||
"reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99"
|
||||
"url": "git://github.com/doctrine/doctrine2.git",
|
||||
"reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/swiftmailer/swiftmailer/zipball/d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99",
|
||||
"reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99",
|
||||
"url": "https://github.com/doctrine/doctrine2/zipball/5d2a3bcb3b467f41ee58575764f3ba84937f76e4",
|
||||
"reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"ext-pdo": "*",
|
||||
"doctrine/common": "2.2.*",
|
||||
"doctrine/dbal": "2.2.*"
|
||||
},
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"LGPL"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com",
|
||||
"homepage": "http://www.jwage.com/",
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Object-Relational-Mapper for PHP",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"database",
|
||||
"orm"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\ORM": "lib/"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-07-08 09:21:00",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/swiftmailer/swiftmailer.git",
|
||||
"reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/swiftmailer/swiftmailer/zipball/f51b5f33c83b48faea75f1285f99a2e8f1c66f75",
|
||||
"reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -990,7 +931,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.1-dev"
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
@ -1024,19 +965,84 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/symfony",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-06-21 09:42:20",
|
||||
"name": "doctrine/dbal",
|
||||
"version": "2.2.x-dev",
|
||||
"version_normalized": "2.2.9999999.9999999-dev",
|
||||
"time": "2012-07-08 18:30:35",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/symfony/symfony.git",
|
||||
"reference": "v2.1.0-BETA1"
|
||||
"url": "https://github.com/doctrine/dbal",
|
||||
"reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/symfony/zipball/v2.1.0-BETA1",
|
||||
"reference": "v2.1.0-BETA1",
|
||||
"url": "https://github.com/doctrine/dbal/zipball/b961a3fce6bf220f1dca47d7d747b9074bea4730",
|
||||
"reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"doctrine/common": ">=2.2.0,<=2.2.99"
|
||||
},
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"license": [
|
||||
"LGPL"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com",
|
||||
"homepage": "http://www.jwage.com/",
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de",
|
||||
"homepage": null,
|
||||
"role": null
|
||||
}
|
||||
],
|
||||
"description": "Database Abstraction Layer",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"database",
|
||||
"persistence",
|
||||
"dbal",
|
||||
"queryobject"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\DBAL": "lib/"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "symfony/symfony",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"time": "2012-07-09 05:52:38",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/symfony/symfony.git",
|
||||
"reference": "v2.1.0-BETA2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/symfony/symfony/zipball/v2.1.0-BETA2",
|
||||
"reference": "v2.1.0-BETA2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1129,16 +1135,16 @@
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"target-dir": "Sensio/Bundle/DistributionBundle",
|
||||
"time": "2012-06-21 15:12:48",
|
||||
"time": "2012-07-08 08:02:21",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sensio/SensioDistributionBundle",
|
||||
"reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071"
|
||||
"reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/sensio/SensioDistributionBundle/zipball/a360ad61fe34206a7295c1ef00b5455b2b2e1071",
|
||||
"reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071",
|
||||
"url": "https://github.com/sensio/SensioDistributionBundle/zipball/9a7dbd867fd5061e4bfd660a175aa66122f53d25",
|
||||
"reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -280,7 +280,7 @@ class SQLServerPlatform extends AbstractPlatform
|
||||
$columnSql = array();
|
||||
|
||||
if ($diff->newName !== false) {
|
||||
$queryParts[] = 'RENAME TO ' . $diff->newName;
|
||||
$queryParts[] = "sp_RENAME '" . $diff->name . "', '" . $diff->newName . "'";
|
||||
}
|
||||
|
||||
foreach ($diff->addedColumns AS $fieldName => $column) {
|
||||
|
@ -61,10 +61,10 @@ class SQLParserUtils
|
||||
} else {
|
||||
$name = "";
|
||||
// TODO: Something faster/better to match this than regex?
|
||||
for ($j = $i; ($j < $stmtLen && preg_match('(([:a-zA-Z0-9_]{1}))', $statement[$j])); $j++) {
|
||||
for ($j = $i + 1; ($j < $stmtLen && preg_match('(([a-zA-Z0-9_]{1}))', $statement[$j])); $j++) {
|
||||
$name .= $statement[$j];
|
||||
}
|
||||
$paramMap[$name][] = $i; // named parameters can be duplicated!
|
||||
$paramMap[$i] = $name; // named parameters can be duplicated!
|
||||
$i = $j;
|
||||
}
|
||||
++$count;
|
||||
@ -139,28 +139,23 @@ class SQLParserUtils
|
||||
$queryOffset= 0;
|
||||
$typesOrd = array();
|
||||
$paramsOrd = array();
|
||||
foreach ($paramPos as $needle => $needlePos) {
|
||||
$paramLen = strlen($needle);
|
||||
$token = substr($needle,0,1);
|
||||
$needle = substr($needle,1);
|
||||
$value = $params[$needle];
|
||||
foreach ($paramPos as $pos => $paramName) {
|
||||
$paramLen = strlen($paramName) + 1;
|
||||
$value = $params[$paramName];
|
||||
|
||||
if (!isset($arrayPositions[$needle])) {
|
||||
foreach ($needlePos as $pos) {
|
||||
if (!isset($arrayPositions[$paramName])) {
|
||||
$pos += $queryOffset;
|
||||
$queryOffset -= ($paramLen - 1);
|
||||
$paramsOrd[] = $value;
|
||||
$typesOrd[] = $types[$needle];
|
||||
$typesOrd[] = $types[$paramName];
|
||||
$query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen));
|
||||
}
|
||||
} else {
|
||||
$len = count($value);
|
||||
$expandStr = implode(", ", array_fill(0, $len, "?"));
|
||||
foreach ($needlePos as $pos) {
|
||||
|
||||
foreach ($value as $val) {
|
||||
$paramsOrd[] = $val;
|
||||
$typesOrd[] = $types[$needle] - Connection::ARRAY_PARAM_OFFSET;
|
||||
$typesOrd[] = $types[$paramName] - Connection::ARRAY_PARAM_OFFSET;
|
||||
}
|
||||
|
||||
$pos += $queryOffset;
|
||||
@ -168,7 +163,6 @@ class SQLParserUtils
|
||||
$query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$types = $typesOrd;
|
||||
$params = $paramsOrd;
|
||||
|
@ -77,6 +77,14 @@ class Index extends AbstractAsset implements Constraint
|
||||
return $this->_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUnquotedColumns()
|
||||
{
|
||||
return array_map(array($this, 'trimQuotes'), $this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the index neither unique nor primary key?
|
||||
*
|
||||
@ -108,11 +116,11 @@ class Index extends AbstractAsset implements Constraint
|
||||
* @param int $pos
|
||||
* @return bool
|
||||
*/
|
||||
public function hasColumnAtPosition($columnName, $pos=0)
|
||||
public function hasColumnAtPosition($columnName, $pos = 0)
|
||||
{
|
||||
$columnName = strtolower($columnName);
|
||||
$indexColumns = \array_map('strtolower', $this->getColumns());
|
||||
return \array_search($columnName, $indexColumns) === $pos;
|
||||
$columnName = $this->trimQuotes(strtolower($columnName));
|
||||
$indexColumns = array_map('strtolower', $this->getUnquotedColumns());
|
||||
return array_search($columnName, $indexColumns) === $pos;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,7 +133,7 @@ class Index extends AbstractAsset implements Constraint
|
||||
{
|
||||
$sameColumns = true;
|
||||
for ($i = 0; $i < count($this->_columns); $i++) {
|
||||
if (!isset($columnNames[$i]) || strtolower($this->_columns[$i]) != strtolower($columnNames[$i])) {
|
||||
if (!isset($columnNames[$i]) || $this->trimQuotes(strtolower($this->_columns[$i])) != $this->trimQuotes(strtolower($columnNames[$i]))) {
|
||||
$sameColumns = false;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ use Doctrine\DBAL\DriverManager;
|
||||
*/
|
||||
class CreateDatabaseDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@ -47,6 +50,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$connection = $this->getDoctrineConnection($input->getOption('connection'));
|
||||
|
@ -24,6 +24,11 @@ use Doctrine\ORM\Tools\EntityGenerator;
|
||||
*/
|
||||
abstract class DoctrineCommand extends ContainerAwareCommand
|
||||
{
|
||||
/**
|
||||
* get a doctrine entity generator
|
||||
*
|
||||
* @return EntityGenerator
|
||||
*/
|
||||
protected function getEntityGenerator()
|
||||
{
|
||||
$entityGenerator = new EntityGenerator();
|
||||
@ -37,6 +42,12 @@ abstract class DoctrineCommand extends ContainerAwareCommand
|
||||
return $entityGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a doctrine entity manager by symfony name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Doctrine\ORM\EntityManager
|
||||
*/
|
||||
protected function getEntityManager($name)
|
||||
{
|
||||
return $this->getContainer()->get('doctrine')->getManager($name);
|
||||
@ -46,7 +57,7 @@ abstract class DoctrineCommand extends ContainerAwareCommand
|
||||
* Get a doctrine dbal connection by symfony name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return Doctrine\DBAL\Connection
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected function getDoctrineConnection($name)
|
||||
{
|
||||
|
@ -26,6 +26,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
*/
|
||||
class DropDatabaseDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@ -52,6 +55,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$connection = $this->getDoctrineConnection($input->getOption('connection'));
|
||||
|
@ -29,6 +29,9 @@ use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory;
|
||||
*/
|
||||
class GenerateEntitiesDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@ -79,6 +82,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine'));
|
||||
|
@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Console\MetadataFilter;
|
||||
*/
|
||||
class ImportMappingDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@ -65,6 +68,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
|
@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
|
||||
*/
|
||||
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -49,6 +52,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
|
||||
*/
|
||||
class ClearQueryCacheDoctrineCommand extends QueryCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -49,6 +52,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
|
||||
*/
|
||||
class ClearResultCacheDoctrineCommand extends ResultCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -45,25 +48,13 @@ You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager to clear the cache for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --em=default</info>
|
||||
|
||||
If you don't want to clear all result cache you can specify some additional
|
||||
options to control what cache is deleted:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --id=cache_key</info>
|
||||
|
||||
Or you can specify a <comment>--regex</comment> to delete cache entries that
|
||||
match it:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --regex="user_(.*)"</info>
|
||||
|
||||
You can also specify a <comment>--prefix</comment> or
|
||||
<comment>--suffix</comment> to delete cache entries for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --prefix="user_" --suffix="_frontend"</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Export\Driver\YamlExporter;
|
||||
*/
|
||||
class ConvertMappingDoctrineCommand extends ConvertMappingCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -46,6 +49,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
@ -53,9 +59,15 @@ EOT
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $toType
|
||||
* @param string $destPath
|
||||
*
|
||||
* @return \Doctrine\ORM\Tools\Export\Driver\AbstractExporter
|
||||
*/
|
||||
protected function getExporter($toType, $destPath)
|
||||
{
|
||||
/** @var $exporter \Doctrine\ORM\Tools\Export\Driver\AbstractExporter */
|
||||
$exporter = parent::getExporter($toType, $destPath);
|
||||
if ($exporter instanceof XmlExporter) {
|
||||
$exporter->setExtension('.orm.xml');
|
||||
|
@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
|
||||
*/
|
||||
class CreateSchemaDoctrineCommand extends CreateCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -54,6 +57,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
|
||||
@ -33,12 +33,19 @@ abstract class DoctrineCommandHelper
|
||||
*/
|
||||
static public function setApplicationEntityManager(Application $application, $emName)
|
||||
{
|
||||
/** @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName);
|
||||
$helperSet = $application->getHelperSet();
|
||||
$helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
|
||||
$helperSet->set(new EntityManagerHelper($em), 'em');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to push the helper sets of a given connection into the application.
|
||||
*
|
||||
* @param Application $application
|
||||
* @param string $connName
|
||||
*/
|
||||
static public function setApplicationConnection(Application $application, $connName)
|
||||
{
|
||||
$connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);
|
||||
|
@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand;
|
||||
*/
|
||||
class DropSchemaDoctrineCommand extends DropCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -54,6 +57,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
|
||||
*/
|
||||
class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -49,6 +52,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -27,6 +27,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
*/
|
||||
class InfoDoctrineCommand extends InfoCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@ -48,6 +51,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
|
||||
*/
|
||||
class RunDqlDoctrineCommand extends RunDqlCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -54,6 +57,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -28,6 +28,9 @@ use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
|
||||
*/
|
||||
class RunSqlDoctrineCommand extends RunSqlCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -44,6 +47,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
|
||||
|
@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand;
|
||||
*/
|
||||
class UpdateSchemaDoctrineCommand extends UpdateCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -58,6 +61,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidate
|
||||
*/
|
||||
class ValidateSchemaCommand extends DoctrineValidateSchemaCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
@ -50,6 +53,9 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
@ -69,6 +69,9 @@ class ConnectionFactory
|
||||
return $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize the types
|
||||
*/
|
||||
private function initializeTypes()
|
||||
{
|
||||
foreach ($this->typesConfig as $type => $typeConfig) {
|
||||
|
@ -35,6 +35,7 @@ class ProfilerController extends ContainerAware
|
||||
*/
|
||||
public function explainAction($token, $connectionName, $query)
|
||||
{
|
||||
/** @var $profiler \Symfony\Component\HttpKernel\Profiler\Profiler */
|
||||
$profiler = $this->container->get('profiler');
|
||||
$profiler->disable();
|
||||
|
||||
|
@ -41,9 +41,7 @@ class Configuration implements ConfigurationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree builder.
|
||||
*
|
||||
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
@ -56,6 +54,11 @@ class Configuration implements ConfigurationInterface
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add DBAL section to configuration tree
|
||||
*
|
||||
* @param ArrayNodeDefinition $node
|
||||
*/
|
||||
private function addDbalSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
@ -105,6 +108,11 @@ class Configuration implements ConfigurationInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dbal connections node
|
||||
*
|
||||
* @return ArrayNodeDefinition
|
||||
*/
|
||||
private function getDbalConnectionsNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
@ -157,7 +165,7 @@ class Configuration implements ConfigurationInterface
|
||||
*
|
||||
* These keys are available for slave configurations too.
|
||||
*
|
||||
* @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $node
|
||||
* @param ArrayNodeDefinition $node
|
||||
*/
|
||||
private function configureDbalDriverNode(ArrayNodeDefinition $node)
|
||||
{
|
||||
@ -202,6 +210,11 @@ class Configuration implements ConfigurationInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the ORM section to configuration tree
|
||||
*
|
||||
* @param ArrayNodeDefinition $node
|
||||
*/
|
||||
private function addOrmSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
@ -246,6 +259,11 @@ class Configuration implements ConfigurationInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return ORM target entity resolver node
|
||||
*
|
||||
* @return \Symfony\Component\Config\Definition\Builder\NodeDefinition
|
||||
*/
|
||||
private function getOrmTargetEntityResolverNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
@ -261,6 +279,11 @@ class Configuration implements ConfigurationInterface
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return ORM entity manager node
|
||||
*
|
||||
* @return ArrayNodeDefinition
|
||||
*/
|
||||
private function getOrmEntityManagersNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
@ -362,6 +385,13 @@ class Configuration implements ConfigurationInterface
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a ORM cache driver node for an given entity manager
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return ArrayNodeDefinition
|
||||
*/
|
||||
private function getOrmCacheDriverNode($name)
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
|
@ -32,6 +32,9 @@ use Symfony\Component\Config\FileLocator;
|
||||
*/
|
||||
class DoctrineExtension extends AbstractDoctrineExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
@ -377,6 +380,9 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
$ormConfigDef->addMethodCall('setEntityNamespaces', array($this->aliasMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getObjectManagerElementName($name)
|
||||
{
|
||||
return 'doctrine.orm.'.$name;
|
||||
@ -387,11 +393,17 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
return 'Entity';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getMappingResourceConfigDirectory()
|
||||
{
|
||||
return 'Resources/config/doctrine';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getMappingResourceExtension()
|
||||
{
|
||||
return 'orm';
|
||||
@ -411,9 +423,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base path for the XSD files.
|
||||
*
|
||||
* @return string The XSD base path
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getXsdValidationBasePath()
|
||||
{
|
||||
@ -421,15 +431,16 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace to be used for this extension (XML namespace).
|
||||
*
|
||||
* @return string The XML namespace
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return 'http://symfony.com/schema/dic/doctrine';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||
{
|
||||
return new Configuration($container->getParameter('kernel.debug'));
|
||||
|
@ -36,6 +36,9 @@ class DoctrineBundle extends Bundle
|
||||
{
|
||||
private $autoloader;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
@ -48,6 +51,9 @@ class DoctrineBundle extends Bundle
|
||||
$container->addCompilerPass(new DoctrineValidationPass('orm'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Register an autoloader for proxies to avoid issues when unserializing them
|
||||
@ -66,9 +72,11 @@ class DoctrineBundle extends Bundle
|
||||
|
||||
if (!is_file($file) && $container->getParameter('kernel.debug')) {
|
||||
$originalClassName = ClassUtils::getRealClass($class);
|
||||
/** @var $registry Registry */
|
||||
$registry = $container->get('doctrine');
|
||||
|
||||
// Tries to auto-generate the proxy file
|
||||
/** @var $em \Doctrine\ORM\EntityManager */
|
||||
foreach ($registry->getManagers() as $em) {
|
||||
|
||||
if ($em->getConfiguration()->getAutoGenerateProxyClasses()) {
|
||||
@ -94,6 +102,9 @@ class DoctrineBundle extends Bundle
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
if (null !== $this->autoloader) {
|
||||
@ -102,6 +113,9 @@ class DoctrineBundle extends Bundle
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function registerCommands(Application $application)
|
||||
{
|
||||
// Use the default logic when the ORM is available.
|
||||
|
@ -45,6 +45,13 @@ class ManagerConfigurator
|
||||
$this->enableFilters($entityManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable filters for an given entity manager
|
||||
*
|
||||
* @param EntityManager $entityManager
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function enableFilters(EntityManager $entityManager)
|
||||
{
|
||||
if (empty($this->enabledFilters)) {
|
||||
|
@ -23,31 +23,51 @@ class ClassMetadataCollection
|
||||
private $namespace;
|
||||
private $metadata;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $metadata
|
||||
*/
|
||||
public function __construct(array $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $namespace
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return $this->namespace;
|
||||
|
@ -19,6 +19,9 @@ namespace Doctrine\Bundle\DoctrineBundle\Mapping;
|
||||
*/
|
||||
class DisconnectedMetadataFactory extends MetadataFactory
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getClassMetadataFactoryClass()
|
||||
{
|
||||
return 'Doctrine\\ORM\\Tools\\DisconnectedClassMetadataFactory';
|
||||
|
@ -44,6 +44,7 @@ class MetadataFactory
|
||||
* @param BundleInterface $bundle A BundleInterface instance
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
* @throws \RuntimeException When bundle does not contain mapped entities
|
||||
*/
|
||||
public function getBundleMetadata(BundleInterface $bundle)
|
||||
{
|
||||
@ -68,6 +69,7 @@ class MetadataFactory
|
||||
* @param string $path The path where the class is stored (if known)
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
* @throws MappingException When class is not valid entity or mapped superclass
|
||||
*/
|
||||
public function getClassMetadata($class, $path = null)
|
||||
{
|
||||
@ -88,6 +90,7 @@ class MetadataFactory
|
||||
* @param string $path The path where the class is stored (if known)
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
* @throws \RuntimeException When namespace not contain mapped entities
|
||||
*/
|
||||
public function getNamespaceMetadata($namespace, $path = null)
|
||||
{
|
||||
@ -106,7 +109,8 @@ class MetadataFactory
|
||||
*
|
||||
* @param ClassMetadataCollection $metadata
|
||||
* @param string|null $path
|
||||
* @return void
|
||||
*
|
||||
* @throws \RuntimeException When unable to determine the path
|
||||
*/
|
||||
public function findNamespaceAndPathForMetadata(ClassMetadataCollection $metadata, $path = null)
|
||||
{
|
||||
@ -122,11 +126,21 @@ class MetadataFactory
|
||||
$metadata->setNamespace(isset($r) ? $r->getNamespaceName() : $all[0]->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a base path for a class
|
||||
*
|
||||
* @param string $name class name
|
||||
* @param string $namespace class namespace
|
||||
* @param string $path class path
|
||||
*
|
||||
* @return string
|
||||
* @throws \RuntimeException When base path not found
|
||||
*/
|
||||
private function getBasePathForClass($name, $namespace, $path)
|
||||
{
|
||||
$namespace = str_replace('\\', '/', $namespace);
|
||||
$search = str_replace('\\', '/', $path);
|
||||
$destination = str_replace('/'.$namespace, '', $search, $c);
|
||||
$destination = str_replace('/' . $namespace, '', $search, $c);
|
||||
|
||||
if ($c != 1) {
|
||||
throw new \RuntimeException(sprintf('Can\'t find base path for "%s" (path: "%s", destination: "%s").', $name, $path, $destination));
|
||||
@ -135,6 +149,11 @@ class MetadataFactory
|
||||
return $destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $namespace
|
||||
*
|
||||
* @return ClassMetadataCollection
|
||||
*/
|
||||
private function getMetadataForNamespace($namespace)
|
||||
{
|
||||
$metadata = array();
|
||||
@ -147,6 +166,11 @@ class MetadataFactory
|
||||
return new ClassMetadataCollection($metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entity
|
||||
*
|
||||
* @return ClassMetadataCollection
|
||||
*/
|
||||
private function getMetadataForClass($entity)
|
||||
{
|
||||
foreach ($this->getAllMetadata() as $metadata) {
|
||||
@ -158,11 +182,15 @@ class MetadataFactory
|
||||
return new ClassMetadataCollection(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getAllMetadata()
|
||||
{
|
||||
$metadata = array();
|
||||
foreach ($this->registry->getManagers() as $em) {
|
||||
$class = $this->getClassMetadataFactoryClass();
|
||||
/** @var $cmf \Doctrine\ORM\Mapping\ClassMetadataFactory */
|
||||
$cmf = new $class();
|
||||
$cmf->setEntityManager($em);
|
||||
foreach ($cmf->getAllMetadata() as $m) {
|
||||
@ -173,6 +201,9 @@ class MetadataFactory
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getClassMetadataFactoryClass()
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\ClassMetadataFactory';
|
||||
|
@ -27,6 +27,15 @@ use Doctrine\ORM\EntityManager;
|
||||
*/
|
||||
class Registry extends ManagerRegistry implements RegistryInterface
|
||||
{
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param ContainerInterface $container
|
||||
* @param array $connections
|
||||
* @param array $entityManagers
|
||||
* @param string $defaultConnection
|
||||
* @param string $defaultEntityManager
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager)
|
||||
{
|
||||
$this->setContainer($container);
|
||||
|
@ -150,7 +150,7 @@ certain classes, but those are for very advanced use-cases only.
|
||||
Caching Drivers
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
For the caching drivers you can specify the values "array", "apc", "memcache"
|
||||
For the caching drivers you can specify the values "array", "apc", "memcache", "memcached"
|
||||
or "xcache".
|
||||
|
||||
The following example shows an overview of the caching configurations:
|
||||
|
@ -37,6 +37,7 @@
|
||||
"psr-0": { "Doctrine\\Bundle\\DoctrineBundle": "" }
|
||||
},
|
||||
"target-dir": "Doctrine/Bundle/DoctrineBundle",
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
|
@ -124,8 +124,15 @@ class EntityRepository implements ObjectRepository
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($lockMode !== LockMode::NONE) {
|
||||
switch ($lockMode) {
|
||||
case LockMode::OPTIMISTIC:
|
||||
$this->_em->lock($entity, $lockMode, $lockVersion);
|
||||
break;
|
||||
case LockMode::PESSIMISTIC_READ:
|
||||
case LockMode::PESSIMISTIC_WRITE:
|
||||
$persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName);
|
||||
$persister->refresh($sortedId, $entity, $lockMode);
|
||||
break;
|
||||
}
|
||||
|
||||
return $entity; // Hit!
|
||||
|
@ -364,7 +364,19 @@ class BasicEntityPersister
|
||||
$targetMapping = $this->_em->getClassMetadata($this->_class->associationMappings[$idField]['targetEntity']);
|
||||
$where[] = $this->_class->associationMappings[$idField]['joinColumns'][0]['name'];
|
||||
$params[] = $id[$idField];
|
||||
|
||||
switch (true) {
|
||||
case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])):
|
||||
$types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];
|
||||
break;
|
||||
|
||||
case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])):
|
||||
$types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type'];
|
||||
break;
|
||||
|
||||
default:
|
||||
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
|
||||
}
|
||||
} else {
|
||||
$where[] = $this->_class->getQuotedColumnName($idField, $this->_platform);
|
||||
$params[] = $id[$idField];
|
||||
@ -690,9 +702,9 @@ class BasicEntityPersister
|
||||
* column or field names to values.
|
||||
* @param object $entity The entity to refresh.
|
||||
*/
|
||||
public function refresh(array $id, $entity)
|
||||
public function refresh(array $id, $entity, $lockMode = 0)
|
||||
{
|
||||
$sql = $this->_getSelectEntitiesSQL($id);
|
||||
$sql = $this->_getSelectEntitiesSQL($id, null, $lockMode);
|
||||
list($params, $types) = $this->expandParameters($id);
|
||||
$stmt = $this->_conn->executeQuery($sql, $params, $types);
|
||||
|
||||
|
@ -184,7 +184,19 @@ class ProxyFactory
|
||||
|
||||
$file = str_replace($placeholders, $replacements, $file);
|
||||
|
||||
file_put_contents($fileName, $file, LOCK_EX);
|
||||
$parentDirectory = dirname($fileName);
|
||||
|
||||
if ( ! is_dir($parentDirectory)) {
|
||||
if (false === @mkdir($parentDirectory, 0775, true)) {
|
||||
throw ProxyException::proxyDirectoryNotWritable();
|
||||
}
|
||||
} else if ( ! is_writable($parentDirectory)) {
|
||||
throw ProxyException::proxyDirectoryNotWritable();
|
||||
}
|
||||
|
||||
$tmpFileName = $fileName . '.' . uniqid("", true);
|
||||
file_put_contents($tmpFileName, $file);
|
||||
rename($tmpFileName, $fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,6 +136,23 @@ public function <methodName>(<methodTypeHint>$<variableName>)
|
||||
<spaces>return $this;
|
||||
}';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $_removeMethodTemplate =
|
||||
'/**
|
||||
* <description>
|
||||
*
|
||||
* @param <variableType$<variableName>
|
||||
*/
|
||||
public function <methodName>(<methodTypeHint>$<variableName>)
|
||||
{
|
||||
<spaces>$this-><fieldName>->removeElement($<variableName>);
|
||||
}';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $_lifecycleCallbackMethodTemplate =
|
||||
'/**
|
||||
* @<name>
|
||||
@ -672,6 +689,9 @@ public function <methodName>()
|
||||
if ($code = $this->_generateEntityStubMethod($metadata, 'add', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
|
||||
$methods[] = $code;
|
||||
}
|
||||
if ($code = $this->_generateEntityStubMethod($metadata, 'remove', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
|
||||
$methods[] = $code;
|
||||
}
|
||||
if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], 'Doctrine\Common\Collections\Collection')) {
|
||||
$methods[] = $code;
|
||||
}
|
||||
@ -756,12 +776,9 @@ public function <methodName>()
|
||||
|
||||
private function _generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null)
|
||||
{
|
||||
if ($type == "add") {
|
||||
$addMethod = explode("\\", $typeHint);
|
||||
$addMethod = end($addMethod);
|
||||
$methodName = $type . $addMethod;
|
||||
} else {
|
||||
$methodName = $type . Inflector::classify($fieldName);
|
||||
if (in_array($type, array("add", "remove")) && substr($methodName, -1) == "s") {
|
||||
$methodName = substr($methodName, 0, -1);
|
||||
}
|
||||
|
||||
if ($this->_hasMethod($methodName, $metadata)) {
|
||||
|
@ -1118,6 +1118,10 @@ class UnitOfWork implements PropertyChangedListener
|
||||
if (isset($this->entityIdentifiers[$oid])) {
|
||||
$this->addToIdentityMap($entity);
|
||||
}
|
||||
|
||||
if ($entity instanceof NotifyPropertyChanged) {
|
||||
$entity->addPropertyChangedListener($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1296,10 +1300,6 @@ class UnitOfWork implements PropertyChangedListener
|
||||
|
||||
$this->identityMap[$className][$idHash] = $entity;
|
||||
|
||||
if ($entity instanceof NotifyPropertyChanged) {
|
||||
$entity->addPropertyChangedListener($this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1649,7 +1649,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$oid = spl_object_hash($entity);
|
||||
|
||||
if (isset($visited[$oid])) {
|
||||
return; // Prevent infinite recursion
|
||||
return $visited[$oid]; // Prevent infinite recursion
|
||||
}
|
||||
|
||||
$visited[$oid] = $entity; // mark visited
|
||||
@ -2361,6 +2361,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$this->entityIdentifiers[$oid] = $id;
|
||||
$this->entityStates[$oid] = self::STATE_MANAGED;
|
||||
$this->originalEntityData[$oid] = $data;
|
||||
|
||||
$this->identityMap[$class->rootEntityName][$idHash] = $entity;
|
||||
|
||||
if ($entity instanceof NotifyPropertyChanged) {
|
||||
@ -2790,6 +2791,10 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$this->originalEntityData[$oid] = $data;
|
||||
|
||||
$this->addToIdentityMap($entity);
|
||||
|
||||
if ($entity instanceof NotifyPropertyChanged) {
|
||||
$entity->addPropertyChangedListener($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,6 +70,27 @@ class ScriptHandler
|
||||
static::executeCommand($event, $appDir, 'assets:install '.$symlink.escapeshellarg($webDir));
|
||||
}
|
||||
|
||||
public static function installRequirementsFile($event)
|
||||
{
|
||||
$options = self::getOptions($event);
|
||||
$appDir = $options['symfony-app-dir'];
|
||||
|
||||
if (!is_dir($appDir)) {
|
||||
echo 'The symfony-app-dir ('.$appDir.') specified in composer.json was not found in '.getcwd().', can not install the requirements file.'.PHP_EOL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
copy(__DIR__.'/../Resources/skeleton/app/SymfonyRequirements.php', $appDir.'/SymfonyRequirements.php');
|
||||
copy(__DIR__.'/../Resources/skeleton/app/check.php', $appDir.'/check.php');
|
||||
|
||||
$webDir = $options['symfony-web-dir'];
|
||||
|
||||
if (is_file($webDir.'/config.php')) {
|
||||
copy(__DIR__.'/../Resources/skeleton/web/config.php', $webDir.'/config.php');
|
||||
}
|
||||
}
|
||||
|
||||
public static function doBuildBootstrap($appDir)
|
||||
{
|
||||
$file = $appDir.'/bootstrap.php.cache';
|
||||
@ -81,16 +102,13 @@ class ScriptHandler
|
||||
'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface',
|
||||
// Cannot be included because annotations will parse the big compiled class file
|
||||
//'Symfony\\Component\\DependencyInjection\\ContainerAware',
|
||||
'Symfony\\Component\\DependencyInjection\\ContainerInterface',
|
||||
'Symfony\\Component\\DependencyInjection\\Container',
|
||||
'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
|
||||
'Symfony\\Component\\HttpKernel\\KernelInterface',
|
||||
'Symfony\\Component\\HttpKernel\\Kernel',
|
||||
'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
|
||||
'Symfony\\Component\\ClassLoader\\ApcClassLoader',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
|
||||
'Symfony\\Component\\Config\\ConfigCache',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\HttpKernel',
|
||||
// cannot be included as commands are discovered based on the path to this class via Reflection
|
||||
//'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
|
||||
), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
|
||||
@ -107,25 +125,23 @@ namespace { return \$loader; }
|
||||
|
||||
protected static function executeCommand($event, $appDir, $cmd)
|
||||
{
|
||||
$phpFinder = new PhpExecutableFinder;
|
||||
$php = escapeshellarg($phpFinder->find());
|
||||
$php = escapeshellarg(self::getPhp());
|
||||
$console = escapeshellarg($appDir.'/console');
|
||||
if ($event->getIO()->isDecorated()) {
|
||||
$console.= ' --ansi';
|
||||
}
|
||||
|
||||
$process = new Process($php.' '.$console.' '.$cmd);
|
||||
$process = new Process($php.' '.$console.' '.$cmd, null, null, null, 300);
|
||||
$process->run(function ($type, $buffer) { echo $buffer; });
|
||||
}
|
||||
|
||||
protected static function executeBuildBootstrap($appDir)
|
||||
{
|
||||
$phpFinder = new PhpExecutableFinder;
|
||||
$php = escapeshellarg($phpFinder->find());
|
||||
$php = escapeshellarg(self::getPhp());
|
||||
$cmd = escapeshellarg(__DIR__.'/../Resources/bin/build_bootstrap.php');
|
||||
$appDir = escapeshellarg($appDir);
|
||||
|
||||
$process = new Process($php.' '.$cmd.' '.$appDir);
|
||||
$process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, 300);
|
||||
$process->run(function ($type, $buffer) { echo $buffer; });
|
||||
}
|
||||
|
||||
@ -141,4 +157,14 @@ namespace { return \$loader; }
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected static function getPhp()
|
||||
{
|
||||
$phpFinder = new PhpExecutableFinder;
|
||||
if (!$phpPath = $phpFinder->find()) {
|
||||
throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again');
|
||||
}
|
||||
|
||||
return $phpPath;
|
||||
}
|
||||
}
|
||||
|
91
vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php
vendored
Normal file
91
vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sensio\Bundle\DistributionBundle\Diff;
|
||||
|
||||
/**
|
||||
* Computes a Diff between files (line by line).
|
||||
*
|
||||
* Implements the Longest common subsequence problem algorithm.
|
||||
*
|
||||
* @see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Diff
|
||||
{
|
||||
private $diff;
|
||||
|
||||
public function __construct($str1, $str2)
|
||||
{
|
||||
$lines1 = explode("\n", $str1);
|
||||
$lines2 = explode("\n", $str2);
|
||||
|
||||
$this->diff = $this->computeDiff($this->computeLcs($lines1, $lines2), $lines1, $lines2, count($lines1) - 1, count($lines2) - 1);
|
||||
}
|
||||
|
||||
public function getDiff()
|
||||
{
|
||||
$diff = array();
|
||||
for ($i = 0, $max = count($this->diff); $i < $max; $i++) {
|
||||
if ('' != $this->diff[$i][0]) {
|
||||
$diff[] = array('@', sprintf(' Line %s', $this->diff[$i][2]));
|
||||
|
||||
do {
|
||||
$diff[] = $this->diff[$i++];
|
||||
} while ('' != $this->diff[$i][0]);
|
||||
}
|
||||
}
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
public function computeDiff(array $c, array $lines1, array $lines2, $i, $j)
|
||||
{
|
||||
$diff = array();
|
||||
|
||||
if ($i > -1 && $j > -1 && $lines1[$i] == $lines2[$j]) {
|
||||
$diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j - 1));
|
||||
$diff[] = array('', $lines1[$i], $i, $j);
|
||||
} else {
|
||||
if ($j > -1 && ($i == -1 || $c[$i][$j - 1] >= $c[$i - 1][$j])) {
|
||||
$diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i, $j - 1));
|
||||
$diff[] = array('+', $lines2[$j], $i, $j);
|
||||
} elseif ($i > -1 && ($j == -1 || $c[$i][$j - 1] < $c[$i - 1][$j])) {
|
||||
$diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j));
|
||||
$diff[] = array('-', $lines1[$i], $i, $j);
|
||||
}
|
||||
}
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
private function computeLcs(array $lines1, array $lines2)
|
||||
{
|
||||
for ($i = -1, $len1 = count($lines1); $i < $len1; $i++) {
|
||||
for ($j = -1, $len2 = count($lines2); $j < $len2; $j++) {
|
||||
$c[$i][$j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $len1; $i++) {
|
||||
for ($j = 0; $j < $len2; $j++) {
|
||||
if ($lines1[$i] == $lines2[$j]) {
|
||||
$c[$i][$j] = $c[$i - 1][$j - 1] + 1;
|
||||
} else {
|
||||
$c[$i][$j] = max($c[$i][$j - 1], $c[$i - 1][$j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ $argv = $_SERVER['argv'];
|
||||
if (isset($argv[1])) {
|
||||
$appDir = $argv[1];
|
||||
} else {
|
||||
if (!$appDir = realpath(__DIR__.'/../../../../../../../app')) {
|
||||
if (!$appDir = realpath(__DIR__.'/../../../../../../../../app')) {
|
||||
exit('Looks like you don\'t have a standard layout.');
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ h2 {
|
||||
padding: 2px 4px;
|
||||
display: inline-block;
|
||||
text-transform: uppercase;
|
||||
|
||||
}
|
||||
|
||||
p {
|
||||
@ -135,3 +134,15 @@ ul li {
|
||||
font-size: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.ok {
|
||||
color: #fff;
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
background-color: #6d6;
|
||||
padding: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ko {
|
||||
background-color: #d66;
|
||||
}
|
||||
|
@ -0,0 +1,597 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a single PHP requirement, e.g. an installed extension.
|
||||
* It can be a mandatory requirement or an optional recommendation.
|
||||
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
|
||||
*
|
||||
* This file must be compatible with PHP 5.2+.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER
|
||||
*
|
||||
* If you want to change this file, edit the one in the
|
||||
* SensioDistributionBundle instead.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class Requirement
|
||||
{
|
||||
private $fulfilled;
|
||||
private $testMessage;
|
||||
private $helpText;
|
||||
private $helpHtml;
|
||||
private $optional;
|
||||
|
||||
/**
|
||||
* Constructor that initializes the requirement.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the requirement is fulfilled
|
||||
* @param string $testMessage The message for testing the requirement
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
|
||||
*/
|
||||
public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
|
||||
{
|
||||
$this->fulfilled = (Boolean) $fulfilled;
|
||||
$this->testMessage = (string) $testMessage;
|
||||
$this->helpHtml = (string) $helpHtml;
|
||||
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
|
||||
$this->optional = (Boolean) $optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the requirement is fulfilled.
|
||||
*
|
||||
* @return Boolean true if fulfilled, otherwise false
|
||||
*/
|
||||
public function isFulfilled()
|
||||
{
|
||||
return $this->fulfilled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message for testing the requirement.
|
||||
*
|
||||
* @return string The test message
|
||||
*/
|
||||
public function getTestMessage()
|
||||
{
|
||||
return $this->testMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help text for resolving the problem
|
||||
*
|
||||
* @return string The help text
|
||||
*/
|
||||
public function getHelpText()
|
||||
{
|
||||
return $this->helpText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help text formatted in HTML.
|
||||
*
|
||||
* @return string The HTML help
|
||||
*/
|
||||
public function getHelpHtml()
|
||||
{
|
||||
return $this->helpHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is only an optional recommendation and not a mandatory requirement.
|
||||
*
|
||||
* @return Boolean true if optional, false if mandatory
|
||||
*/
|
||||
public function isOptional()
|
||||
{
|
||||
return $this->optional;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a PHP requirement in form of a php.ini configuration.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class PhpIniRequirement extends Requirement
|
||||
{
|
||||
/**
|
||||
* Constructor that initializes the requirement.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
|
||||
*/
|
||||
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
|
||||
{
|
||||
$cfgValue = ini_get($cfgName);
|
||||
|
||||
if (is_callable($evaluation)) {
|
||||
if (null === $testMessage || null === $helpHtml) {
|
||||
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
|
||||
}
|
||||
|
||||
$fulfilled = call_user_func($evaluation, $cfgValue);
|
||||
} else {
|
||||
if (null === $testMessage) {
|
||||
$testMessage = sprintf('%s %s be %s in php.ini',
|
||||
$cfgName,
|
||||
$optional ? 'should' : 'must',
|
||||
$evaluation ? 'enabled' : 'disabled'
|
||||
);
|
||||
}
|
||||
|
||||
if (null === $helpHtml) {
|
||||
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
|
||||
$cfgName,
|
||||
$evaluation ? 'on' : 'off'
|
||||
);
|
||||
}
|
||||
|
||||
$fulfilled = $evaluation == $cfgValue;
|
||||
}
|
||||
|
||||
parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A RequirementCollection represents a set of Requirement instances.
|
||||
*
|
||||
* Users of PHP 5.2 should be able to run the requirements checks.
|
||||
* This is why the class must be compatible with PHP 5.2
|
||||
* (e.g. not using namespaces and closures).
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RequirementCollection implements IteratorAggregate
|
||||
{
|
||||
private $requirements = array();
|
||||
|
||||
/**
|
||||
* Gets the current RequirementCollection as an Iterator.
|
||||
*
|
||||
* @return Traversable A Traversable interface
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Requirement.
|
||||
*
|
||||
* @param Requirement $requirement A Requirement instance
|
||||
*/
|
||||
public function add(Requirement $requirement)
|
||||
{
|
||||
$this->requirements[] = $requirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a mandatory requirement.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the requirement is fulfilled
|
||||
* @param string $testMessage The message for testing the requirement
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
|
||||
{
|
||||
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an optional recommendation.
|
||||
*
|
||||
* @param Boolean $fulfilled Whether the recommendation is fulfilled
|
||||
* @param string $testMessage The message for testing the recommendation
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
|
||||
{
|
||||
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a mandatory requirement in form of a php.ini configuration.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
|
||||
{
|
||||
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an optional recommendation in form of a php.ini configuration.
|
||||
*
|
||||
* @param string $cfgName The configuration name used for ini_get()
|
||||
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
|
||||
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
|
||||
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
|
||||
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
|
||||
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
|
||||
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
|
||||
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
|
||||
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
|
||||
*/
|
||||
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
|
||||
{
|
||||
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a requirement collection to the current set of requirements.
|
||||
*
|
||||
* @param RequirementCollection $collection A RequirementCollection instance
|
||||
*/
|
||||
public function addCollection(RequirementCollection $collection)
|
||||
{
|
||||
$this->requirements = array_merge($this->requirements, $collection->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns both requirements and recommendations.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all mandatory requirements.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getRequirements()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mandatory requirements that were not met.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getFailedRequirements()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && !$req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all optional recommmendations.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getRecommendations()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if ($req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the recommendations that were not met.
|
||||
*
|
||||
* @return array Array of Requirement instances
|
||||
*/
|
||||
public function getFailedRecommendations()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && $req->isOptional()) {
|
||||
$array[] = $req;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a php.ini configuration is not correct.
|
||||
*
|
||||
* @return Boolean php.ini configuration problem?
|
||||
*/
|
||||
public function hasPhpIniConfigIssue()
|
||||
{
|
||||
foreach ($this->requirements as $req) {
|
||||
if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PHP configuration file (php.ini) path.
|
||||
*
|
||||
* @return string|false php.ini file path
|
||||
*/
|
||||
public function getPhpIniConfigPath()
|
||||
{
|
||||
return get_cfg_var('cfg_file_path');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class specifies all requirements and optional recommendations that
|
||||
* are necessary to run the Symfony Standard Edition.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class SymfonyRequirements extends RequirementCollection
|
||||
{
|
||||
const REQUIRED_PHP_VERSION = '5.3.3';
|
||||
|
||||
/**
|
||||
* Constructor that initializes the requirements.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* mandatory requirements follow */
|
||||
|
||||
$installedPhpVersion = phpversion();
|
||||
|
||||
$this->addRequirement(
|
||||
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
|
||||
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
|
||||
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
|
||||
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
|
||||
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
|
||||
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_dir(__DIR__.'/../vendor/composer'),
|
||||
'Vendor libraries must be installed',
|
||||
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
|
||||
'Then run "<strong>php composer.phar install</strong>" to install them.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
|
||||
'Outdated requirements file',
|
||||
'Your requirements file is outdated. Run composer install and re-check your configuration.'
|
||||
);
|
||||
|
||||
$baseDir = basename(__DIR__);
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/cache'),
|
||||
"$baseDir/cache/ directory must be writable",
|
||||
"Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/logs'),
|
||||
"$baseDir/logs/ directory must be writable",
|
||||
"Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
|
||||
);
|
||||
|
||||
$this->addPhpIniRequirement(
|
||||
'date.timezone', true, false,
|
||||
'date.timezone setting must be set',
|
||||
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
|
||||
);
|
||||
|
||||
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
|
||||
$this->addRequirement(
|
||||
(in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
|
||||
sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()),
|
||||
'Fix your <strong>php.ini</strong> file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('json_encode'),
|
||||
'json_encode() must be available',
|
||||
'Install and enable the <strong>JSON</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('session_start'),
|
||||
'session_start() must be available',
|
||||
'Install and enable the <strong>session</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('ctype_alpha'),
|
||||
'ctype_alpha() must be available',
|
||||
'Install and enable the <strong>ctype</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('token_get_all'),
|
||||
'token_get_all() must be available',
|
||||
'Install and enable the <strong>Tokenizer</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
function_exists('simplexml_import_dom'),
|
||||
'simplexml_import_dom() must be available',
|
||||
'Install and enable the <strong>SimpleXML</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='),
|
||||
'APC version must be at least 3.0.17',
|
||||
'Upgrade your <strong>APC</strong> extension (3.0.17+)'
|
||||
);
|
||||
|
||||
$this->addPhpIniRequirement('detect_unicode', false);
|
||||
|
||||
$this->addPhpIniRequirement(
|
||||
'suhosin.executor.include.whitelist',
|
||||
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
|
||||
true,
|
||||
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
|
||||
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
|
||||
);
|
||||
|
||||
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
|
||||
|
||||
$this->addRequirement(
|
||||
null !== $pcreVersion && $pcreVersion > 8.0,
|
||||
sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'),
|
||||
'Upgrade your <strong>PCRE</strong> extension (8.0+)'
|
||||
);
|
||||
|
||||
/* optional recommendations follow */
|
||||
|
||||
$this->addRecommendation(
|
||||
version_compare($installedPhpVersion, '5.3.8', '>='),
|
||||
sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion),
|
||||
'Install PHP 5.3.8 or newer if your project uses annotations'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('DomDocument'),
|
||||
'PHP-XML module should be installed',
|
||||
'Install and enable the <strong>PHP-XML</strong> module.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('mb_strlen'),
|
||||
'mb_strlen() should be available',
|
||||
'Install and enable the <strong>mbstring</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('iconv'),
|
||||
'iconv() should be available',
|
||||
'Install and enable the <strong>iconv</strong> extension.'
|
||||
);
|
||||
|
||||
$this->addRecommendation(
|
||||
function_exists('utf8_decode'),
|
||||
'utf8_decode() should be available',
|
||||
'Install and enable the <strong>XML</strong> extension.'
|
||||
);
|
||||
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$this->addRecommendation(
|
||||
function_exists('posix_isatty'),
|
||||
'posix_isatty() should be available',
|
||||
'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('Locale'),
|
||||
'intl extension should be available',
|
||||
'Install and enable the <strong>intl</strong> extension (used for validators).'
|
||||
);
|
||||
|
||||
if (class_exists('Locale')) {
|
||||
if (defined('INTL_ICU_VERSION')) {
|
||||
$version = INTL_ICU_VERSION;
|
||||
} else {
|
||||
$reflector = new ReflectionExtension('intl');
|
||||
|
||||
ob_start();
|
||||
$reflector->info();
|
||||
$output = strip_tags(ob_get_clean());
|
||||
|
||||
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
|
||||
$version = $matches[1];
|
||||
}
|
||||
|
||||
$this->addRecommendation(
|
||||
version_compare($version, '4.0', '>='),
|
||||
'intl ICU version should be at least 4+',
|
||||
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
|
||||
);
|
||||
}
|
||||
|
||||
$accelerator =
|
||||
(function_exists('apc_store') && ini_get('apc.enabled'))
|
||||
||
|
||||
function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
|
||||
||
|
||||
function_exists('xcache_set')
|
||||
;
|
||||
|
||||
$this->addRecommendation(
|
||||
$accelerator,
|
||||
'a PHP accelerator should be installed',
|
||||
'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
|
||||
);
|
||||
|
||||
$this->addPhpIniRecommendation('short_open_tag', false);
|
||||
|
||||
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
|
||||
|
||||
$this->addPhpIniRecommendation('register_globals', false, true);
|
||||
|
||||
$this->addPhpIniRecommendation('session.auto_start', false);
|
||||
|
||||
$this->addRecommendation(
|
||||
class_exists('PDO'),
|
||||
'PDO should be installed',
|
||||
'Install <strong>PDO</strong> (mandatory for Doctrine).'
|
||||
);
|
||||
|
||||
if (class_exists('PDO')) {
|
||||
$drivers = PDO::getAvailableDrivers();
|
||||
$this->addRecommendation(
|
||||
count($drivers),
|
||||
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
|
||||
'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/SymfonyRequirements.php';
|
||||
|
||||
$symfonyRequirements = new SymfonyRequirements();
|
||||
|
||||
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
|
||||
|
||||
echo "********************************\n";
|
||||
echo "* *\n";
|
||||
echo "* Symfony requirements check *\n";
|
||||
echo "* *\n";
|
||||
echo "********************************\n\n";
|
||||
|
||||
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
|
||||
|
||||
echo "** ATTENTION **\n";
|
||||
echo "* The PHP CLI can use a different php.ini file\n";
|
||||
echo "* than the one used with your web server.\n";
|
||||
if ('\\' == DIRECTORY_SEPARATOR) {
|
||||
echo "* (especially on the Windows platform)\n";
|
||||
}
|
||||
echo "* To be on the safe side, please also launch the requirements check\n";
|
||||
echo "* from your web server using the web/config.php script.\n";
|
||||
|
||||
echo_title('Mandatory requirements');
|
||||
|
||||
foreach ($symfonyRequirements->getRequirements() as $req) {
|
||||
echo_requirement($req);
|
||||
}
|
||||
|
||||
echo_title('Optional recommendations');
|
||||
|
||||
foreach ($symfonyRequirements->getRecommendations() as $req) {
|
||||
echo_requirement($req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a Requirement instance
|
||||
*/
|
||||
function echo_requirement(Requirement $requirement)
|
||||
{
|
||||
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
|
||||
echo ' ' . str_pad($result, 9);
|
||||
echo $requirement->getTestMessage() . "\n";
|
||||
|
||||
if (!$requirement->isFulfilled()) {
|
||||
echo sprintf(" %s\n\n", $requirement->getHelpText());
|
||||
}
|
||||
}
|
||||
|
||||
function echo_title($title)
|
||||
{
|
||||
echo "\n** $title **\n\n";
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_SERVER['HTTP_HOST'])) {
|
||||
exit('This script cannot be run from the CLI. Run it from a browser.');
|
||||
}
|
||||
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
|
||||
'127.0.0.1',
|
||||
'::1',
|
||||
))) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
exit('This script is only accessible from localhost.');
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__).'/../app/SymfonyRequirements.php';
|
||||
|
||||
$symfonyRequirements = new SymfonyRequirements();
|
||||
|
||||
$majorProblems = $symfonyRequirements->getFailedRequirements();
|
||||
$minorProblems = $symfonyRequirements->getFailedRecommendations();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="bundles/sensiodistribution/webconfigurator/css/install.css" media="all" />
|
||||
<title>Symfony Configuration</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="symfony-wrapper">
|
||||
<div id="symfony-content">
|
||||
<div class="symfony-blocks-install">
|
||||
<div class="symfony-block-logo">
|
||||
<img src="bundles/sensiodistribution/webconfigurator/images/logo-big.gif" alt="Symfony logo" />
|
||||
</div>
|
||||
|
||||
<div class="symfony-block-content">
|
||||
<h1>Welcome!</h1>
|
||||
<p>Welcome to your new Symfony project.</p>
|
||||
<p>
|
||||
This script will guide you through the basic configuration of your project.
|
||||
You can also do the same by editing the ‘<strong>app/config/parameters.yml</strong>’ file directly.
|
||||
</p>
|
||||
|
||||
<?php if (count($majorProblems)): ?>
|
||||
<h2 class="ko">Major problems</h2>
|
||||
<p>Major problems have been detected and <strong>must</strong> be fixed before continuing:</p>
|
||||
<ol>
|
||||
<?php foreach ($majorProblems as $problem): ?>
|
||||
<li><?php echo $problem->getHelpHtml() ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($minorProblems)): ?>
|
||||
<h2>Recommendations</h2>
|
||||
<p>
|
||||
<?php if (count($majorProblems)): ?>Additionally, to<?php else: ?>To<?php endif; ?> enhance your Symfony experience,
|
||||
it’s recommended that you fix the following:
|
||||
</p>
|
||||
<ol>
|
||||
<?php foreach ($minorProblems as $problem): ?>
|
||||
<li><?php echo $problem->getHelpHtml() ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($symfonyRequirements->hasPhpIniConfigIssue()): ?>
|
||||
<p id="phpini">*
|
||||
<?php if ($symfonyRequirements->getPhpIniConfigPath()): ?>
|
||||
Changes to the <strong>php.ini</strong> file must be done in "<strong><?php echo $symfonyRequirements->getPhpIniConfigPath() ?></strong>".
|
||||
<?php else: ?>
|
||||
To change settings, create a "<strong>php.ini</strong>".
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!count($majorProblems) && !count($minorProblems)): ?>
|
||||
<p class="ok">Your configuration looks good to run Symfony.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<ul class="symfony-install-continue">
|
||||
<?php if (!count($majorProblems)): ?>
|
||||
<li><a href="app_dev.php/_configurator/">Configure your Symfony Application online</a></li>
|
||||
<li><a href="app_dev.php/">Bypass configuration and go to the Welcome page</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if (count($majorProblems) || count($minorProblems)): ?>
|
||||
<li><a href="config.php">Re-check configuration</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="version">Symfony Standard Edition</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,15 +1,15 @@
|
||||
{% extends "form_div_layout.html.twig" %}
|
||||
|
||||
{% block field_rows %}
|
||||
{% block form_rows %}
|
||||
<div class="symfony-form-errors">
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
{% for child in form.children %}
|
||||
{% for child in form %}
|
||||
{{ form_row(child) }}
|
||||
{% endfor %}
|
||||
{% endblock field_rows %}
|
||||
{% endblock %}
|
||||
|
||||
{% block field_row %}
|
||||
{% block form_row %}
|
||||
<div class="symfony-form-row">
|
||||
{{ form_label(form) }}
|
||||
<div class="symfony-form-field">
|
||||
@ -21,7 +21,10 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block field_label %}
|
||||
{% block form_label %}
|
||||
{% if label is empty %}
|
||||
{% set label = name|humanize %}
|
||||
{% endif %}
|
||||
<label for="{{ id }}">
|
||||
{{ label|trans }}
|
||||
{% if required %}
|
||||
|
59
vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php
vendored
Normal file
59
vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sensio\Bundle\DistributionBundle\Upgrade;
|
||||
|
||||
use Sensio\Bundle\DistributionBundle\Diff\Diff;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Upgrade class.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Upgrade
|
||||
{
|
||||
public function outputConsoleDiff(OutputInterface $output, $file1, $file2)
|
||||
{
|
||||
if (is_file($file1)) {
|
||||
$file1 = realpath($file1);
|
||||
$str1 = file_get_contents($file1);
|
||||
} else {
|
||||
$str1 = '';
|
||||
}
|
||||
|
||||
if (!is_file($file2)) {
|
||||
throw new \RuntimeException(sprintf('The skeleton file "%s" does not exist.', $file2));
|
||||
}
|
||||
$file2 = realpath($file2);
|
||||
$str2 = file_get_contents($file2);
|
||||
|
||||
$diff = new Diff($str1, $str2);
|
||||
|
||||
$output->writeln(sprintf('--- %s', $file1));
|
||||
$output->writeln(sprintf('+++ %s', $file2));
|
||||
foreach ($diff->getDiff() as $line) {
|
||||
if ('+' == $line[0]) {
|
||||
$format = '<fg=green>+%s</>';
|
||||
} elseif ('-' == $line[0]) {
|
||||
$format = '<fg=red>-%s</>';
|
||||
} elseif ('@' == $line[0]) {
|
||||
$format = '<fg=cyan>@%s</>';
|
||||
} else {
|
||||
$format = ' %s';
|
||||
}
|
||||
|
||||
$output->writeln(sprintf($format, $line[1]));
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
}
|
||||
}
|
@ -3,20 +3,22 @@
|
||||
namespace Sensio\Bundle\FrameworkExtraBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\Config\Definition\NodeInterface;
|
||||
|
||||
/**
|
||||
* FrameworkExtraBundle configuration structure.
|
||||
*
|
||||
* @author Henrik Bjornskov <hb@peytz.dk>
|
||||
*/
|
||||
class Configuration
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @return Symfony\Component\Config\Definition\NodeInterface
|
||||
* @return NodeInterface
|
||||
*/
|
||||
public function getConfigTree()
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
|
||||
@ -50,6 +52,6 @@ class Configuration
|
||||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony framework.
|
||||
@ -27,13 +26,10 @@ class SensioFrameworkExtraExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
$loader->load('services.xml');
|
||||
|
||||
$annotationsToLoad = array();
|
||||
|
@ -57,11 +57,12 @@ class DoctrineParamConverter implements ParamConverterInterface
|
||||
|
||||
protected function find($class, Request $request, $options)
|
||||
{
|
||||
if (!$request->attributes->has('id')) {
|
||||
$key = isset($options['id']) ? $options['id'] : 'id';
|
||||
if (!$request->attributes->has($key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->registry->getRepository($class, $options['entity_manager'])->find($request->attributes->get('id'));
|
||||
return $this->registry->getRepository($class, $options['entity_manager'])->find($request->attributes->get($key));
|
||||
}
|
||||
|
||||
protected function findOneBy($class, Request $request, $options)
|
||||
|
@ -63,6 +63,17 @@ be configured with the ``entity_manager`` option::
|
||||
{
|
||||
}
|
||||
|
||||
If the placeholder has not the same name as the primary key, pass the ``id``
|
||||
option::
|
||||
|
||||
/**
|
||||
* @Route("/blog/{post_id}")
|
||||
* @ParamConverter("post", class="SensioBlogBundle:Post", options={"id" = "post_id"})
|
||||
*/
|
||||
public function showAction(Post $post)
|
||||
{
|
||||
}
|
||||
|
||||
Creating a Converter
|
||||
--------------------
|
||||
|
||||
|
2
vendor/swiftmailer/swiftmailer/VERSION
vendored
2
vendor/swiftmailer/swiftmailer/VERSION
vendored
@ -1 +1 @@
|
||||
Swift-4.1.9
|
||||
Swift-4.2.1
|
||||
|
2
vendor/swiftmailer/swiftmailer/composer.json
vendored
2
vendor/swiftmailer/swiftmailer/composer.json
vendored
@ -23,7 +23,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.1-dev"
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ ID headers contain identifiers for the entity (or the message). The most
|
||||
notable ID header is the Message-ID header on the message itself.
|
||||
|
||||
An ID that exists inside an ID header looks more-or-less less like an email
|
||||
address. For example, ``<![CDATA[<1234955437.499becad62ec2@example.org>]]>``.
|
||||
address. For example, ``<1234955437.499becad62ec2@example.org>``.
|
||||
The part to the left of the @ sign is usually unique, based on the current time
|
||||
and some random factor. The part on the right is usually a domain name.
|
||||
|
||||
|
@ -1,18 +1,34 @@
|
||||
Including Swift Mailer (Autoloading)
|
||||
====================================
|
||||
|
||||
Swift Mailer uses an autoloader so the only file you need to include is the
|
||||
``lib/swift_required.php`` file.
|
||||
If you are using Composer, Swift Mailer will be automatically autoloaded.
|
||||
|
||||
To use Swift Mailer's autoloader:
|
||||
If not, you can use the built-in autoloader by requiring the
|
||||
``swift_required.php`` file::
|
||||
|
||||
* Put Swift Mailer somewhere accessible to your PHP scripts (this does not
|
||||
need to be in the web root).
|
||||
require_once '/path/to/swift-mailer/lib/swift_required.php';
|
||||
|
||||
* Include, or require the ``lib/swift_required.php`` file.
|
||||
/* rest of code goes here */
|
||||
|
||||
* Follow the remainder of the documentation for using the available
|
||||
components.
|
||||
If you want to override the default Swift Mailer configuration, call the
|
||||
``init()`` method on the ``Swift`` class and pass it a valid PHP callable (a
|
||||
PHP function name, a PHP 5.3 anonymous function, ...)::
|
||||
|
||||
require_once '/path/to/swift-mailer/lib/swift_required.php';
|
||||
|
||||
function swiftmailer_configurator() {
|
||||
// configure Swift Mailer
|
||||
|
||||
Swift_DependencyContainer::getInstance()->...
|
||||
Swift_Preferences::getInstance()->...
|
||||
}
|
||||
|
||||
Swift::init('swiftmailer_configurator');
|
||||
|
||||
/* rest of code goes here */
|
||||
|
||||
The advantage of using the ``init()`` method is that your code will be
|
||||
executed only if you use Swift Mailer in your script.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -25,6 +41,16 @@ To use Swift Mailer's autoloader:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
require_once '/path/to/swift-mailer/lib/swift_required.php';
|
||||
require_once '/path/to/swift-mailer/lib/swift_init.php';
|
||||
|
||||
/* rest of code goes here */
|
||||
|
||||
For PHP versions starting with 5.3 it is recommended using the native quoted
|
||||
printable encoder. It uses PHP’s native ``quoted_printable_encode()``-function
|
||||
to achieve much better performance::
|
||||
|
||||
Swift::init(function () {
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('mime.qpcontentencoder')
|
||||
->asAliasOf('mime.nativeqpcontentencoder');
|
||||
});
|
||||
|
1
vendor/swiftmailer/swiftmailer/doc/index.rst
vendored
1
vendor/swiftmailer/swiftmailer/doc/index.rst
vendored
@ -13,3 +13,4 @@ Swiftmailer
|
||||
headers
|
||||
sending
|
||||
plugins
|
||||
japanese
|
||||
|
22
vendor/swiftmailer/swiftmailer/doc/japanese.rst
vendored
Normal file
22
vendor/swiftmailer/swiftmailer/doc/japanese.rst
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Using Swift Mailer for Japanese Emails
|
||||
======================================
|
||||
|
||||
To send emails in Japanese, you need to tweak the default configuration.
|
||||
|
||||
After requiring the Swift Mailer autoloader (by including the
|
||||
``swift_required.php`` file), call the ``Swift::init()`` method with the
|
||||
following code::
|
||||
|
||||
require_once '/path/to/swift-mailer/lib/swift_required.php';
|
||||
|
||||
Swift::init(function () {
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('mime.qpheaderencoder')
|
||||
->asAliasOf('mime.base64headerencoder');
|
||||
|
||||
Swift_Preferences::getInstance()->setCharset('iso-2022-jp');
|
||||
});
|
||||
|
||||
/* rest of code goes here */
|
||||
|
||||
That's all!
|
@ -134,7 +134,7 @@ need to make use of a small subset of them. Usually you'll use
|
||||
``setBody()``.
|
||||
|
||||
Calling methods is simple. You just call them like functions, but using the
|
||||
object operator "``<![CDATA[->]]>``" to do so. If you've created
|
||||
object operator "``->``" to do so. If you've created
|
||||
a message object and called it ``$message`` then you'd set a
|
||||
subject on it like so:
|
||||
|
||||
@ -147,8 +147,8 @@ subject on it like so:
|
||||
|
||||
All MIME entities (including a message) have a ``toString()``
|
||||
method that you can call if you want to take a look at what is going to be
|
||||
sent. For example, if you ``<![CDATA[echo
|
||||
$message->toString();]]>`` you would see something like this:
|
||||
sent. For example, if you ``echo
|
||||
$message->toString();`` you would see something like this:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -17,13 +17,25 @@
|
||||
*/
|
||||
abstract class Swift
|
||||
{
|
||||
|
||||
static $initialized = false;
|
||||
static $initPath;
|
||||
public static $initialized = false;
|
||||
public static $inits = array();
|
||||
|
||||
/** Swift Mailer Version number generated during dist release process */
|
||||
const VERSION = '@SWIFT_VERSION_NUMBER@';
|
||||
|
||||
/**
|
||||
* Registers an initializer callable that will be called the first time
|
||||
* a SwiftMailer class is autoloaded.
|
||||
*
|
||||
* This enables you to tweak the default configuration in a lazy way.
|
||||
*
|
||||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
|
||||
*/
|
||||
public static function init($callable)
|
||||
{
|
||||
self::$inits[] = $callable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal autoloader for spl_autoload_register().
|
||||
*
|
||||
@ -32,25 +44,24 @@ abstract class Swift
|
||||
public static function autoload($class)
|
||||
{
|
||||
//Don't interfere with other autoloaders
|
||||
if (0 !== strpos($class, 'Swift_'))
|
||||
{
|
||||
if (0 !== strpos($class, 'Swift_')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
|
||||
|
||||
if (!file_exists($path))
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self::$initPath && !self::$initialized)
|
||||
{
|
||||
self::$initialized = true;
|
||||
require self::$initPath;
|
||||
}
|
||||
|
||||
require $path;
|
||||
|
||||
if (self::$inits && !self::$initialized) {
|
||||
self::$initialized = true;
|
||||
foreach (self::$inits as $init) {
|
||||
call_user_func($init);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,12 +69,13 @@ abstract class Swift
|
||||
*
|
||||
* This is designed to play nicely with other autoloaders.
|
||||
*
|
||||
* @param string $initPath The init script to load when autoloading the first Swift class
|
||||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
|
||||
*/
|
||||
public static function registerAutoload($initPath = null)
|
||||
public static function registerAutoload($callable = null)
|
||||
{
|
||||
self::$initPath = $initPath;
|
||||
if (null !== $callable) {
|
||||
self::$inits[] = $callable;
|
||||
}
|
||||
spl_autoload_register(array('Swift', 'autoload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Attachment class for attaching files to a {@link Swift_Mime_Message}.
|
||||
* @package Swift
|
||||
@ -17,7 +16,6 @@
|
||||
*/
|
||||
class Swift_Attachment extends Swift_Mime_Attachment
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new Attachment.
|
||||
* Details may be optionally provided to the constructor.
|
||||
@ -25,8 +23,7 @@ class Swift_Attachment extends Swift_Mime_Attachment
|
||||
* @param string $filename
|
||||
* @param string $contentType
|
||||
*/
|
||||
public function __construct($data = null, $filename = null,
|
||||
$contentType = null)
|
||||
public function __construct($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
array($this, 'Swift_Mime_Attachment::__construct'),
|
||||
@ -36,8 +33,7 @@ class Swift_Attachment extends Swift_Mime_Attachment
|
||||
|
||||
$this->setBody($data);
|
||||
$this->setFilename($filename);
|
||||
if ($contentType)
|
||||
{
|
||||
if ($contentType) {
|
||||
$this->setContentType($contentType);
|
||||
}
|
||||
}
|
||||
@ -49,8 +45,7 @@ class Swift_Attachment extends Swift_Mime_Attachment
|
||||
* @param string $contentType
|
||||
* @return Swift_Mime_Attachment
|
||||
*/
|
||||
public static function newInstance($data = null, $filename = null,
|
||||
$contentType = null)
|
||||
public static function newInstance($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
return new self($data, $filename, $contentType);
|
||||
}
|
||||
@ -68,5 +63,4 @@ class Swift_Attachment extends Swift_Mime_Attachment
|
||||
$contentType
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,17 +8,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Provides the base functionality for an InputStream supporting filters.
|
||||
* @package Swift
|
||||
* @subpackage ByteStream
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
implements Swift_InputByteStream, Swift_Filterable
|
||||
abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_InputByteStream, Swift_Filterable
|
||||
{
|
||||
|
||||
/** Write sequence */
|
||||
protected $_sequence = 0;
|
||||
|
||||
@ -71,14 +68,13 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
public function write($bytes)
|
||||
{
|
||||
$this->_writeBuffer .= $bytes;
|
||||
foreach ($this->_filters as $filter)
|
||||
{
|
||||
if ($filter->shouldBuffer($this->_writeBuffer))
|
||||
{
|
||||
foreach ($this->_filters as $filter) {
|
||||
if ($filter->shouldBuffer($this->_writeBuffer)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->_doWrite($this->_writeBuffer);
|
||||
|
||||
return ++$this->_sequence;
|
||||
}
|
||||
|
||||
@ -115,12 +111,9 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream)
|
||||
{
|
||||
if ($is === $stream)
|
||||
{
|
||||
if ($this->_writeBuffer !== '')
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream) {
|
||||
if ($is === $stream) {
|
||||
if ($this->_writeBuffer !== '') {
|
||||
$stream->write($this->_filter($this->_writeBuffer));
|
||||
}
|
||||
unset($this->_mirrors[$k]);
|
||||
@ -135,14 +128,12 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
*/
|
||||
public function flushBuffers()
|
||||
{
|
||||
if ($this->_writeBuffer !== '')
|
||||
{
|
||||
if ($this->_writeBuffer !== '') {
|
||||
$this->_doWrite($this->_writeBuffer);
|
||||
}
|
||||
$this->_flush();
|
||||
|
||||
foreach ($this->_mirrors as $stream)
|
||||
{
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->flushBuffers();
|
||||
}
|
||||
}
|
||||
@ -152,10 +143,10 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
/** Run $bytes through all filters */
|
||||
private function _filter($bytes)
|
||||
{
|
||||
foreach ($this->_filters as $filter)
|
||||
{
|
||||
foreach ($this->_filters as $filter) {
|
||||
$bytes = $filter->filter($bytes);
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
@ -164,12 +155,10 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream
|
||||
{
|
||||
$this->_commit($this->_filter($bytes));
|
||||
|
||||
foreach ($this->_mirrors as $stream)
|
||||
{
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->write($bytes);
|
||||
}
|
||||
|
||||
$this->_writeBuffer = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,17 +8,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Allows reading and writing of bytes to and from an array.
|
||||
* @package Swift
|
||||
* @subpackage ByteStream
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_ByteStream_ArrayByteStream
|
||||
implements Swift_InputByteStream, Swift_OutputByteStream
|
||||
class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_OutputByteStream
|
||||
{
|
||||
|
||||
/**
|
||||
* The internal stack of bytes.
|
||||
* @var string[]
|
||||
@ -50,17 +47,12 @@ class Swift_ByteStream_ArrayByteStream
|
||||
*/
|
||||
public function __construct($stack = null)
|
||||
{
|
||||
if (is_array($stack))
|
||||
{
|
||||
if (is_array($stack)) {
|
||||
$this->_array = $stack;
|
||||
$this->_arraySize = count($stack);
|
||||
}
|
||||
elseif (is_string($stack))
|
||||
{
|
||||
} elseif (is_string($stack)) {
|
||||
$this->write($stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->_array = array();
|
||||
}
|
||||
}
|
||||
@ -75,8 +67,7 @@ class Swift_ByteStream_ArrayByteStream
|
||||
*/
|
||||
public function read($length)
|
||||
{
|
||||
if ($this->_offset == $this->_arraySize)
|
||||
{
|
||||
if ($this->_offset == $this->_arraySize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -86,10 +77,10 @@ class Swift_ByteStream_ArrayByteStream
|
||||
?$this->_arraySize
|
||||
:$end;
|
||||
$ret = '';
|
||||
for (; $this->_offset < $end; ++$this->_offset)
|
||||
{
|
||||
for (; $this->_offset < $end; ++$this->_offset) {
|
||||
$ret .= $this->_array[$this->_offset];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -100,14 +91,12 @@ class Swift_ByteStream_ArrayByteStream
|
||||
public function write($bytes)
|
||||
{
|
||||
$to_add = str_split($bytes);
|
||||
foreach ($to_add as $value)
|
||||
{
|
||||
foreach ($to_add as $value) {
|
||||
$this->_array[] = $value;
|
||||
}
|
||||
$this->_arraySize = count($this->_array);
|
||||
|
||||
foreach ($this->_mirrors as $stream)
|
||||
{
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->write($bytes);
|
||||
}
|
||||
}
|
||||
@ -141,10 +130,8 @@ class Swift_ByteStream_ArrayByteStream
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream)
|
||||
{
|
||||
if ($is === $stream)
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream) {
|
||||
if ($is === $stream) {
|
||||
unset($this->_mirrors[$k]);
|
||||
}
|
||||
}
|
||||
@ -157,12 +144,9 @@ class Swift_ByteStream_ArrayByteStream
|
||||
*/
|
||||
public function setReadPointer($byteOffset)
|
||||
{
|
||||
if ($byteOffset > $this->_arraySize)
|
||||
{
|
||||
if ($byteOffset > $this->_arraySize) {
|
||||
$byteOffset = $this->_arraySize;
|
||||
}
|
||||
elseif ($byteOffset < 0)
|
||||
{
|
||||
} elseif ($byteOffset < 0) {
|
||||
$byteOffset = 0;
|
||||
}
|
||||
|
||||
@ -179,10 +163,8 @@ class Swift_ByteStream_ArrayByteStream
|
||||
$this->_array = array();
|
||||
$this->_arraySize = 0;
|
||||
|
||||
foreach ($this->_mirrors as $stream)
|
||||
{
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->flushBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,18 +8,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Allows reading and writing of bytes to and from a file.
|
||||
* @package Swift
|
||||
* @subpackage ByteStream
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_ByteStream_FileByteStream
|
||||
extends Swift_ByteStream_AbstractFilterableInputStream
|
||||
implements Swift_FileStream
|
||||
class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_FileStream
|
||||
{
|
||||
|
||||
/** The internal pointer offset */
|
||||
private $_offset = 0;
|
||||
|
||||
@ -51,8 +47,7 @@ class Swift_ByteStream_FileByteStream
|
||||
$this->_path = $path;
|
||||
$this->_mode = $writable ? 'w+b' : 'rb';
|
||||
|
||||
if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1)
|
||||
{
|
||||
if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {
|
||||
$this->_quotes = true;
|
||||
}
|
||||
}
|
||||
@ -78,23 +73,20 @@ class Swift_ByteStream_FileByteStream
|
||||
public function read($length)
|
||||
{
|
||||
$fp = $this->_getReadHandle();
|
||||
if (!feof($fp))
|
||||
{
|
||||
if ($this->_quotes)
|
||||
{
|
||||
if (!feof($fp)) {
|
||||
if ($this->_quotes) {
|
||||
ini_set('magic_quotes_runtime', 0);
|
||||
}
|
||||
$bytes = fread($fp, $length);
|
||||
if ($this->_quotes)
|
||||
{
|
||||
if ($this->_quotes) {
|
||||
ini_set('magic_quotes_runtime', 1);
|
||||
}
|
||||
$this->_offset = ftell($fp);
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->_resetReadHandle();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -106,8 +98,7 @@ class Swift_ByteStream_FileByteStream
|
||||
*/
|
||||
public function setReadPointer($byteOffset)
|
||||
{
|
||||
if (isset($this->_reader))
|
||||
{
|
||||
if (isset($this->_reader)) {
|
||||
$this->_seekReadStreamToPosition($byteOffset);
|
||||
}
|
||||
$this->_offset = $byteOffset;
|
||||
@ -130,43 +121,39 @@ class Swift_ByteStream_FileByteStream
|
||||
/** Get the resource for reading */
|
||||
private function _getReadHandle()
|
||||
{
|
||||
if (!isset($this->_reader))
|
||||
{
|
||||
if (!$this->_reader = fopen($this->_path, 'rb'))
|
||||
{
|
||||
if (!isset($this->_reader)) {
|
||||
if (!$this->_reader = fopen($this->_path, 'rb')) {
|
||||
throw new Swift_IoException(
|
||||
'Unable to open file for reading [' . $this->_path . ']'
|
||||
);
|
||||
}
|
||||
if ($this->_offset <> 0)
|
||||
{
|
||||
if ($this->_offset <> 0) {
|
||||
$this->_getReadStreamSeekableStatus();
|
||||
$this->_seekReadStreamToPosition($this->_offset);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_reader;
|
||||
}
|
||||
|
||||
/** Get the resource for writing */
|
||||
private function _getWriteHandle()
|
||||
{
|
||||
if (!isset($this->_writer))
|
||||
{
|
||||
if (!$this->_writer = fopen($this->_path, $this->_mode))
|
||||
{
|
||||
if (!isset($this->_writer)) {
|
||||
if (!$this->_writer = fopen($this->_path, $this->_mode)) {
|
||||
throw new Swift_IoException(
|
||||
'Unable to open file for writing [' . $this->_path . ']'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_writer;
|
||||
}
|
||||
|
||||
/** Force a reload of the resource for reading */
|
||||
private function _resetReadHandle()
|
||||
{
|
||||
if (isset($this->_reader))
|
||||
{
|
||||
if (isset($this->_reader)) {
|
||||
fclose($this->_reader);
|
||||
$this->_reader = null;
|
||||
}
|
||||
@ -182,17 +169,15 @@ class Swift_ByteStream_FileByteStream
|
||||
/** Streams in a readOnly stream ensuring copy if needed */
|
||||
private function _seekReadStreamToPosition($offset)
|
||||
{
|
||||
if ($this->_seekable===null)
|
||||
{
|
||||
if ($this->_seekable===null) {
|
||||
$this->_getReadStreamSeekableStatus();
|
||||
}
|
||||
if ($this->_seekable === false)
|
||||
{
|
||||
if ($this->_seekable === false) {
|
||||
$currentPos = ftell($this->_reader);
|
||||
if ($currentPos<$offset)
|
||||
{
|
||||
if ($currentPos<$offset) {
|
||||
$toDiscard = $offset-$currentPos;
|
||||
fread($this->_reader, $toDiscard);
|
||||
|
||||
return;
|
||||
}
|
||||
$this->_copyReadStream();
|
||||
@ -203,28 +188,21 @@ class Swift_ByteStream_FileByteStream
|
||||
/** Copy a readOnly Stream to ensure seekability */
|
||||
private function _copyReadStream()
|
||||
{
|
||||
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b'))
|
||||
{
|
||||
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {
|
||||
/* We have opened a php:// Stream Should work without problem */
|
||||
}
|
||||
elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile()))
|
||||
{
|
||||
} elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
|
||||
/* We have opened a tmpfile */
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');
|
||||
}
|
||||
$currentPos = ftell($this->_reader);
|
||||
fclose($this->_reader);
|
||||
$source = fopen($this->_path, 'rb');
|
||||
if (!$source)
|
||||
{
|
||||
if (!$source) {
|
||||
throw new Swift_IoException('Unable to open file for copying [' . $this->_path . ']');
|
||||
}
|
||||
fseek($tmpFile, 0, SEEK_SET);
|
||||
while (!feof($source))
|
||||
{
|
||||
while (!feof($source)) {
|
||||
fwrite($tmpFile, fread($source, 4096));
|
||||
}
|
||||
fseek($tmpFile, $currentPos, SEEK_SET);
|
||||
|
@ -56,5 +56,4 @@ interface Swift_CharacterReader
|
||||
* @return int
|
||||
*/
|
||||
public function getInitialByteSize();
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Provides fixed-width byte sizes for reading fixed-width character sets.
|
||||
* @package Swift
|
||||
@ -16,8 +15,7 @@
|
||||
* @author Chris Corbyn
|
||||
* @author Xavier De Cock <xdecock@gmail.com>
|
||||
*/
|
||||
class Swift_CharacterReader_GenericFixedWidthReader
|
||||
implements Swift_CharacterReader
|
||||
class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader
|
||||
{
|
||||
/**
|
||||
* The number of bytes in a single character.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user