Skip to content

Instantly share code, notes, and snippets.

@wecc
wecc / application.controller.js
Created November 17, 2015 22:03
New Twiddle
import Ember from 'ember';
const { set, computed: { sort } } = Ember;
export default Ember.Controller.extend({
appName:'Ember Twiddle',
sorting: ['position:asc'],
sortedItems: sort('model', 'sorting'),
@wecc
wecc / application.controller.js
Last active September 21, 2015 11:52
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<?php
Database::beginTransaction();
if ($order = Order::create($data)) {
$items = $cart->getItems();
$orderLines = array();
foreach ($items as $item) {
$data = array(
'number' => $item->article->number,
<?php
Database::beginTransaction();
if ($order = Order::create($data)) {
$items = $cart->getItems();
$orderLines = array();
foreach ($items as $item) {
$data = array(
'number' => $item->article->number,
'number_supplier' => $item->article->number_supplier,
<?php /**
* @Route("/login/", name="login_route")
*/
public function loginAction(Request $request)
{
$authenticationUtils = $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
<?php /**
* @Route("/login/", name="login_route")
*/
public function loginAction(Request $request)
{
$authenticationUtils = $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
<?php /**
* @Route("/login/", name="login_route")
*/
public function loginAction(Request $request)
{
$authenticationUtils = $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
@wecc
wecc / gist:3d30c73b5bec4fe3d708
Created November 26, 2014 20:17
Use this method to restore the old Ember Data behavior where properties with missing keys in the payload gets cleared.
App.ApplicationSerializer = DS.RESTSerializer.extend({
normalizeAttributes: function(type, hash) {
this._super(type, hash);
type.eachAttribute(function(key) {
if (!hash.hasOwnProperty(key)) {
hash[key] = null;
}
}, this);