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 | |
/** | |
* This file is part of the Nette Framework (http://nette.org) | |
* | |
* Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com) | |
* | |
* For the full copyright and license information, please view | |
* the file license.txt that was distributed with this source code. | |
*/ |
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 | |
class FormContainer { | |
/** | |
* Fill-in with values. | |
* @param array|Traversable values used to fill the form | |
* @param bool erase other controls? | |
* @return FormContainer provides a fluent interface | |
*/ | |
public function setValues($values, $erase = FALSE) |
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 | |
class BasePresenter extends \Nette\Presenter { | |
/** | |
* @overload When sending AJAX response, send also number error details | |
* @return array | |
*/ | |
public function sendPayload() { | |
// Add errors to payload | |
if(\Nette\Debug::$errors) { | |
ob_start(); |
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 | |
class Address { | |
public $street; | |
public $town; | |
} | |
class Customer { | |
public $id; | |
public $name; |
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 | |
class Movie { | |
const GENRE_HORROR = 1; | |
const GENRE_SCIFI = 2; | |
const GENRE_FAMILY = 3; | |
const GENRE_X0 = 4; // just to have more labels (for performance testing) | |
const GENRE_X1 = 5; | |
const GENRE_X2 = 6; |
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 | |
class EntityForm extends Form { | |
/** | |
* Bind entity to this form and set default values from it | |
* | |
* @param \Nella\Models\IEntity $entity | |
* @throws \Nette\InvalidStateException | |
*/ | |
public function bind(\Nella\Models\IEntity $entity) |
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 Nette\Forms\Controls\BaseControl, | |
Nella\Models\IEntity; | |
/** | |
* Select box control that display entities | |
* | |
* @author Jan Dolecek <[email protected]> | |
*/ |
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
Intro: Need to display tables of content, they need to be dynamic (pagable, sortable, filterable), how to solve it? | |
------------------------------------------- | |
1st - static table | |
<table> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>Published</th> |
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 | |
// method 1 - partial fetch | |
{ | |
$q = $em->createQuery("select partial a.{id,title}, length(a.body) from Model\\Article a"); | |
$q->setMaxResults(1); | |
$list = $q->execute(); | |
$entity = $list[0][0]; | |
/*dump($entity);*/ | |
var_dump($entity->body); // NULL as it was not fetched |
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 | |
$path = "/tmp/ob.log"; | |
$logHandle = fopen($path, 'w') or die("unable to open temp file"); | |
ob_start(function($buffer) use ($logHandle) { fwrite($logHandle, $buffer); }, 20); | |
echo str_repeat("0", 20); // fill in the buffer | |
for($i = 0; $i < 10; $i++) { |
OlderNewer