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
$allowedIds = $this->Websites->Products->find() | |
->extract(['id']) | |
->where(['reservation_id IS' => null]) // Product is not already reserved | |
->where(['size' => $converter->convert($request['size_eu'], $gender['gender'])]) // Product size matches | |
->where(['id IN' => TableRegistry::get('ProductsWebsites')->find() // Product belongs to the Website | |
->select(['product_id']) | |
->where(['website_id' => $website->id]) | |
]) | |
->where(['product_info_id IN' => $this->Websites->Products->ProductInfo->find() // Product sku matches | |
->select('id') |
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
SELECT | |
Products.id AS `Products__id` | |
FROM | |
products Products | |
INNER JOIN websites Websites ON Websites.id = 1 | |
INNER JOIN products_websites ProductsWebsites ON ( | |
Products.id = (ProductsWebsites.product_id) | |
AND Websites.id = (ProductsWebsites.website_id) | |
) | |
INNER JOIN product_info ProductInfo ON ( |
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 | |
// In my controller: | |
$delivery = $this->Deliveries->get($id, [ | |
'contain' => ['Warehouses', 'DeliveryNotes', 'Orders', 'Products' => function ($q) { | |
return $q->find('filtered', ['options' => ['group' => 'ean']]) | |
->select(['Products.id', 'ProductInfo.sku', 'ProductInfo.id', 'Products.size', 'Products.product_info_id']) | |
->contain('ProductInfo'); | |
}] | |
]); |
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 | |
// In my model | |
$package = $this->get($options['package_id']); | |
$products = $this->Products->find() | |
->where(['Products.package_id' => $options['package_id']]) | |
->toArray(); | |
$this->Products->unlink($package, $products); | |
// This is giving me an error: | |
// InvalidArgumentException |
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
App\Model\Entity\Product::_getStockApiUniqueCode() - APP/Model/Entity/Product.php, line 109 | |
Cake\ORM\Entity::get() - CORE/src/Datasource/EntityTrait.php, line 294 | |
Cake\ORM\Entity::has() - CORE/src/Datasource/EntityTrait.php, line 340 | |
Cake\ORM\Entity::offsetExists() - CORE/src/Datasource/EntityTrait.php, line 473 | |
App\Model\Table\ProductsTable::beforeSave() - APP/Model/Table/ProductsTable.php, line 138 | |
Cake\Event\EventManager::_callListener() - CORE/src/Event/EventManager.php, line 390 | |
Cake\Event\EventManager::dispatch() - CORE/src/Event/EventManager.php, line 356 | |
Cake\ORM\Table::dispatchEvent() - CORE/src/Event/EventDispatcherTrait.php, line 78 | |
Cake\ORM\Table::_processSave() - CORE/src/ORM/Table.php, line 1439 | |
Cake\ORM\Table::Cake\ORM\{closure}() - CORE/src/ORM/Table.php, line 1391 |
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 App\Test\Fixture; | |
use Cake\TestSuite\Fixture\TestFixture; | |
/** | |
* ReservationsFixture | |
* | |
*/ | |
class ReservationsFixture extends TestFixture |
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 | |
// So I'm going to be demonstrating a problem with INNER joins | |
//Bake automatically creates INNER JOINs for a belongsTo association, | |
// where the foreign key is not allowed to be null (Always BelongsTo) | |
// This is great if you have an (AlwaysBelongsTo) association, but | |
// when you don't always BelongTo another model, we need LEFT joins. | |
// The problem arised when you have a model that someTimesBelongsTo another model | |
// and that other model alwaysBelongsTo another model (LEFT, then INNER joins) | |
// Cake doesn't use proper parenthesis in these cases, but simply lines the joins up, | |
// one after another. |
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
#!/bin/sh | |
echo "Hello World" |
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
#!/bin/bash | |
startDir=$(pwd) | |
echo "Updating ANT+ driver..." | |
cd /home/pi/libant/ | |
git reset --hard HEAD | |
git pull | |
sudo python3 setup.py install | |
echo "Done!" |
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
Első feladat | |
Fekete háttér előtt a gömb alakú, 0.2 1/sec fordulatszámmal forgó, 40 ezer km kerületű földet látjuk a képernyőn, amelynek sziluettjét fehérrel, 30 fokonként a hosszúsági és szélességi köreit szürkével rajzoljuk fel. A virtuális kameránk merőleges vetítést használ, a megjelenítés huzalváz jellegű. A földgömb kép 90%-át foglalja el függőleges irányban, a földgömb közepe a kép közepén van. Egérrel a bal gombbal ráklikkelve a föld elülső felületére repülőgépeket indíthatunk és azok útvonalát jelölhetjük ki egészen addig, amíg a jobb gombbal a célállomást megadjuk. A kiindulási reptér, közbenső pontok és a célreptér között a repülő a legrövidebb úton halad 10 km magasságban, állandó körív menti (Rodriguez vagy SLERP) 5 ezer km/sec sebességgel (most ne foglalkozzunk a szökési sebességgel). A repülő az orrát követi, a szárnyai pedig a gravitáció irányára merőlegesek. A repülési pályát piros vonal mutatja. A repülőt Catmull-Rom spline-nal definiált zöld színű kitöltött konkáv területtel jelenítjük meg, |
OlderNewer