Migrated to Symfony flex

This commit is contained in:
Timothy Warren 2017-11-30 15:06:13 -05:00
parent c9b5569316
commit f871f5a29e
137 changed files with 4716 additions and 6372 deletions

29
.editorconfig Normal file
View File

@ -0,0 +1,29 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
[*.{js,css,php,html}]
charset = utf-8
indent_style = tab
indent_size = 4
# Indentation override
[*.{html,js}]
indent_size = 2
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

15
.env.dist Normal file
View File

@ -0,0 +1,15 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=bad868cd8c866d03635e6131f3feace6
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
###< doctrine/doctrine-bundle ###

23
.gitignore vendored
View File

@ -1,18 +1,7 @@
/.web-server-pid
/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
###> symfony/framework-bundle ###
.env
/public/bundles/
/var/
/vendor/
/web/bundles/
/**/*.php~
###< symfony/framework-bundle ###

View File

@ -1,7 +0,0 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>

View File

@ -1,7 +0,0 @@
<?php
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
class AppCache extends HttpCache
{
}

View File

@ -1,55 +0,0 @@
<?php
use CameraBundle\CameraBundle;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
//new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new CameraBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
//$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}

View File

@ -1,69 +0,0 @@
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
framework:
#esi: ~
#translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
router:
resource: '%kernel.project_dir%/app/config/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
trusted_hosts: ~
session:
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
fragments: ~
http_method_override: true
assets: ~
php_errors:
log: true
# Twig Configuration
twig:
debug: '%kernel.debug%'
form_themes:
- 'foundation_5_layout.html.twig'
strict_variables: '%kernel.debug%'
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_pgsql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.project_dir%/var/data/data.sqlite'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: '%database_path%'
types:
money: CameraBundle\Types\MoneyType
mapping_types:
bit: boolean
money: money
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true

View File

@ -1,41 +0,0 @@
imports:
- { resource: config.yml }
framework:
router:
resource: '%kernel.project_dir%/app/config/routing_dev.yml'
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
channels: ['!event']
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
# To follow logs in real time, execute the following command:
# `bin/console server:log -vv`
server_log:
type: server_log
process_psr_3_messages: false
host: 127.0.0.1:9911
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
#swiftmailer:
# delivery_addresses: ['me@example.com']

View File

@ -1,16 +0,0 @@
imports:
- { resource: config_dev.yml }
framework:
test: ~
session:
storage_id: session.storage.mock_file
profiler:
collect: false
web_profiler:
toolbar: false
intercept_redirects: false
swiftmailer:
disable_delivery: true

View File

@ -1,19 +0,0 @@
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
# You should uncomment this if you want to use pdo_sqlite
#database_path: '%kernel.project_dir%/var/data/data.sqlite'
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt

View File

@ -1,14 +0,0 @@
_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
_main:
resource: routing.yml

View File

@ -1,24 +0,0 @@
# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
in_memory:
memory: ~
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~
# https://symfony.com/doc/current/security/form_login_setup.html
#form_login: ~

View File

@ -1,27 +1,39 @@
#!/usr/bin/env php
<?php
use CameraBundle\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
use Symfony\Component\Dotenv\Dotenv;
set_time_limit(0);
require __DIR__.'/../vendor/autoload.php';
$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
if ($debug) {
Debug::enable();
if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
$kernel = new AppKernel($env, $debug);
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);
if ($debug) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

View File

