This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$baseUrl = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/'))) . '://' . $_SERVER['SERVER_NAME']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stringToUpperFirst(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace BitkornShop\Table\Basket; | |
use Zend\Db\Adapter\Adapter; | |
use Zend\Db\ResultSet\HydratingResultSet; | |
use Zend\Db\TableGateway\AbstractTableGateway; | |
use Zend\Db\Adapter\AdapterAwareInterface; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Foo; | |
use Zend\Db\Adapter\Adapter; | |
use Zend\Db\Adapter\ParameterContainer; | |
class A | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @param array $data | |
* @return int | |
*/ | |
public function insertSomeAndGetLastInsertValue(array $data) | |
{ | |
$insert = $this->sql->insert(); | |
$insert->values($data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uri = $this->getRequest()->getUri(); | |
$base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost()); | |
// or | |
$serverUrlHelper = $this->getServiceLocator()->get('ViewHelperManager')->get('ServerUrl'); | |
$url = $serverUrlHelper($this->url()->fromRoute('some_routename')); | |
// or in view | |
echo $this->serverUrl($this->url('some_routename')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
/** | |
* | |
* @var \SomeNamespace\SomeMember | |
*/ | |
private $someMember; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- without DISTINCT comes false results | |
SELECT | |
sa.*, | |
sac.*, | |
COUNT(DISTINCT sagr.shop_article_group_relation_id) AS count_group_relation, | |
COUNT(DISTINCT sai.shop_article_image_id) AS count_image, | |
COUNT(DISTINCT sar.shop_article_relation_id) AS count_relation, | |
sasd.*, | |
COUNT(DISTINCT sasi.shop_article_size_item_id) AS count_size_item, | |
COUNT(DISTINCT sacomm.shop_article_comment_id) AS count_comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Module implements Zend\ModuleManager\Feature\ViewHelperProviderInterface | |
{ | |
public function getViewHelperConfig() | |
{ | |
return array( | |
'factories' => [ | |
'simpleAnchor' => function(\Zend\View\HelperPluginManager $hpm) { | |
$sm = $hpm->getServiceLocator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @return(raw) ('firstenumvalue','secondenumvalue','...') | |
SELECT | |
-- cut the word 'enum' | |
SUBSTRING(COLUMN_TYPE, 5) | |
FROM | |
information_schema.COLUMNS | |
WHERE | |
TABLE_SCHEMA = 'schemaname' | |
AND TABLE_NAME = 'tablename' | |
AND COLUMN_NAME = 'columnname'; |