/**
* Configuration of the input filter for element based on the provided specification.
* Specification can contain any of the following:
*
* .-------------------.----------------.-----------------.-----------------.--------------------.
* | continue_if_empty | required | allow_empty | Is empty valid? | Apply other filter |
* |-------------------+----------------+-----------------+-----------------+--------------------|
* | false (default) | true (default) | false (default) | false | Not |
* | false (default) | true (default) | true | true | Not |
* | false (default) | false | false (default) | true | Not |
* | true | true (default) | false (default) | true | Yes |
* |-------------------+----------------+-----------------+-----------------+--------------------|
* | false (default) | false | true | true | Not |
* | true | true (default) | true | true | Yes |
* | true | false | false (default) | true | Yes |
* | true | false | true | true | Yes |
* '-------------------'----------------'-----------------'-----------------'--------------------'
*/
<?php
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
// Setup autoloading
require 'init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
<?php
use Zend\Mvc\Application;
use Zend\Stdlib\ArrayUtils;
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server') {
$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if (__FILE__ !== $path && is_file($path)) {
return false;
}
unset($path);
}
// Composer autoloading
include __DIR__ . '/../vendor/autoload.php';
if (! class_exists(Application::class)) {
throw new RuntimeException(
"Unable to load application.\n"
. "- Type `composer install` if you are developing locally.\n"
. "- Type `vagrant ssh -c 'composer install'` if you are using Vagrant.\n"
. "- Type `docker-compose run zf composer install` if you are using Docker.\n"
);
}
// Retrieve configuration
$appConfig = require __DIR__ . '/../config/application.config.php';
if (file_exists(__DIR__ . '/../config/development.config.php')) {
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
}
// Run the application!
Application::init($appConfig)->run();
<?php
return [
'doctrine' => [
'connection' => [
'orm_default' => [
'driverClass' => \Doctrine\DBAL\Driver\PDOMySql\Driver::class,
'params' => [
'host' => 'localhost',
'port' => '3306',
'user' => 'username',
'password' => 'password',
'dbname' => 'database',
'driverOptions' => [
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
],
],
],
],
],
];
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* ServiceManagerAwareTrait trait.
*/
trait ServiceManagerAwareTrait
{
/**
* $serviceManager instance.
* @var ServiceLocatorInterface
*/
protected $serviceManager = null;
/**
* Set $serviceManager.
*
* @param ServiceLocatorInterface $serviceManager
* @return self
*/
public function setServiceManager(ServiceLocatorInterface $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
/**
* Retrieve $serviceManager.
*
* @return ServiceLocatorInterface $serviceManager
*/
public function getServiceManager()
{
return $this->serviceManager;
}
}
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li class="alert" role="presentation">
<a href="#">
<button type="button" class="close pull-right" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Messages
</a>
</li>
</ul>
public function getCategory()
{
$queryBuilder = $this->getEntityManager()->createQueryBuilder();
$queryBuilder
->select('category')->from($this->getClassName(), 'category')
->addSelect('c_categoryHasPosts')->leftJoin('category.categoryHasPosts', 'c_categoryHasPosts')
->addSelect('c_cHasP_post')->leftJoin('c_categoryHasPosts.post', 'c_cHasP_post')
->addSelect('c_cHasP_p_postHasComments')->leftJoin('c_cHasP_post.postHasComments', 'c_cHasP_p_postHasComments')
->addSelect('c_cHasP_p_pHasC_comment')->leftJoin('c_cHasP_p_postHasComments.comment', 'c_cHasP_p_pHasC_comment')
->setParameter('categoryId', 1)
->setParameter('postId', 1)
->andWhere('c_cHasP_post.category_id = :categoryId')
->orWhere('c_cHasP_p_pHasC_comment.post_id = :postId')
return $queryBuilder->getQuery()->getResult();
}