@ -1,146 +0,0 @@
#!/usr/bin/env php
<?php
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
$lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo_title('Symfony Requirements Checker');
echo '> PHP is using the following php.ini file:'.PHP_EOL;
if ($iniPath) {
echo_style('green', ' '.$iniPath);
} else {
echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!');
}
echo PHP_EOL.PHP_EOL;
echo '> Checking Symfony requirements:'.PHP_EOL.' ';
$messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) {
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('red', 'E');
$messages['error'][] = $helpText;
} else {
echo_style('green', '.');
}
}
$checkPassed = empty($messages['error']);
foreach ($symfonyRequirements->getRecommendations() as $req) {
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('yellow', 'W');
$messages['warning'][] = $helpText;
} else {
echo_style('green', '.');
}
}
if ($checkPassed) {
echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
} else {
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
echo_title('Fix the following mandatory requirements', 'red');
foreach ($messages['error'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
if (!empty($messages['warning'])) {
echo_title('Optional recommendations to improve your setup', 'yellow');
foreach ($messages['warning'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
echo PHP_EOL;
echo_style('title', 'Note');
echo ' The command console could use a different php.ini file'.PHP_EOL;
echo_style('title', '~~~~');
echo ' than the one used with your web server. To be on the'.PHP_EOL;
echo ' safe side, please check the requirements from your web'.PHP_EOL;
echo ' server using the ';
echo_style('yellow', 'web/config.php');
echo ' script.'.PHP_EOL;
echo PHP_EOL;
exit($checkPassed ? 0 : 1);
function get_error_message(Requirement $requirement, $lineSize)
{
if ($requirement->isFulfilled()) {
return;
}
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL;
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL;
return $errorMessage;
}
function echo_title($title, $style = null)
{
$style = $style ?: 'title';
echo PHP_EOL;
echo_style($style, $title.PHP_EOL);
echo_style($style, str_repeat('~', strlen($title)).PHP_EOL);
echo PHP_EOL;
}
function echo_style($style, $message)
{
// ANSI color codes
$styles = array(
'reset' => "\033[0m",
'red' => "\033[31m",
'green' => "\033[32m",
'yellow' => "\033[33m",
'error' => "\033[37;41m",
'success' => "\033[37;42m",
'title' => "\033[34m",
);
$supports = has_color_support();
echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
}
function echo_block($style, $title, $message)
{
$message = ' '.trim($message).' ';
$width = strlen($message);
echo PHP_EOL.PHP_EOL;
echo_style($style, str_repeat(' ', $width));
echo PHP_EOL;
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
echo PHP_EOL;
echo_style($style, $message);
echo PHP_EOL;
echo_style($style, str_repeat(' ', $width));
echo PHP_EOL;
}
function has_color_support()
{
static $support;
if (null === $support) {
if (DIRECTORY_SEPARATOR == '\\') {
$support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
} else {
$support = function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
}
return $support;
}

View File

@ -1,69 +1,60 @@
{
"name": "aviat/camera_crud",
"license": "MIT",
"type": "project",
"description": "Admin CRUD for managing camera collection",
"autoload": {
"psr-4": {
"CameraBundle\\": "src/CameraBundle"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" },
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"license": "proprietary",
"require": {
"php": ">=7.1.0",
"php": "^7.0.8",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/console": "^3.3",
"symfony/form": "^4.0",
"symfony/framework-bundle": "^3.3 || ^4.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.3.10",
"symfony/symfony": "3.3.*",
"twig/twig": "^1.0||^2.0"
"symfony/twig-bundle": "^4.0",
"symfony/yaml": "^3.3",
"twig/twig": "^2.0 || ^3.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
"symfony/flex": "^1.0",
"symfony/dotenv": "^3.3"
},
"config": {
"platform": {
"php": "7.1.0"
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
"autoload": {
"psr-4": {
"CameraBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"CameraBundle\\Tests\\": "tests/"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"branch-alias": {
"dev-master": "3.3-dev"
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*",
"symfony/twig-bundle": "<3.3",
"symfony/debug": "<3.3"
},
"extra": {
"symfony": {
"id": "01C06XCKJ8KKPKS0GJESWVPJFC",
"allow-contrib": false
}
}
}

3425
composer.lock generated

File diff suppressed because it is too large Load Diff

11
config/bundles.php Normal file
View File

@ -0,0 +1,11 @@
<?php
return [
CameraBundle\CameraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
];

View File

@ -0,0 +1,19 @@
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]

View File

@ -0,0 +1,3 @@
framework:
router:
strict_requirements: true

View File

@ -0,0 +1,30 @@
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_pgsql'
types:
money: CameraBundle\Types\MoneyType
mapping_types:
bit: boolean
money: money
# With Symfony 3.3, remove the `resolve:` prefix
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

View File

@ -0,0 +1,16 @@
framework:
secret: '%env(APP_SECRET)%'
#default_locale: en
#csrf_protection: ~
#http_method_override: true
#trusted_hosts: ~
# uncomment this entire section to enable sessions
#session:
# # With this config, PHP's native session handling is used
# handler_id: ~
#esi: ~
#fragments: ~
php_errors:
log: true

View File

@ -0,0 +1,31 @@
doctrine:
orm:
metadata_cache_driver:
type: service
id: doctrine.system_cache_provider
query_cache_driver:
type: service
id: doctrine.system_cache_provider
result_cache_driver:
type: service
id: doctrine.result_cache_provider
services:
doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.result_cache_pool'
doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.system_cache_pool'
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View File

@ -1,22 +1,17 @@
imports:
- { resource: config.yml }
#doctrine:
# orm:
# metadata_cache_driver: apc
# result_cache_driver: apc
# query_cache_driver: apc
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_404s:
# regex: exclude all 404 errors from the logs
- ^/
nested:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]

View File

@ -0,0 +1,3 @@
framework:
router:
strict_requirements: ~

View File

@ -0,0 +1,4 @@
framework:
test: ~
#session:
# storage_id: session.storage.mock_file

View File

@ -0,0 +1,4 @@
twig:
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

3
config/routes-orig.yaml Normal file
View File

@ -0,0 +1,3 @@
#index:
# path: /
# defaults: { _controller: 'App\Controller\DefaultController::index' }

View File

@ -0,0 +1,3 @@
controllers:
resource: ../src/Controller/
type: annotation

View File

@ -0,0 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

27
config/services-orig.yaml Normal file
View File

@ -0,0 +1,27 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
CameraBundle\:
resource: '../src/*'
exclude: '../src/{Entity,Migrations,Tests}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
CameraBundle\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

View File

@ -17,15 +17,15 @@ services:
# makes classes in src/CameraBundle available to be used as services
# this creates a service per class whose id is the fully-qualified class name
CameraBundle\:
resource: '../../src/CameraBundle/*'
resource: '../src/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../../src/CameraBundle/{Entity,Repository,Tests}'
exclude: '../src/{Entity,Repository,Tests}'
# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
CameraBundle\Controller\:
resource: '../../src/CameraBundle/Controller'
resource: '../src/Controller'
public: true
tags: ['controller.service_arguments']

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_CLASS" value="AppKernel" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
<exclude>
<directory>src/*Bundle/Resources</directory>
<directory>src/*/*Bundle/Resources</directory>
<directory>src/*/Bundle/*Bundle/Resources</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

30
public/index.php Normal file
View File

@ -0,0 +1,30 @@
<?php
use CameraBundle\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
umask(0000);
Debug::enable();
}
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

View File

@ -1,7 +0,0 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>

View File

@ -1,141 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Camera;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
/**
* Camera controller.
*
* @Route("camera")
*/
class CameraController extends Controller
{
/**
* Lists all camera entities.
*
* @Route("/", name="camera_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$cameras = $em->getRepository('CameraBundle:Camera')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
return $this->render('camera/index.html.twig', array(
'cameras' => $cameras,
));
}
/**
* Creates a new camera entity.
*
* @Route("/new", name="camera_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$camera = new Camera();
$form = $this->createForm('CameraBundle\Form\CameraType', $camera);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($camera);
$em->flush();
return $this->redirectToRoute('camera_show', array('id' => $camera->getId()));
}
return $this->render('camera/new.html.twig', array(
'camera' => $camera,
'form' => $form->createView(),
));
}
/**
* Finds and displays a camera entity.
*
* @Route("/{id}", name="camera_show")
* @Method("GET")
*/
public function showAction(Camera $camera)
{
$deleteForm = $this->createDeleteForm($camera);
return $this->render('camera/show.html.twig', array(
'camera' => $camera,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing camera entity.
*
* @Route("/{id}/edit", name="camera_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Camera $camera)
{
$deleteForm = $this->createDeleteForm($camera);
$editForm = $this->createForm('CameraBundle\Form\CameraType', $camera);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('camera_edit', array('id' => $camera->getId()));
}
return $this->render('camera/edit.html.twig', array(
'camera' => $camera,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a camera entity.
*
* @Route("/{id}", name="camera_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Camera $camera)
{
$form = $this->createDeleteForm($camera);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($camera);
$em->flush();
}
return $this->redirectToRoute('camera_index');
}
/**
* Creates a form to delete a camera entity.
*
* @param Camera $camera The camera entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Camera $camera)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('camera_delete', array('id' => $camera->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View File

@ -1,138 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\CameraType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
/**
* Cameratype controller.
*
* @Route("camera-type")
*/
class CameraTypeController extends Controller
{
/**
* Lists all cameraType entities.
*
* @Route("/", name="camera-type_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$cameraTypes = $em->getRepository('CameraBundle:CameraType')->findBy([], [
'type' => 'ASC'
]);
return $this->render('cameratype/index.html.twig', array(
'cameraTypes' => $cameraTypes,
));
}
/**
* Creates a new cameraType entity.
*
* @Route("/new", name="camera-type_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$cameraType = new Cameratype();
$form = $this->createForm('CameraBundle\Form\CameraTypeType', $cameraType);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($cameraType);
$em->flush();
return $this->redirectToRoute('camera-type_show', array('id' => $cameraType->getId()));
}
return $this->render('cameratype/new.html.twig', array(
'cameraType' => $cameraType,
'form' => $form->createView(),
));
}
/**
* Finds and displays a cameraType entity.
*
* @Route("/{id}", name="camera-type_show")
* @Method("GET")
*/
public function showAction(CameraType $cameraType)
{
$deleteForm = $this->createDeleteForm($cameraType);
return $this->render('cameratype/show.html.twig', array(
'cameraType' => $cameraType,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing cameraType entity.
*
* @Route("/{id}/edit", name="camera-type_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, CameraType $cameraType)
{
$deleteForm = $this->createDeleteForm($cameraType);
$editForm = $this->createForm('CameraBundle\Form\CameraTypeType', $cameraType);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('camera-type_edit', array('id' => $cameraType->getId()));
}
return $this->render('cameratype/edit.html.twig', array(
'cameraType' => $cameraType,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a cameraType entity.
*
* @Route("/{id}", name="camera-type_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, CameraType $cameraType)
{
$form = $this->createDeleteForm($cameraType);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($cameraType);
$em->flush();
}
return $this->redirectToRoute('camera-type_index');
}
/**
* Creates a form to delete a cameraType entity.
*
* @param CameraType $cameraType The cameraType entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(CameraType $cameraType)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('camera-type_delete', array('id' => $cameraType->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace CameraBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
]);
}
}

View File

@ -1,140 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Flash;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
/**
* Flash controller.
*
* @Route("flash")
*/
class FlashController extends Controller
{
/**
* Lists all flash entities.
*
* @Route("/", name="flash_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$flashes = $em->getRepository('CameraBundle:Flash')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'model' => 'ASC'
]);
return $this->render('flash/index.html.twig', array(
'flashes' => $flashes,
));
}
/**
* Creates a new flash entity.
*
* @Route("/new", name="flash_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$flash = new Flash();
$form = $this->createForm('CameraBundle\Form\FlashType', $flash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($flash);
$em->flush();
return $this->redirectToRoute('flash_show', array('id' => $flash->getId()));
}
return $this->render('flash/new.html.twig', array(
'flash' => $flash,
'form' => $form->createView(),
));
}
/**
* Finds and displays a flash entity.
*
* @Route("/{id}", name="flash_show")
* @Method("GET")
*/
public function showAction(Flash $flash)
{
$deleteForm = $this->createDeleteForm($flash);
return $this->render('flash/show.html.twig', array(
'flash' => $flash,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing flash entity.
*
* @Route("/{id}/edit", name="flash_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Flash $flash)
{
$deleteForm = $this->createDeleteForm($flash);
$editForm = $this->createForm('CameraBundle\Form\FlashType', $flash);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('flash_edit', array('id' => $flash->getId()));
}
return $this->render('flash/edit.html.twig', array(
'flash' => $flash,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a flash entity.
*
* @Route("/{id}", name="flash_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Flash $flash)
{
$form = $this->createDeleteForm($flash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($flash);
$em->flush();
}
return $this->redirectToRoute('flash_index');
}
/**
* Creates a form to delete a flash entity.
*
* @param Flash $flash The flash entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Flash $flash)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('flash_delete', array('id' => $flash->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View File

@ -1,143 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Lenses;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
/**
* Lense controller.
*
* @Route("lens")
*/
class LensesController extends Controller
{
/**
* Lists all lense entities.
*
* @Route("/", name="lens_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$lenses = $em->getRepository('CameraBundle:Lenses')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
return $this->render('lenses/index.html.twig', array(
'lenses' => $lenses,
));
}
/**
* Creates a new lense entity.
*
* @Route("/new", name="lens_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$lense = new Lenses();
$form = $this->createForm('CameraBundle\Form\LensesType', $lense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($lense);
$em->flush();
return $this->redirectToRoute('lens_show', array('id' => $lense->getId()));
}
return $this->render('lenses/new.html.twig', array(
'lense' => $lense,
'form' => $form->createView(),
));
}
/**
* Finds and displays a lense entity.
*
* @Route("/{id}", name="lens_show")
* @Method("GET")
*/
public function showAction(Lenses $lense)
{
$deleteForm = $this->createDeleteForm($lense);
return $this->render('lenses/show.html.twig', array(
'lense' => $lense,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing lense entity.
*
* @Route("/{id}/edit", name="lens_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Lenses $lense)
{
$deleteForm = $this->createDeleteForm($lense);
$editForm = $this->createForm('CameraBundle\Form\LensesType', $lense);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('lens_edit', array('id' => $lense->getId()));
}
return $this->render('lenses/edit.html.twig', array(
'lense' => $lense,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a lense entity.
*
* @Route("/{id}", name="lens_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Lenses $lense)
{
$form = $this->createDeleteForm($lense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($lense);
$em->flush();
}
return $this->redirectToRoute('lens_index');
}
/**
* Creates a form to delete a lense entity.
*
* @param Lenses $lense The lense entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Lenses $lense)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('lens_delete', array('id' => $lense->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View File

@ -1,74 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedCamera;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedcamera controller.
*
* @Route("previously-owned-camera")
*/
class PreviouslyOwnedCameraController extends Controller
{
/**
* Lists all previouslyOwnedCamera entities.
*
* @Route("/", name="previously-owned-camera_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedCameras = $em->getRepository('CameraBundle:PreviouslyOwnedCamera')->findBy([], [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
return $this->render('previouslyownedcamera/index.html.twig', array(
'previouslyOwnedCameras' => $previouslyOwnedCameras,
));
}
/**
* Finds and displays a previouslyOwnedCamera entity.
*
* @Route("/{id}", name="previously-owned-camera_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera)
{
return $this->render('previouslyownedcamera/show.html.twig', array(
'previouslyOwnedCamera' => $previouslyOwnedCamera,
));
}
/**
* Displays a form to edit an existing previouslyOwnedCamera entity.
*
* @Route("/{id}/edit", name="previously-owned-camera_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedCameraType', $previouslyOwnedCamera);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-camera_edit', array('id' => $previouslyOwnedCamera->getId()));
}
return $this->render('previouslyownedcamera/edit.html.twig', array(
'previouslyOwnedCamera' => $previouslyOwnedCamera,
'edit_form' => $editForm->createView(),
));
}
}

View File

@ -1,99 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedFlash;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedflash controller.
*
* @Route("previously-owned-flash")
*/
class PreviouslyOwnedFlashController extends Controller
{
/**
* Lists all previouslyOwnedFlash entities.
*
* @Route("/", name="previously-owned-flash_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedFlashes = $em->getRepository('CameraBundle:PreviouslyOwnedFlash')->findBy([], [
'brand' => 'ASC',
'model' => 'ASC'
]);
return $this->render('previouslyownedflash/index.html.twig', array(
'previouslyOwnedFlashes' => $previouslyOwnedFlashes,
));
}
/**
* Creates a new previouslyOwnedFlash entity.
*
* @Route("/new", name="previously-owned-flash_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$previouslyOwnedFlash = new Previouslyownedflash();
$form = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($previouslyOwnedFlash);
$em->flush();
return $this->redirectToRoute('previously-owned-flash_show', array('id' => $previouslyOwnedFlash->getId()));
}
return $this->render('previouslyownedflash/new.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash,
'form' => $form->createView(),
));
}
/**
* Finds and displays a previouslyOwnedFlash entity.
*
* @Route("/{id}", name="previously-owned-flash_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash)
{
return $this->render('previouslyownedflash/show.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash
));
}
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*
* @Route("/{id}/edit", name="previously-owned-flash_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-flash_edit', array('id' => $previouslyOwnedFlash->getId()));
}
return $this->render('previouslyownedflash/edit.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash,
'edit_form' => $editForm->createView(),
));
}
}

View File

@ -1,76 +0,0 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedLenses;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedlense controller.
*
* @Route("previously-owned-lens")
*/
class PreviouslyOwnedLensesController extends Controller
{
/**
* Lists all previouslyOwnedLense entities.
*
* @Route("/", name="previously-owned-lens_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedLenses = $em->getRepository('CameraBundle:PreviouslyOwnedLenses')->findBy([], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
return $this->render('previouslyownedlenses/index.html.twig', array(
'previouslyOwnedLenses' => $previouslyOwnedLenses,
));
}
/**
* Finds and displays a previouslyOwnedLense entity.
*
* @Route("/{id}", name="previously-owned-lens_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLense)
{
return $this->render('previouslyownedlenses/show.html.twig', array(
'previouslyOwnedLense' => $previouslyOwnedLense,
));
}
/**
* Displays a form to edit an existing previouslyOwnedLense entity.
*
* @Route("/{id}/edit", name="previously-owned-lens_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLense)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedLensesType', $previouslyOwnedLense);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-lens_edit', array('id' => $previouslyOwnedLense->getId()));
}
return $this->render('previouslyownedlenses/edit.html.twig', array(
'previouslyOwnedLense' => $previouslyOwnedLense,
'edit_form' => $editForm->createView(),
));
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Battery Type
*
* @ORM\Table(name="battery_type", schema="camera")
* @ORM\Entity
*/
class BatteryType
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
}

View File

@ -1,29 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera
*
* @ORM\Table(name="camera", schema="camera", indexes={
@ORM\Index(name="IDX_747C826FC54C8C93", columns={"type_id"})
})
* @ORM\Entity
*/
class Camera
{
use CameraTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
}

View File

@ -1,431 +0,0 @@
<?php
namespace CameraBundle\Entity;
trait CameraTrait {
use PurchasePriceTrait;
/**
* @var \CameraType
*
* @ORM\ManyToOne(targetEntity="CameraType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=false)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="mount", type="string", length=32, nullable=false)
*/
private $mount;
/**
* @var string
*
* @ORM\Column(name="model", type="string", length=255, nullable=false)
*/
private $model;
/**
* @var boolean
*
* @ORM\Column(name="is_digital", type="boolean", nullable=false)
*/
private $isDigital;
/**
* @var string
*
* @ORM\Column(name="crop_factor", type="decimal", precision=10, scale=0, nullable=false)
*/
private $cropFactor = '1.0';
/**
* @var boolean
*
* @ORM\Column(name="is_working", type="boolean", nullable=false)
*/
private $isWorking;
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", length=20, nullable=false)
*/
private $serial;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = false;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="battery_type", type="string", nullable=true)
*/
private $batteryType;
/**
* @var string
*
* @ORM\Column(name="film_format", type="string", nullable=true)
*/
private $filmFormat = '135';
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=true)
*/
private $received = false;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set type
*
* @param \CameraBundle\Entity\CameraType $type
*
* @return Camera
*/
public function setType(\CameraBundle\Entity\CameraType $type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return \CameraBundle\Entity\CameraType
*/
public function getType()
{
return $this->type;
}
/**
* Set brand
*
* @param string $brand
*
* @return Camera
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set mount
*
* @param string $mount
*
* @return Camera
*/
public function setMount($mount)
{
$this->mount = $mount;
return $this;
}
/**
* Get mount
*
* @return string
*/
public function getMount()
{
return $this->mount;
}
/**
* Set model
*
* @param string $model
*
* @return Camera
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set isDigital
*
* @param boolean $isDigital
*
* @return Camera
*/
public function setIsDigital($isDigital)
{
$this->isDigital = $isDigital;
return $this;
}
/**
* Get isDigital
*
* @return boolean
*/
public function getIsDigital()
{
return $this->isDigital;
}
/**
* Set cropFactor
*
* @param string $cropFactor
*
* @return Camera
*/
public function setCropFactor($cropFactor)
{
$this->cropFactor = $cropFactor;
return $this;
}
/**
* Get cropFactor
*
* @return string
*/
public function getCropFactor()
{
return $this->cropFactor;
}
/**
* Set isWorking
*
* @param boolean $isWorking
*
* @return Camera
*/
public function setIsWorking($isWorking)
{
$this->isWorking = $isWorking;
return $this;
}
/**
* Get isWorking
*
* @return boolean
*/
public function getIsWorking()
{
return $this->isWorking;
}
/**
* Set notes
*
* @param string $notes
*
* @return Camera
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set serial
*
* @param string $serial
*
* @return Camera
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Camera
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set batteryType
*
* @param string $batteryType
*
* @return Camera
*/
public function setBatteryType($batteryType)
{
$this->batteryType = $batteryType;
return $this;
}
/**
* Get batteryType
*
* @return string
*/
public function getBatteryType()
{
return $this->batteryType;
}
/**
* Set filmFormat
*
* @param string $filmFormat
*
* @return Camera
*/
public function setFilmFormat($filmFormat)
{
$this->filmFormat = $filmFormat;
return $this;
}
/**
* Get filmFormat
*
* @return string
*/
public function getFilmFormat()
{
return $this->filmFormat;
}
/**
* Set received
*
* @param boolean $received
*
* @return Camera
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
}

View File

@ -1,78 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* CameraType
*
* @ORM\Table(name="camera_type", schema="camera")
* @ORM\Entity
*/
class CameraType
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255, nullable=false)
*/
private $type;
/**
* Value for serialization
*
* @return string
*/
public function __toString()
{
return $this->type;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set type
*
* @param string $type
*
* @return CameraType
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="flash", schema="camera")
* @ORM\Entity
*/
class Flash
{
use FlashTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.flash_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : false})
*/
private $received = false;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : false})
*/
private $formerlyOwned = false;
}

View File

@ -1,413 +0,0 @@
<?php
namespace CameraBundle\Entity;
trait FlashTrait {
use PurchasePriceTrait;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="model", type="string", nullable=false)
*/
private $model;
/**
* @var boolean
*
* @ORM\Column(name="is_auto_flash", type="boolean", nullable=false)
*/
private $isAutoFlash = false;
/**
* @var boolean
*
* @ORM\Column(name="is_ttl", type="boolean", nullable=false)
*/
private $isTtl = false;
/**
* @var string
*
* @ORM\Column(name="ttl_type", type="string", nullable=false)
*/
private $ttlType = 'N / A';
/**
* @var boolean
*
* @ORM\Column(name="is_p_ttl", type="boolean", nullable=false)
*/
private $isPTtl = false;
/**
* @var string
*
* @ORM\Column(name="p_ttl_type", type="string", nullable=false)
*/
private $pTtlType = 'N / A';
/**
* @var string
*
* @ORM\Column(name="guide_number", type="string", nullable=true)
*/
private $guideNumber;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="batteries", type="string", nullable=false)
*/
private $batteries = '4x AA';
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", nullable=true)
*/
private $serial;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set brand
*
* @param string $brand
*
* @return Flash
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set model
*
* @param string $model
*
* @return Flash
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set isAutoFlash
*
* @param boolean $isAutoFlash
*
* @return Flash
*/
public function setIsAutoFlash($isAutoFlash)
{
$this->isAutoFlash = $isAutoFlash;
return $this;
}
/**
* Get isAutoFlash
*
* @return boolean
*/
public function getIsAutoFlash()
{
return $this->isAutoFlash;
}
/**
* Set isTtl
*
* @param boolean $isTtl
*
* @return Flash
*/
public function setIsTtl($isTtl)
{
$this->isTtl = $isTtl;
return $this;
}
/**
* Get isTtl
*
* @return boolean
*/
public function getIsTtl()
{
return $this->isTtl;
}
/**
* Set ttlType
*
* @param string $ttlType
*
* @return Flash
*/
public function setTtlType($ttlType)
{
$this->ttlType = $ttlType;
return $this;
}
/**
* Get ttlType
*
* @return string
*/
public function getTtlType()
{
return $this->ttlType;
}
/**
* Set isPTtl
*
* @param boolean $isPTtl
*
* @return Flash
*/
public function setIsPTtl($isPTtl)
{
$this->isPTtl = $isPTtl;
return $this;
}
/**
* Get isPTtl
*
* @return boolean
*/
public function getIsPTtl()
{
return $this->isPTtl;
}
/**
* Set pTtlType
*
* @param string $pTtlType
*
* @return Flash
*/
public function setPTtlType($pTtlType)
{
$this->pTtlType = $pTtlType;
return $this;
}
/**
* Get pTtlType
*
* @return string
*/
public function getPTtlType()
{
return $this->pTtlType;
}
/**
* Set guideNumber
*
* @param string $guideNumber
*
* @return Flash
*/
public function setGuideNumber($guideNumber)
{
$this->guideNumber = $guideNumber;
return $this;
}
/**
* Get guideNumber
*
* @return string
*/
public function getGuideNumber()
{
return $this->guideNumber;
}
/**
* Set batteries
*
* @param string $batteries
*
* @return Flash
*/
public function setBatteries($batteries)
{
$this->batteries = $batteries;
return $this;
}
/**
* Get batteries
*
* @return string
*/
public function getBatteries()
{
return $this->batteries;
}
/**
* Set notes
*
* @param string $notes
*
* @return Flash
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set serial
*
* @param string $serial
*
* @return Flash
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Flash
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set received
*
* @param boolean $received
*
* @return Flash
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
}

View File

@ -1,601 +0,0 @@
<?php
namespace CameraBundle\Entity;
trait LensTrait {
use PurchasePriceTrait;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=true)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="coatings", type="string", length=64, nullable=true)
*/
private $coatings;
/**
* @var string
*
* @ORM\Column(name="product_line", type="string", length=64, nullable=true)
*/
private $productLine;
/**
* @var string
*
* @ORM\Column(name="model", type="string", length=64, nullable=true)
*/
private $model;
/**
* @var string
*
* @ORM\Column(name="min_f_stop", type="string", length=10, nullable=true)
*/
private $minFStop;
/**
* @var float
*
* @ORM\Column(name="max_f_stop", type="float", precision=10, scale=0, nullable=true)
*/
private $maxFStop;
/**
* @var integer
*
* @ORM\Column(name="min_focal_length", type="integer", nullable=true)
*/
private $minFocalLength;
/**
* @var integer
*
* @ORM\Column(name="max_focal_length", type="integer", nullable=true)
*/
private $maxFocalLength;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", length=10, nullable=true)
*/
private $serial;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="mount", type="string", length=40, nullable=true)
*/
private $mount;
/**
* @var string
*
* @ORM\Column(name="front_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/
private $frontFilterSize;
/**
* @var string
*
* @ORM\Column(name="rear_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/
private $rearFilterSize;
/**
* @var boolean
*
* @ORM\Column(name="is_teleconverter", type="boolean", nullable=false)
*/
private $isTeleconverter = false;
/**
* @var integer
*
* @ORM\Column(name="design_elements", type="smallint", nullable=true)
*/
private $designElements;
/**
* @var integer
*
* @ORM\Column(name="design_groups", type="smallint", nullable=true)
*/
private $designGroups;
/**
* @var integer
*
* @ORM\Column(name="aperture_blades", type="smallint", nullable=true)
*/
private $apertureBlades;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set brand
*
* @param string $brand
*
* @return Lenses
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set coatings
*
* @param string $coatings
*
* @return Lenses
*/
public function setCoatings($coatings)
{
$this->coatings = $coatings;
return $this;
}
/**
* Get coatings
*
* @return string
*/
public function getCoatings()
{
return $this->coatings;
}
/**
* Set productLine
*
* @param string $productLine
*
* @return Lenses
*/
public function setProductLine($productLine)
{
$this->productLine = $productLine;
return $this;
}
/**
* Get productLine
*
* @return string
*/
public function getProductLine()
{
return $this->productLine;
}
/**
* Set model
*
* @param string $model
*
* @return Lenses
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set minFStop
*
* @param string $minFStop
*
* @return Lenses
*/
public function setMinFStop($minFStop)
{
$this->minFStop = $minFStop;
return $this;
}
/**
* Get minFStop
*
* @return string
*/
public function getMinFStop()
{
return $this->minFStop;
}
/**
* Set maxFStop
*
* @param float $maxFStop
*
* @return Lenses
*/
public function setMaxFStop($maxFStop)
{
$this->maxFStop = $maxFStop;
return $this;
}
/**
* Get maxFStop
*
* @return float
*/
public function getMaxFStop()
{
return $this->maxFStop;
}
/**
* Set minFocalLength
*
* @param integer $minFocalLength
*
* @return Lenses
*/
public function setMinFocalLength($minFocalLength)
{
$this->minFocalLength = $minFocalLength;
return $this;
}
/**
* Get minFocalLength
*
* @return integer
*/
public function getMinFocalLength()
{
return $this->minFocalLength;
}
/**
* Set maxFocalLength
*
* @param integer $maxFocalLength
*
* @return Lenses
*/
public function setMaxFocalLength($maxFocalLength)
{
$this->maxFocalLength = $maxFocalLength;
return $this;
}
/**
* Get maxFocalLength
*
* @return integer
*/
public function getMaxFocalLength()
{
return $this->maxFocalLength;
}
/**
* Set serial
*
* @param string $serial
*
* @return Lenses
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set notes
*
* @param string $notes
*
* @return Lenses
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set mount
*
* @param string $mount
*
* @return Lenses
*/
public function setMount($mount)
{
$this->mount = $mount;
return $this;
}
/**
* Get mount
*
* @return string
*/
public function getMount()
{
return $this->mount;
}
/**
* Set received
*
* @param boolean $received
*
* @return Lenses
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Lenses
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set frontFilterSize
*
* @param string $frontFilterSize
*
* @return Lenses
*/
public function setFrontFilterSize($frontFilterSize)
{
$this->frontFilterSize = $frontFilterSize;
return $this;
}
/**
* Get frontFilterSize
*
* @return string
*/
public function getFrontFilterSize()
{
return $this->frontFilterSize;
}
/**
* Set rearFilterSize
*
* @param string $rearFilterSize
*
* @return Lenses
*/
public function setRearFilterSize($rearFilterSize)
{
$this->rearFilterSize = $rearFilterSize;
return $this;
}
/**
* Get rearFilterSize
*
* @return string
*/
public function getRearFilterSize()
{
return $this->rearFilterSize;
}
/**
* Set isTeleconverter
*
* @param boolean $isTeleconverter
*
* @return Lenses
*/
public function setIsTeleconverter($isTeleconverter)
{
$this->isTeleconverter = $isTeleconverter;
return $this;
}
/**
* Get isTeleconverter
*
* @return boolean
*/
public function getIsTeleconverter()
{
return $this->isTeleconverter;
}
/**
* Set designElements
*
* @param integer $designElements
*
* @return Lenses
*/
public function setDesignElements($designElements)
{
$this->designElements = $designElements;
return $this;
}
/**
* Get designElements
*
* @return integer
*/
public function getDesignElements()
{
return $this->designElements;
}
/**
* Set designGroups
*
* @param integer $designGroups
*
* @return Lenses
*/
public function setDesignGroups($designGroups)
{
$this->designGroups = $designGroups;
return $this;
}
/**
* Get designGroups
*
* @return integer
*/
public function getDesignGroups()
{
return $this->designGroups;
}
/**
* Set apertureBlades
*
* @param integer $apertureBlades
*
* @return Lenses
*/
public function setApertureBlades($apertureBlades)
{
$this->apertureBlades = $apertureBlades;
return $this;
}
/**
* Get apertureBlades
*
* @return integer
*/
public function getApertureBlades()
{
return $this->apertureBlades;
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.lenses
*
* @ORM\Table(name="lenses", schema="camera")
* @ORM\Entity
*/
class Lenses
{
use LensTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.lenses_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
private $received = false;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = false;
}

View File

@ -1,41 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="previously_owned_flash", schema="camera")
* @ORM\Entity
*/
class PreviouslyOwnedFlash
{
use FlashTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_flash_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : true})
*/
private $received = true;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : true})
*/
private $formerlyOwned = true;
}

View File

@ -1,39 +0,0 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.previouslyOwnedLenses
*
* @ORM\Table(name="previously_owned_lenses", schema="camera")
* @ORM\Entity
*/
class PreviouslyOwnedLenses
{
use LensTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_lenses_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
private $received = true;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = true;
}

View File

@ -1,33 +0,0 @@
<?php
namespace CameraBundle\Entity;
trait PurchasePriceTrait {
/**
* Set purchasePrice
*
* @param string $purchasePrice
*
* @return Camera
*/
public function setPurchasePrice($purchasePrice)
{
$this->purchasePrice = $purchasePrice;
return $this;
}
/**
* Get purchasePrice
*
* @return string
*/
public function getPurchasePrice()
{
if (empty($this->purchasePrice)) {
return 0;
}
return $this->purchasePrice;
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Camera;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Camera controller.
*
* @Route("camera")
*/
class CameraController extends Controller
{
/**
* Lists all camera entities.
*
* @Route("/", name="camera_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$cameras = $em->getRepository('CameraBundle:Camera')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
return $this->render('camera/index.html.twig', array(
'cameras' => $cameras,
));
}
/**
* Creates a new camera entity.
*
* @Route("/new", name="camera_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$camera = new Camera();
$form = $this->createForm('CameraBundle\Form\CameraType', $camera);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($camera);
$em->flush();
return $this->redirectToRoute('camera_show', array('id' => $camera->getId()));
}
return $this->render('camera/new.html.twig', array(
'camera' => $camera,
'form' => $form->createView(),
));
}
/**
* Finds and displays a camera entity.
*
* @Route("/{id}", name="camera_show")
* @Method("GET")
*/
public function showAction(Camera $camera)
{
$deleteForm = $this->createDeleteForm($camera);
return $this->render('camera/show.html.twig', array(
'camera' => $camera,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing camera entity.
*
* @Route("/{id}/edit", name="camera_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Camera $camera)
{
$deleteForm = $this->createDeleteForm($camera);
$editForm = $this->createForm('CameraBundle\Form\CameraType', $camera);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('camera_edit', array('id' => $camera->getId()));
}
return $this->render('camera/edit.html.twig', array(
'camera' => $camera,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a camera entity.
*
* @Route("/{id}", name="camera_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Camera $camera)
{
$form = $this->createDeleteForm($camera);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($camera);
$em->flush();
}
return $this->redirectToRoute('camera_index');
}
/**
* Creates a form to delete a camera entity.
*
* @param Camera $camera The camera entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Camera $camera)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('camera_delete', array('id' => $camera->getId())))
->setMethod('DELETE')
->getForm();
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\CameraType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Cameratype controller.
*
* @Route("camera-type")
*/
class CameraTypeController extends Controller
{
/**
* Lists all cameraType entities.
*
* @Route("/", name="camera-type_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$cameraTypes = $em->getRepository('CameraBundle:CameraType')->findBy([], [
'type' => 'ASC'
]);
return $this->render('cameratype/index.html.twig', array(
'cameraTypes' => $cameraTypes,
));
}
/**
* Creates a new cameraType entity.
*
* @Route("/new", name="camera-type_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$cameraType = new Cameratype();
$form = $this->createForm('CameraBundle\Form\CameraTypeType', $cameraType);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($cameraType);
$em->flush();
return $this->redirectToRoute('camera-type_show', array('id' => $cameraType->getId()));
}
return $this->render('cameratype/new.html.twig', array(
'cameraType' => $cameraType,
'form' => $form->createView(),
));
}
/**
* Finds and displays a cameraType entity.
*
* @Route("/{id}", name="camera-type_show")
* @Method("GET")
*/
public function showAction(CameraType $cameraType)
{
$deleteForm = $this->createDeleteForm($cameraType);
return $this->render('cameratype/show.html.twig', array(
'cameraType' => $cameraType,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing cameraType entity.
*
* @Route("/{id}/edit", name="camera-type_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, CameraType $cameraType)
{
$deleteForm = $this->createDeleteForm($cameraType);
$editForm = $this->createForm('CameraBundle\Form\CameraTypeType', $cameraType);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('camera-type_edit', array('id' => $cameraType->getId()));
}
return $this->render('cameratype/edit.html.twig', array(
'cameraType' => $cameraType,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a cameraType entity.
*
* @Route("/{id}", name="camera-type_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, CameraType $cameraType)
{
$form = $this->createDeleteForm($cameraType);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($cameraType);
$em->flush();
}
return $this->redirectToRoute('camera-type_index');
}
/**
* Creates a form to delete a cameraType entity.
*
* @param CameraType $cameraType The cameraType entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(CameraType $cameraType)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('camera-type_delete', array('id' => $cameraType->getId())))
->setMethod('DELETE')
->getForm();
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace CameraBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
]);
}
}

View File

@ -0,0 +1,140 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Flash;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Flash controller.
*
* @Route("flash")
*/
class FlashController extends Controller
{
/**
* Lists all flash entities.
*
* @Route("/", name="flash_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$flashes = $em->getRepository('CameraBundle:Flash')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'model' => 'ASC'
]);
return $this->render('flash/index.html.twig', array(
'flashes' => $flashes,
));
}
/**
* Creates a new flash entity.
*
* @Route("/new", name="flash_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$flash = new Flash();
$form = $this->createForm('CameraBundle\Form\FlashType', $flash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($flash);
$em->flush();
return $this->redirectToRoute('flash_show', array('id' => $flash->getId()));
}
return $this->render('flash/new.html.twig', array(
'flash' => $flash,
'form' => $form->createView(),
));
}
/**
* Finds and displays a flash entity.
*
* @Route("/{id}", name="flash_show")
* @Method("GET")
*/
public function showAction(Flash $flash)
{
$deleteForm = $this->createDeleteForm($flash);
return $this->render('flash/show.html.twig', array(
'flash' => $flash,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing flash entity.
*
* @Route("/{id}/edit", name="flash_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Flash $flash)
{
$deleteForm = $this->createDeleteForm($flash);
$editForm = $this->createForm('CameraBundle\Form\FlashType', $flash);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('flash_edit', array('id' => $flash->getId()));
}
return $this->render('flash/edit.html.twig', array(
'flash' => $flash,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a flash entity.
*
* @Route("/{id}", name="flash_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Flash $flash)
{
$form = $this->createDeleteForm($flash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($flash);
$em->flush();
}
return $this->redirectToRoute('flash_index');
}
/**
* Creates a form to delete a flash entity.
*
* @param Flash $flash The flash entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Flash $flash)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('flash_delete', array('id' => $flash->getId())))
->setMethod('DELETE')
->getForm();
}
}

View File

@ -0,0 +1,143 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\Lenses;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Lense controller.
*
* @Route("lens")
*/
class LensesController extends Controller
{
/**
* Lists all lense entities.
*
* @Route("/", name="lens_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$lenses = $em->getRepository('CameraBundle:Lenses')->findBy([], [
'received' => 'DESC',
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
return $this->render('lenses/index.html.twig', array(
'lenses' => $lenses,
));
}
/**
* Creates a new lense entity.
*
* @Route("/new", name="lens_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$lense = new Lenses();
$form = $this->createForm('CameraBundle\Form\LensesType', $lense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($lense);
$em->flush();
return $this->redirectToRoute('lens_show', array('id' => $lense->getId()));
}
return $this->render('lenses/new.html.twig', array(
'lense' => $lense,
'form' => $form->createView(),
));
}
/**
* Finds and displays a lense entity.
*
* @Route("/{id}", name="lens_show")
* @Method("GET")
*/
public function showAction(Lenses $lense)
{
$deleteForm = $this->createDeleteForm($lense);
return $this->render('lenses/show.html.twig', array(
'lense' => $lense,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing lense entity.
*
* @Route("/{id}/edit", name="lens_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, Lenses $lense)
{
$deleteForm = $this->createDeleteForm($lense);
$editForm = $this->createForm('CameraBundle\Form\LensesType', $lense);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('lens_edit', array('id' => $lense->getId()));
}
return $this->render('lenses/edit.html.twig', array(
'lense' => $lense,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a lense entity.
*
* @Route("/{id}", name="lens_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, Lenses $lense)
{
$form = $this->createDeleteForm($lense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($lense);
$em->flush();
}
return $this->redirectToRoute('lens_index');
}
/**
* Creates a form to delete a lense entity.
*
* @param Lenses $lense The lense entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Lenses $lense)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('lens_delete', array('id' => $lense->getId())))
->setMethod('DELETE')
->getForm();
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedCamera;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedcamera controller.
*
* @Route("previously-owned-camera")
*/
class PreviouslyOwnedCameraController extends Controller
{
/**
* Lists all previouslyOwnedCamera entities.
*
* @Route("/", name="previously-owned-camera_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedCameras = $em->getRepository('CameraBundle:PreviouslyOwnedCamera')->findBy([], [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
return $this->render('previouslyownedcamera/index.html.twig', array(
'previouslyOwnedCameras' => $previouslyOwnedCameras,
));
}
/**
* Finds and displays a previouslyOwnedCamera entity.
*
* @Route("/{id}", name="previously-owned-camera_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera)
{
return $this->render('previouslyownedcamera/show.html.twig', array(
'previouslyOwnedCamera' => $previouslyOwnedCamera,
));
}
/**
* Displays a form to edit an existing previouslyOwnedCamera entity.
*
* @Route("/{id}/edit", name="previously-owned-camera_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedCameraType', $previouslyOwnedCamera);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-camera_edit', array('id' => $previouslyOwnedCamera->getId()));
}
return $this->render('previouslyownedcamera/edit.html.twig', array(
'previouslyOwnedCamera' => $previouslyOwnedCamera,
'edit_form' => $editForm->createView(),
));
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedFlash;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedflash controller.
*
* @Route("previously-owned-flash")
*/
class PreviouslyOwnedFlashController extends Controller
{
/**
* Lists all previouslyOwnedFlash entities.
*
* @Route("/", name="previously-owned-flash_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedFlashes = $em->getRepository('CameraBundle:PreviouslyOwnedFlash')->findBy([], [
'brand' => 'ASC',
'model' => 'ASC'
]);
return $this->render('previouslyownedflash/index.html.twig', array(
'previouslyOwnedFlashes' => $previouslyOwnedFlashes,
));
}
/**
* Creates a new previouslyOwnedFlash entity.
*
* @Route("/new", name="previously-owned-flash_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$previouslyOwnedFlash = new Previouslyownedflash();
$form = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($previouslyOwnedFlash);
$em->flush();
return $this->redirectToRoute('previously-owned-flash_show', array('id' => $previouslyOwnedFlash->getId()));
}
return $this->render('previouslyownedflash/new.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash,
'form' => $form->createView(),
));
}
/**
* Finds and displays a previouslyOwnedFlash entity.
*
* @Route("/{id}", name="previously-owned-flash_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash)
{
return $this->render('previouslyownedflash/show.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash
));
}
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*
* @Route("/{id}/edit", name="previously-owned-flash_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-flash_edit', array('id' => $previouslyOwnedFlash->getId()));
}
return $this->render('previouslyownedflash/edit.html.twig', array(
'previouslyOwnedFlash' => $previouslyOwnedFlash,
'edit_form' => $editForm->createView(),
));
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace CameraBundle\Controller;
use CameraBundle\Entity\PreviouslyOwnedLenses;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedlense controller.
*
* @Route("previously-owned-lens")
*/
class PreviouslyOwnedLensesController extends Controller
{
/**
* Lists all previouslyOwnedLense entities.
*
* @Route("/", name="previously-owned-lens_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$previouslyOwnedLenses = $em->getRepository('CameraBundle:PreviouslyOwnedLenses')->findBy([], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
return $this->render('previouslyownedlenses/index.html.twig', array(
'previouslyOwnedLenses' => $previouslyOwnedLenses,
));
}
/**
* Finds and displays a previouslyOwnedLense entity.
*
* @Route("/{id}", name="previously-owned-lens_show")
* @Method("GET")
*/
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLense)
{
return $this->render('previouslyownedlenses/show.html.twig', array(
'previouslyOwnedLense' => $previouslyOwnedLense,
));
}
/**
* Displays a form to edit an existing previouslyOwnedLense entity.
*
* @Route("/{id}/edit", name="previously-owned-lens_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLense)
{
$editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedLensesType', $previouslyOwnedLense);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('previously-owned-lens_edit', array('id' => $previouslyOwnedLense->getId()));
}
return $this->render('previouslyownedlenses/edit.html.twig', array(
'previouslyOwnedLense' => $previouslyOwnedLense,
'edit_form' => $editForm->createView(),
));
}
}

0
var/cache/.gitkeep → src/Entity/.gitignore vendored Executable file → Normal file
View File

View File

@ -0,0 +1,24 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Battery Type
*
* @ORM\Table(name="battery_type", schema="camera")
* @ORM\Entity
*/
class BatteryType
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
}

29
src/Entity/Camera.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera
*
* @ORM\Table(name="camera", schema="camera", indexes={
@ORM\Index(name="IDX_747C826FC54C8C93", columns={"type_id"})
})
* @ORM\Entity
*/
class Camera
{
use CameraTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
}

432
src/Entity/CameraTrait.php Normal file
View File

@ -0,0 +1,432 @@
<?php
namespace CameraBundle\Entity;
trait CameraTrait
{
use PurchasePriceTrait;
/**
* @var \CameraType
*
* @ORM\ManyToOne(targetEntity="CameraType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=false)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="mount", type="string", length=32, nullable=false)
*/
private $mount;
/**
* @var string
*
* @ORM\Column(name="model", type="string", length=255, nullable=false)
*/
private $model;
/**
* @var boolean
*
* @ORM\Column(name="is_digital", type="boolean", nullable=false)
*/
private $isDigital;
/**
* @var string
*
* @ORM\Column(name="crop_factor", type="decimal", precision=10, scale=0, nullable=false)
*/
private $cropFactor = '1.0';
/**
* @var boolean
*
* @ORM\Column(name="is_working", type="boolean", nullable=false)
*/
private $isWorking;
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", length=20, nullable=false)
*/
private $serial;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = false;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="battery_type", type="string", nullable=true)
*/
private $batteryType;
/**
* @var string
*
* @ORM\Column(name="film_format", type="string", nullable=true)
*/
private $filmFormat = '135';
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=true)
*/
private $received = false;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set type
*
* @param \CameraBundle\Entity\CameraType $type
*
* @return Camera
*/
public function setType(\CameraBundle\Entity\CameraType $type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return \CameraBundle\Entity\CameraType
*/
public function getType()
{
return $this->type;
}
/**
* Set brand
*
* @param string $brand
*
* @return Camera
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set mount
*
* @param string $mount
*
* @return Camera
*/
public function setMount($mount)
{
$this->mount = $mount;
return $this;
}
/**
* Get mount
*
* @return string
*/
public function getMount()
{
return $this->mount;
}
/**
* Set model
*
* @param string $model
*
* @return Camera
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set isDigital
*
* @param boolean $isDigital
*
* @return Camera
*/
public function setIsDigital($isDigital)
{
$this->isDigital = $isDigital;
return $this;
}
/**
* Get isDigital
*
* @return boolean
*/
public function getIsDigital()
{
return $this->isDigital;
}
/**
* Set cropFactor
*
* @param string $cropFactor
*
* @return Camera
*/
public function setCropFactor($cropFactor)
{
$this->cropFactor = $cropFactor;
return $this;
}
/**
* Get cropFactor
*
* @return string
*/
public function getCropFactor()
{
return $this->cropFactor;
}
/**
* Set isWorking
*
* @param boolean $isWorking
*
* @return Camera
*/
public function setIsWorking($isWorking)
{
$this->isWorking = $isWorking;
return $this;
}
/**
* Get isWorking
*
* @return boolean
*/
public function getIsWorking()
{
return $this->isWorking;
}
/**
* Set notes
*
* @param string $notes
*
* @return Camera
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set serial
*
* @param string $serial
*
* @return Camera
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Camera
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set batteryType
*
* @param string $batteryType
*
* @return Camera
*/
public function setBatteryType($batteryType)
{
$this->batteryType = $batteryType;
return $this;
}
/**
* Get batteryType
*
* @return string
*/
public function getBatteryType()
{
return $this->batteryType;
}
/**
* Set filmFormat
*
* @param string $filmFormat
*
* @return Camera
*/
public function setFilmFormat($filmFormat)
{
$this->filmFormat = $filmFormat;
return $this;
}
/**
* Get filmFormat
*
* @return string
*/
public function getFilmFormat()
{
return $this->filmFormat;
}
/**
* Set received
*
* @param boolean $received
*
* @return Camera
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
}

77
src/Entity/CameraType.php Normal file
View File

@ -0,0 +1,77 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* CameraType
*
* @ORM\Table(name="camera_type", schema="camera")
* @ORM\Entity
*/
class CameraType
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255, nullable=false)
*/
private $type;
/**
* Value for serialization
*
* @return string
*/
public function __toString()
{
return $this->type;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set type
*
* @param string $type
*
* @return CameraType
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
}

41
src/Entity/Flash.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="flash", schema="camera")
* @ORM\Entity
*/
class Flash
{
use FlashTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.flash_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : false})
*/
private $received = false;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : false})
*/
private $formerlyOwned = false;
}

414
src/Entity/FlashTrait.php Normal file
View File

@ -0,0 +1,414 @@
<?php
namespace CameraBundle\Entity;
trait FlashTrait
{
use PurchasePriceTrait;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="model", type="string", nullable=false)
*/
private $model;
/**
* @var boolean
*
* @ORM\Column(name="is_auto_flash", type="boolean", nullable=false)
*/
private $isAutoFlash = false;
/**
* @var boolean
*
* @ORM\Column(name="is_ttl", type="boolean", nullable=false)
*/
private $isTtl = false;
/**
* @var string
*
* @ORM\Column(name="ttl_type", type="string", nullable=false)
*/
private $ttlType = 'N / A';
/**
* @var boolean
*
* @ORM\Column(name="is_p_ttl", type="boolean", nullable=false)
*/
private $isPTtl = false;
/**
* @var string
*
* @ORM\Column(name="p_ttl_type", type="string", nullable=false)
*/
private $pTtlType = 'N / A';
/**
* @var string
*
* @ORM\Column(name="guide_number", type="string", nullable=true)
*/
private $guideNumber;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="batteries", type="string", nullable=false)
*/
private $batteries = '4x AA';
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", nullable=true)
*/
private $serial;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set brand
*
* @param string $brand
*
* @return Flash
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set model
*
* @param string $model
*
* @return Flash
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set isAutoFlash
*
* @param boolean $isAutoFlash
*
* @return Flash
*/
public function setIsAutoFlash($isAutoFlash)
{
$this->isAutoFlash = $isAutoFlash;
return $this;
}
/**
* Get isAutoFlash
*
* @return boolean
*/
public function getIsAutoFlash()
{
return $this->isAutoFlash;
}
/**
* Set isTtl
*
* @param boolean $isTtl
*
* @return Flash
*/
public function setIsTtl($isTtl)
{
$this->isTtl = $isTtl;
return $this;
}
/**
* Get isTtl
*
* @return boolean
*/
public function getIsTtl()
{
return $this->isTtl;
}
/**
* Set ttlType
*
* @param string $ttlType
*
* @return Flash
*/
public function setTtlType($ttlType)
{
$this->ttlType = $ttlType;
return $this;
}
/**
* Get ttlType
*
* @return string
*/
public function getTtlType()
{
return $this->ttlType;
}
/**
* Set isPTtl
*
* @param boolean $isPTtl
*
* @return Flash
*/
public function setIsPTtl($isPTtl)
{
$this->isPTtl = $isPTtl;
return $this;
}
/**
* Get isPTtl
*
* @return boolean
*/
public function getIsPTtl()
{
return $this->isPTtl;
}
/**
* Set pTtlType
*
* @param string $pTtlType
*
* @return Flash
*/
public function setPTtlType($pTtlType)
{
$this->pTtlType = $pTtlType;
return $this;
}
/**
* Get pTtlType
*
* @return string
*/
public function getPTtlType()
{
return $this->pTtlType;
}
/**
* Set guideNumber
*
* @param string $guideNumber
*
* @return Flash
*/
public function setGuideNumber($guideNumber)
{
$this->guideNumber = $guideNumber;
return $this;
}
/**
* Get guideNumber
*
* @return string
*/
public function getGuideNumber()
{
return $this->guideNumber;
}
/**
* Set batteries
*
* @param string $batteries
*
* @return Flash
*/
public function setBatteries($batteries)
{
$this->batteries = $batteries;
return $this;
}
/**
* Get batteries
*
* @return string
*/
public function getBatteries()
{
return $this->batteries;
}
/**
* Set notes
*
* @param string $notes
*
* @return Flash
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set serial
*
* @param string $serial
*
* @return Flash
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Flash
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set received
*
* @param boolean $received
*
* @return Flash
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
}

601
src/Entity/LensTrait.php Normal file
View File

@ -0,0 +1,601 @@
<?php
namespace CameraBundle\Entity;
trait LensTrait
{
use PurchasePriceTrait;
/**
* @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=true)
*/
private $brand;
/**
* @var string
*
* @ORM\Column(name="coatings", type="string", length=64, nullable=true)
*/
private $coatings;
/**
* @var string
*
* @ORM\Column(name="product_line", type="string", length=64, nullable=true)
*/
private $productLine;
/**
* @var string
*
* @ORM\Column(name="model", type="string", length=64, nullable=true)
*/
private $model;
/**
* @var string
*
* @ORM\Column(name="min_f_stop", type="string", length=10, nullable=true)
*/
private $minFStop;
/**
* @var float
*
* @ORM\Column(name="max_f_stop", type="float", precision=10, scale=0, nullable=true)
*/
private $maxFStop;
/**
* @var integer
*
* @ORM\Column(name="min_focal_length", type="integer", nullable=true)
*/
private $minFocalLength;
/**
* @var integer
*
* @ORM\Column(name="max_focal_length", type="integer", nullable=true)
*/
private $maxFocalLength;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", length=10, nullable=true)
*/
private $serial;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private $notes;
/**
* @var string
*
* @ORM\Column(name="mount", type="string", length=40, nullable=true)
*/
private $mount;
/**
* @var string
*
* @ORM\Column(name="front_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/
private $frontFilterSize;
/**
* @var string
*
* @ORM\Column(name="rear_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/
private $rearFilterSize;
/**
* @var boolean
*
* @ORM\Column(name="is_teleconverter", type="boolean", nullable=false)
*/
private $isTeleconverter = false;
/**
* @var integer
*
* @ORM\Column(name="design_elements", type="smallint", nullable=true)
*/
private $designElements;
/**
* @var integer
*
* @ORM\Column(name="design_groups", type="smallint", nullable=true)
*/
private $designGroups;
/**
* @var integer
*
* @ORM\Column(name="aperture_blades", type="smallint", nullable=true)
*/
private $apertureBlades;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set brand
*
* @param string $brand
*
* @return Lenses
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set coatings
*
* @param string $coatings
*
* @return Lenses
*/
public function setCoatings($coatings)
{
$this->coatings = $coatings;
return $this;
}
/**
* Get coatings
*
* @return string
*/
public function getCoatings()
{
return $this->coatings;
}
/**
* Set productLine
*
* @param string $productLine
*
* @return Lenses
*/
public function setProductLine($productLine)
{
$this->productLine = $productLine;
return $this;
}
/**
* Get productLine
*
* @return string
*/
public function getProductLine()
{
return $this->productLine;
}
/**
* Set model
*
* @param string $model
*
* @return Lenses
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return string
*/
public function getModel()
{
return $this->model;
}
/**
* Set minFStop
*
* @param string $minFStop
*
* @return Lenses
*/
public function setMinFStop($minFStop)
{
$this->minFStop = $minFStop;
return $this;
}
/**
* Get minFStop
*
* @return string
*/
public function getMinFStop()
{
return $this->minFStop;
}
/**
* Set maxFStop
*
* @param float $maxFStop
*
* @return Lenses
*/
public function setMaxFStop($maxFStop)
{
$this->maxFStop = $maxFStop;
return $this;
}
/**
* Get maxFStop
*
* @return float
*/
public function getMaxFStop()
{
return $this->maxFStop;
}
/**
* Set minFocalLength
*
* @param integer $minFocalLength
*
* @return Lenses
*/
public function setMinFocalLength($minFocalLength)
{
$this->minFocalLength = $minFocalLength;
return $this;
}
/**
* Get minFocalLength
*
* @return integer
*/
public function getMinFocalLength()
{
return $this->minFocalLength;
}
/**
* Set maxFocalLength
*
* @param integer $maxFocalLength
*
* @return Lenses
*/
public function setMaxFocalLength($maxFocalLength)
{
$this->maxFocalLength = $maxFocalLength;
return $this;
}
/**
* Get maxFocalLength
*
* @return integer
*/
public function getMaxFocalLength()
{
return $this->maxFocalLength;
}
/**
* Set serial
*
* @param string $serial
*
* @return Lenses
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Get serial
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set notes
*
* @param string $notes
*
* @return Lenses
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set mount
*
* @param string $mount
*
* @return Lenses
*/
public function setMount($mount)
{
$this->mount = $mount;
return $this;
}
/**
* Get mount
*
* @return string
*/
public function getMount()
{
return $this->mount;
}
/**
* Set received
*
* @param boolean $received
*
* @return Lenses
*/
public function setReceived($received)
{
$this->received = $received;
return $this;
}
/**
* Get received
*
* @return boolean
*/
public function getReceived()
{
return $this->received;
}
/**
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return Lenses
*/
public function setFormerlyOwned($formerlyOwned)
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
/**
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned()
{
return $this->formerlyOwned;
}
/**
* Set frontFilterSize
*
* @param string $frontFilterSize
*
* @return Lenses
*/
public function setFrontFilterSize($frontFilterSize)
{
$this->frontFilterSize = $frontFilterSize;
return $this;
}
/**
* Get frontFilterSize
*
* @return string
*/
public function getFrontFilterSize()
{
return $this->frontFilterSize;
}
/**
* Set rearFilterSize
*
* @param string $rearFilterSize
*
* @return Lenses
*/
public function setRearFilterSize($rearFilterSize)
{
$this->rearFilterSize = $rearFilterSize;
return $this;
}
/**
* Get rearFilterSize
*
* @return string
*/
public function getRearFilterSize()
{
return $this->rearFilterSize;
}
/**
* Set isTeleconverter
*
* @param boolean $isTeleconverter
*
* @return Lenses
*/
public function setIsTeleconverter($isTeleconverter)
{
$this->isTeleconverter = $isTeleconverter;
return $this;
}
/**
* Get isTeleconverter
*
* @return boolean
*/
public function getIsTeleconverter()
{
return $this->isTeleconverter;
}
/**
* Set designElements
*
* @param integer $designElements
*
* @return Lenses
*/
public function setDesignElements($designElements)
{
$this->designElements = $designElements;
return $this;
}
/**
* Get designElements
*
* @return integer
*/
public function getDesignElements()
{
return $this->designElements;
}
/**
* Set designGroups
*
* @param integer $designGroups
*
* @return Lenses
*/
public function setDesignGroups($designGroups)
{
$this->designGroups = $designGroups;
return $this;
}
/**
* Get designGroups
*
* @return integer
*/
public function getDesignGroups()
{
return $this->designGroups;
}
/**
* Set apertureBlades
*
* @param integer $apertureBlades
*
* @return Lenses
*/
public function setApertureBlades($apertureBlades)
{
$this->apertureBlades = $apertureBlades;
return $this;
}
/**
* Get apertureBlades
*
* @return integer
*/
public function getApertureBlades()
{
return $this->apertureBlades;
}
}

40
src/Entity/Lenses.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.lenses
*
* @ORM\Table(name="lenses", schema="camera")
* @ORM\Entity
*/
class Lenses
{
use LensTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.lenses_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
private $received = false;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = false;
}

View File

@ -14,13 +14,13 @@ class PreviouslyOwnedCamera
{
use CameraTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_camera_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_camera_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
}

View File

@ -0,0 +1,41 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="previously_owned_flash", schema="camera")
* @ORM\Entity
*/
class PreviouslyOwnedFlash
{
use FlashTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_flash_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : true})
*/
private $received = true;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : true})
*/
private $formerlyOwned = true;
}

View File

@ -0,0 +1,39 @@
<?php
namespace CameraBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Camera.previouslyOwnedLenses
*
* @ORM\Table(name="previously_owned_lenses", schema="camera")
* @ORM\Entity
*/
class PreviouslyOwnedLenses
{
use LensTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="camera.previously_owned_lenses_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
private $received = true;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = true;
}

View File

@ -0,0 +1,34 @@
<?php
namespace CameraBundle\Entity;
trait PurchasePriceTrait
{
/**
* Set purchasePrice
*
* @param string $purchasePrice
*
* @return Camera
*/
public function setPurchasePrice($purchasePrice)
{
$this->purchasePrice = $purchasePrice;
return $this;
}
/**
* Get purchasePrice
*
* @return string
*/
public function getPurchasePrice()
{
if (empty($this->purchasePrice)) {
return 0;
}
return $this->purchasePrice;
}
}

61
src/Kernel.php Normal file
View File

@ -0,0 +1,61 @@
<?php
namespace CameraBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function getCacheDir()
{
return $this->getProjectDir().'/var/cache/'.$this->environment;
}
public function getLogDir()
{
return $this->getProjectDir().'/var/log';
}
public function registerBundles()
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) {
yield new $class();
}
}
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->setParameter('container.autowiring.strict_mode', true);
$container->setParameter('container.dumper.inline_class_loader', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
if (is_dir($confDir.'/packages/'.$this->environment)) {
$loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
}
$loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/config';
if (is_dir($confDir.'/routes/')) {
$routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
}
if (is_dir($confDir.'/routes/'.$this->environment)) {
$routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
}
$routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob');
}
}

0
var/logs/.gitkeep → src/Repository/.gitignore vendored Executable file → Normal file
View File

188
symfony.lock Normal file
View File

@ -0,0 +1,188 @@
{
"symfony/flex": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "e921bdbfe20cdefa3b82f379d1cd36df1bc8d115"
}
},
"psr/log": {
"version": "1.0.2"
},
"symfony/debug": {
"version": "v3.3.13"
},
"symfony/polyfill-mbstring": {
"version": "v1.6.0"
},
"symfony/console": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "9f94d3ea453cd8a3b95db7f82592d7344fe3a76a"
}
},
"symfony/routing": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "a249484db698d1a847a30291c8f732414ac47e25"
}
},
"symfony/http-foundation": {
"version": "v3.3.13"
},
"symfony/event-dispatcher": {
"version": "v3.3.13"
},
"symfony/http-kernel": {
"version": "v3.3.13"
},
"symfony/finder": {
"version": "v3.3.13"
},
"symfony/filesystem": {
"version": "v3.3.13"
},
"psr/container": {
"version": "1.0.0"
},
"symfony/dependency-injection": {
"version": "v3.3.13"
},
"symfony/config": {
"version": "v3.3.13"
},
"psr/simple-cache": {
"version": "1.0.0"
},
"psr/cache": {
"version": "1.0.1"
},
"symfony/cache": {
"version": "v3.3.13"
},
"symfony/framework-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "305b268e55e75059f20ec9827a8fd09a35c59866"
}
},
"symfony/yaml": {
"version": "v3.3.13"
},
"symfony/dotenv": {
"version": "v3.3.13"
},
"doctrine/cache": {
"version": "v1.7.1"
},
"doctrine/inflector": {
"version": "v1.2.0"
},
"doctrine/lexer": {
"version": "v1.0.1"
},
"doctrine/collections": {
"version": "v1.5.0"
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "b9cde490c337f6c496d5f403fa6f827cf8b4706d"
}
},
"doctrine/common": {
"version": "v2.8.1"
},
"symfony/doctrine-bridge": {
"version": "v4.0.0"
},
"doctrine/doctrine-cache-bundle": {
"version": "1.3.2"
},
"jdorn/sql-formatter": {
"version": "v1.2.17"
},
"doctrine/dbal": {
"version": "v2.6.3"
},
"doctrine/doctrine-bundle": {
"version": "1.6",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.6",
"ref": "44d3aa7752dd46f77ba11af2297a25e1dedfb4d0"
}
},
"doctrine/instantiator": {
"version": "1.1.0"
},
"doctrine/orm": {
"version": "v2.5.13"
},
"twig/twig": {
"version": "v2.4.4"
},
"monolog/monolog": {
"version": "1.23.0"
},
"symfony/monolog-bridge": {
"version": "v4.0.0"
},
"symfony/monolog-bundle": {
"version": "3.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.1",
"ref": "c24944bd87dacf0bb8fa218dc21e4a70fff56882"
}
},
"sensio/framework-extra-bundle": {
"version": "v3.0.28"
},
"symfony/twig-bridge": {
"version": "v4.0.0"
},
"symfony/twig-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "f75ac166398e107796ca94cc57fa1edaa06ec47f"
}
},
"symfony/inflector": {
"version": "v4.0.0"
},
"symfony/property-access": {
"version": "v4.0.0"
},
"symfony/options-resolver": {
"version": "v4.0.0"
},
"symfony/intl": {
"version": "v4.0.0"
},
"symfony/polyfill-intl-icu": {
"version": "v1.6.0"
},
"symfony/form": {
"version": "v4.0.0"
}
}

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="/css/foundation.min.css" />
<link rel="stylesheet" href="/css/app.css" />
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<main class="page-pad">

Some files were not shown because too many files have changed in this diff Show More