This file contains hidden or 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 | |
| // Doctrine\ORM\Query | |
| function getRecentByPage($page) { | |
| $queryBuilder = $entityManager->createQueryBuilder(); | |
| $queryBuilder->select('a'); | |
| $queryBuilder->from('Blar\\Model\\News\\Article', 'a'); | |
| $queryBuilder->orderBy('a.created', 'DESC'); | |
| $query = $queryBuilder->getQuery(); |
This file contains hidden or 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
| INSERT INTO | |
| table(id, title, created, modified) | |
| VALUES | |
| (NULL, 'foo', NOW(), NOW()), | |
| (NULL, 'bar', NOW(), NOW()) | |
| ON DUPLICATE KEY UPDATE | |
| modified = VALUES(modified); |
This file contains hidden or 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 | |
| use Form, | |
| Blar\Model\News\Article, | |
| Blar\Model\News\Articles; | |
| class News_IndexController extends Zend_Controller_Action { | |
| protected $entityManager; |
This file contains hidden or 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 | |
| public function test() { | |
| $user = $this->entityManager->getRepository('Blar\\Model\\User')->findOneById(1); | |
| var_dump($user->getName()); | |
| $article = $this->entityManager->getRepository('Blar\\Model\\News\\Article')->findOneBy(array( | |
| 'user' => $user | |
| )); | |
| var_dump($article->getName()); | |
| } |
This file contains hidden or 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 Blar; | |
| use Doctrine\Common\EventSubscriber, | |
| Doctrine\ORM\Events, | |
| Doctrine\ORM\Event\OnFlushEventArgs, | |
| Doctrine\ORM\EntityManager; | |
| class AuditListener implements EventSubscriber { |
This file contains hidden or 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 | |
| function foo($path, $callback = NULL) { | |
| $result = array(); | |
| $iterator = new DirectoryIterator($path); | |
| foreach ($iterator as $fileinfo) { | |
| if($fileinfo->isDot()) { | |
| continue; | |
| } |
This file contains hidden or 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 | |
| # http://www.opensource.apple.com/source/net_snmp/net_snmp-127/mibs/AIRPORT-BASESTATION-3-MIB.txt | |
| # snmpwalk -v 2c -c public -m AIRPORT-BASESTATION-3-MIB 10.0.1.1 enterprises.apple.airport | |
| $hostname = '10.0.1.1'; | |
| $password = 'public'; | |
| snmp_read_mib('/usr/share/snmp/mibs/AIRPORT-BASESTATION-3-MIB.txt'); | |
| snmp_set_enum_print(true); |
This file contains hidden or 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
| # | |
| # Encoding: Unicode (UTF-8) | |
| # | |
| CREATE TABLE `activity_like` ( | |
| `activity_id` int(11) NOT NULL, | |
| `like_id` int(11) NOT NULL, | |
| PRIMARY KEY (`activity_id`,`like_id`), | |
| KEY `IDX_AFA79B2181C06096` (`activity_id`), |
This file contains hidden or 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
| array(2) { | |
| [0]=> | |
| object(Blar\HTTP\Response)#213 (3) { | |
| ["url":protected]=> | |
| NULL | |
| ["headers":protected]=> | |
| array(5) { | |
| ["Status"]=> | |
| object(Blar\HTTP\Headers\Status)#216 (3) { | |
| ["protocol"]=> |
This file contains hidden or 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 | |
| switch(array_filter(array(gettype($foo), is_object($foo) ? get_class($foo) : NULL))) { | |
| case array('integer'): | |
| var_dump('integer'); | |
| break; | |
| case array('object', 'foo'): | |
| var_dump('foo'); |
OlderNewer