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
| Even if you are using a document database, if you dont define your schema you might get miscast results. | |
| { | |
| count: 5, | |
| ... | |
| } | |
| ... | |
| { |
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 Base extends lithium\data\Model { | |
| public function save($entity, $data = null, array $options = array()) { | |
| if ($data) { | |
| $entity->set($data); | |
| } | |
| if (!$entity->exists()) { | |
| $entity->created = new MongoDate(); |
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 | |
| // somewhere in config/bootstrap | |
| Dispatcher::config(array('rules' => array( | |
| 'admin' => array( | |
| 'action' => 'admin_{:action}' | |
| ) | |
| ))); | |
| // app/classes/PostsController.php |
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 | |
| //config/bootstrap/cache.php | |
| use lithium\storage\Cache; | |
| Cache::config(array( | |
| 'local' => array( | |
| 'adapter' => 'Apc' | |
| ), |
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 | |
| // config/bootstrap/connections.php | |
| use lithium\data\Connections; | |
| Connections::config(array( | |
| 'default' => array( | |
| 'type' => 'MongoDb', | |
| 'database' => 'my_mongo_db' |
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 | |
| //config/bootstrap/session.php | |
| use lithium\security\Auth; | |
| Auth::config(array( | |
| 'customer' => array( | |
| 'adapter' => 'Form', | |
| 'model' => 'Customers', |
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 lithium\storage\Cache; | |
| Cache::config(array( | |
| 'default' => array( | |
| 'development' => array('adapter' => 'Apc'), | |
| 'production' => array( | |
| 'adapter' => 'Memcache', | |
| 'host' => '127.0.0.1:1121' |
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 | |
| $service = new Service(array( | |
| 'scheme' => 'https', | |
| 'host' => 'web.service.com', | |
| 'username' => 'user', | |
| 'password' => 's3kr1t', | |
| 'classes' => array( | |
| 'request' => 'my\custom\Request' | |
| ) |
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 | |
| // Default | |
| <?=$this->form->text('email'); ?> | |
| <input type="text" name="email" id="MemberEmail" value="[email protected]" /> | |
| // Custom wrapper class | |
| <?=$this->form->field('name', array( | |
| 'wrap' => array('class' => 'wrapper') | |
| )); ?> |
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
| You can easily add support for mobile templates by configuring the Media class. Using the snippet below if the request is made from a mobile device we can first check for a mobile template, and if there is none fall back to the default. |