permission cleanup
This commit is contained in:
@@ -135,6 +135,8 @@ class CreateAdminUser extends ContainerAwareCommand
|
||||
$output->writeln("Passwords are different, please try again.");
|
||||
} while (true);
|
||||
|
||||
$admin->setProfile(null);
|
||||
|
||||
return $admin;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<loops>
|
||||
<loop class="Thelia\Core\Template\Loop\Accessory" name="accessory"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Admin" name="admin"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Area" name="area"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AssociatedContent" name="associated_content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Attribute" name="attribute"/>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Address\AddressEvent;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\AddressCreateForm;
|
||||
@@ -46,10 +47,10 @@ class AddressController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
'admin.customer.update.view',
|
||||
'admin.address.create',
|
||||
'admin.address.update',
|
||||
'admin.address.delete',
|
||||
AdminResources::ADDRESS_VIEW,
|
||||
AdminResources::ADDRESS_CREATE,
|
||||
AdminResources::ADDRESS_UPDATE,
|
||||
AdminResources::ADDRESS_DELETE,
|
||||
|
||||
TheliaEvents::ADDRESS_CREATE,
|
||||
TheliaEvents::ADDRESS_UPDATE,
|
||||
@@ -62,7 +63,7 @@ class AddressController extends AbstractCrudController
|
||||
|
||||
public function useAddressAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$address_id = $this->getRequest()->request->get('address_id');
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Area\AreaAddCountryEvent;
|
||||
use Thelia\Core\Event\Area\AreaCreateEvent;
|
||||
use Thelia\Core\Event\Area\AreaDeleteEvent;
|
||||
@@ -52,10 +53,10 @@ class AreaController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
'admin.area.default',
|
||||
'admin.area.create',
|
||||
'admin.area.update',
|
||||
'admin.area.delete',
|
||||
AdminResources::AREA_VIEW,
|
||||
AdminResources::AREA_CREATE,
|
||||
AdminResources::AREA_UPDATE,
|
||||
AdminResources::AREA_DELETE,
|
||||
|
||||
TheliaEvents::AREA_CREATE,
|
||||
TheliaEvents::AREA_UPDATE,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
|
||||
@@ -46,10 +47,10 @@ class AttributeAvController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.attributes-av.view',
|
||||
'admin.configuration.attributes-av.create',
|
||||
'admin.configuration.attributes-av.update',
|
||||
'admin.configuration.attributes-av.delete',
|
||||
AdminResources::ATTRIBUTE_VIEW,
|
||||
AdminResources::ATTRIBUTE_CREATE,
|
||||
AdminResources::ATTRIBUTE_UPDATE,
|
||||
AdminResources::ATTRIBUTE_DELETE,
|
||||
|
||||
TheliaEvents::ATTRIBUTE_AV_CREATE,
|
||||
TheliaEvents::ATTRIBUTE_AV_UPDATE,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Attribute\AttributeDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeUpdateEvent;
|
||||
@@ -50,10 +51,10 @@ class AttributeController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.attributes.view',
|
||||
'admin.configuration.attributes.create',
|
||||
'admin.configuration.attributes.update',
|
||||
'admin.configuration.attributes.delete',
|
||||
AdminResources::ATTRIBUTE_VIEW,
|
||||
AdminResources::ATTRIBUTE_CREATE,
|
||||
AdminResources::ATTRIBUTE_UPDATE,
|
||||
AdminResources::ATTRIBUTE_DELETE,
|
||||
|
||||
TheliaEvents::ATTRIBUTE_CREATE,
|
||||
TheliaEvents::ATTRIBUTE_UPDATE,
|
||||
@@ -253,7 +254,7 @@ class AttributeController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Category\CategoryUpdateEvent;
|
||||
@@ -54,10 +55,10 @@ class CategoryController extends AbstractCrudController
|
||||
'manual',
|
||||
'category_order',
|
||||
|
||||
'admin.categories.default',
|
||||
'admin.categories.create',
|
||||
'admin.categories.update',
|
||||
'admin.categories.delete',
|
||||
AdminResources::CATEGORY_VIEW,
|
||||
AdminResources::CATEGORY_CREATE,
|
||||
AdminResources::CATEGORY_UPDATE,
|
||||
AdminResources::CATEGORY_DELETE,
|
||||
|
||||
TheliaEvents::CATEGORY_CREATE,
|
||||
TheliaEvents::CATEGORY_UPDATE,
|
||||
@@ -216,7 +217,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$event = new CategoryToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -296,7 +297,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -326,7 +327,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedPictureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) {
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -354,7 +355,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function deleteRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Config\ConfigDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Config\ConfigUpdateEvent;
|
||||
@@ -45,10 +46,10 @@ class ConfigController extends AbstractCrudController
|
||||
'name',
|
||||
'order',
|
||||
|
||||
'admin.configuration.variables.view',
|
||||
'admin.configuration.variables.create',
|
||||
'admin.configuration.variables.update',
|
||||
'admin.configuration.variables.delete',
|
||||
AdminResources::CONFIG_VIEW,
|
||||
AdminResources::CONFIG_CREATE,
|
||||
AdminResources::CONFIG_UPDATE,
|
||||
AdminResources::CONFIG_DELETE,
|
||||
|
||||
TheliaEvents::CONFIG_CREATE,
|
||||
TheliaEvents::CONFIG_UPDATE,
|
||||
@@ -187,7 +188,7 @@ class ConfigController extends AbstractCrudController
|
||||
public function changeValuesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$variables = $this->getRequest()->get('variable', array());
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Content\ContentAddFolderEvent;
|
||||
use Thelia\Core\Event\Content\ContentCreateEvent;
|
||||
use Thelia\Core\Event\Content\ContentDeleteEvent;
|
||||
@@ -49,10 +50,10 @@ class ContentController extends AbstractCrudController
|
||||
'manual',
|
||||
'content_order',
|
||||
|
||||
'admin.content.default',
|
||||
'admin.content.create',
|
||||
'admin.content.update',
|
||||
'admin.content.delete',
|
||||
AdminResources::CONTENT_VIEW,
|
||||
AdminResources::CONTENT_CREATE,
|
||||
AdminResources::CONTENT_UPDATE,
|
||||
AdminResources::CONTENT_DELETE,
|
||||
|
||||
TheliaEvents::CONTENT_CREATE,
|
||||
TheliaEvents::CONTENT_UPDATE,
|
||||
@@ -70,7 +71,7 @@ class ContentController extends AbstractCrudController
|
||||
public function addAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth('admin.content.update')) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
@@ -98,7 +99,7 @@ class ContentController extends AbstractCrudController
|
||||
public function removeAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth('admin.content.update')) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Country\CountryCreateEvent;
|
||||
use Thelia\Core\Event\Country\CountryDeleteEvent;
|
||||
use Thelia\Core\Event\Country\CountryToggleDefaultEvent;
|
||||
@@ -46,10 +47,10 @@ class CountryController extends AbstractCrudController
|
||||
'manual',
|
||||
'country_order',
|
||||
|
||||
'admin.country.default',
|
||||
'admin.country.create',
|
||||
'admin.country.update',
|
||||
'admin.country.delete',
|
||||
AdminResources::COUNTRY_VIEW,
|
||||
AdminResources::COUNTRY_CREATE,
|
||||
AdminResources::COUNTRY_UPDATE,
|
||||
AdminResources::COUNTRY_DELETE,
|
||||
|
||||
TheliaEvents::COUNTRY_CREATE,
|
||||
TheliaEvents::COUNTRY_UPDATE,
|
||||
|
||||
@@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Condition\ConditionCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
@@ -62,7 +63,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.view');
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
@@ -94,7 +95,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
|
||||
// Database request repeated in the loop but cached
|
||||
$search = CouponQuery::create();
|
||||
@@ -122,7 +123,7 @@ class CouponController extends BaseAdminController
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth('admin.coupon.create');
|
||||
$response = $this->checkAuth(AdminResources::COUPON_CREATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ class CouponController extends BaseAdminController
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth('admin.coupon.update');
|
||||
$response = $this->checkAuth(AdminResources::COUPON_UPDATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -277,7 +278,7 @@ var_dump($coupon->getIsRemovingPostage());;
|
||||
*/
|
||||
public function getConditionInputAction($conditionId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -307,7 +308,7 @@ var_dump($coupon->getIsRemovingPostage());;
|
||||
*/
|
||||
public function updateConditionsAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.coupon.read');
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Currency\CurrencyDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Currency\CurrencyUpdateEvent;
|
||||
@@ -46,10 +47,10 @@ class CurrencyController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.currencies.view',
|
||||
'admin.configuration.currencies.create',
|
||||
'admin.configuration.currencies.update',
|
||||
'admin.configuration.currencies.delete',
|
||||
AdminResources::CURRENCY_VIEW,
|
||||
AdminResources::CURRENCY_CREATE,
|
||||
AdminResources::CURRENCY_UPDATE,
|
||||
AdminResources::CURRENCY_DELETE,
|
||||
|
||||
TheliaEvents::CURRENCY_CREATE,
|
||||
TheliaEvents::CURRENCY_UPDATE,
|
||||
@@ -186,7 +187,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
@@ -204,7 +205,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function setDefaultAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$changeEvent = new CurrencyUpdateEvent($this->getRequest()->get('currency_id', 0));
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Controller\Admin;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Thelia\Core\Event\Address\AddressEvent;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Customer\CustomerAddressEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
@@ -45,13 +46,13 @@ class CustomerController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_VIEW)) return $response;
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
}
|
||||
|
||||
public function viewAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_VIEW)) return $response;
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
@@ -67,7 +68,7 @@ class CustomerController extends BaseAdminController
|
||||
*/
|
||||
public function updateAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_UPDATE)) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
@@ -123,7 +124,7 @@ class CustomerController extends BaseAdminController
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.customer.delete")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_DELETE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Feature\FeatureAvDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
|
||||
@@ -46,10 +47,10 @@ class FeatureAvController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.features-av.view',
|
||||
'admin.configuration.features-av.create',
|
||||
'admin.configuration.features-av.update',
|
||||
'admin.configuration.features-av.delete',
|
||||
AdminResources::FEATURE_VIEW,
|
||||
AdminResources::FEATURE_CREATE,
|
||||
AdminResources::FEATURE_UPDATE,
|
||||
AdminResources::FEATURE_DELETE,
|
||||
|
||||
TheliaEvents::FEATURE_AV_CREATE,
|
||||
TheliaEvents::FEATURE_AV_UPDATE,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Feature\FeatureDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureUpdateEvent;
|
||||
@@ -50,10 +51,10 @@ class FeatureController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.features.view',
|
||||
'admin.configuration.features.create',
|
||||
'admin.configuration.features.update',
|
||||
'admin.configuration.features.delete',
|
||||
AdminResources::FEATURE_VIEW,
|
||||
AdminResources::FEATURE_CREATE,
|
||||
AdminResources::FEATURE_UPDATE,
|
||||
AdminResources::FEATURE_DELETE,
|
||||
|
||||
TheliaEvents::FEATURE_CREATE,
|
||||
TheliaEvents::FEATURE_UPDATE,
|
||||
@@ -253,7 +254,7 @@ class FeatureController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.features.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Controller\Admin;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Document\DocumentDeleteEvent;
|
||||
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
@@ -69,7 +70,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveImageAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.image.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -145,7 +146,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveDocumentAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.document.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -209,7 +210,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.image.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -226,7 +227,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.document.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -243,7 +244,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.image.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -260,7 +261,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.document.save');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -277,7 +278,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('admin.image.view')) {
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -306,7 +307,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('admin.document.view')) {
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -335,7 +336,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('admin.image.update')) {
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -412,7 +413,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('admin.document.update')) {
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -489,7 +490,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteImageAction($imageId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.image.delete');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
@@ -532,7 +533,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteDocumentAction($documentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', 'admin.document.delete');
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Folder\FolderCreateEvent;
|
||||
use Thelia\Core\Event\Folder\FolderDeleteEvent;
|
||||
use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
|
||||
@@ -47,10 +48,10 @@ class FolderController extends AbstractCrudController
|
||||
'manual',
|
||||
'folder_order',
|
||||
|
||||
'admin.folder.default',
|
||||
'admin.folder.create',
|
||||
'admin.folder.update',
|
||||
'admin.folder.delete',
|
||||
AdminResources::FOLDER_VIEW,
|
||||
AdminResources::FOLDER_CREATE,
|
||||
AdminResources::FOLDER_UPDATE,
|
||||
AdminResources::FOLDER_DELETE,
|
||||
|
||||
TheliaEvents::FOLDER_CREATE,
|
||||
TheliaEvents::FOLDER_UPDATE,
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
|
||||
/**
|
||||
* Class LanguageController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -32,7 +34,7 @@ class LanguageController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.languages.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE_VIEW)) return $response;
|
||||
return $this->render("languages");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
|
||||
/**
|
||||
* Class MailingSystemController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -32,7 +34,7 @@ class MailingSystemController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.mailing-system.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM_VIEW)) return $response;
|
||||
return $this->render("mailing-system");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Message\MessageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;use Thelia\Core\Event\Message\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\Message\MessageCreateEvent;
|
||||
@@ -44,10 +45,10 @@ class MessageController extends AbstractCrudController
|
||||
null, // no sort order change
|
||||
null, // no sort order change
|
||||
|
||||
'admin.configuration.messages.view',
|
||||
'admin.configuration.messages.create',
|
||||
'admin.configuration.messages.update',
|
||||
'admin.configuration.messages.delete',
|
||||
AdminResources::MESSAGE_VIEW,
|
||||
AdminResources::MESSAGE_CREATE,
|
||||
AdminResources::MESSAGE_UPDATE,
|
||||
AdminResources::MESSAGE_DELETE,
|
||||
|
||||
TheliaEvents::MESSAGE_CREATE,
|
||||
TheliaEvents::MESSAGE_UPDATE,
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
|
||||
/**
|
||||
* Class ModuleController
|
||||
* @package Thelia\Controller\Admin
|
||||
@@ -32,7 +34,7 @@ class ModuleController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.module.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE_VIEW)) return $response;
|
||||
return $this->render("modules", array("display_module" => 20));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\PdfEvent;
|
||||
@@ -44,7 +45,7 @@ class OrderController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.orders.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_VIEW)) return $response;
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateStatus($order_id = null)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.order.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -108,7 +109,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateDeliveryRef($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.order.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -143,7 +144,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateAddress($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.order.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -209,7 +210,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
protected function generatePdf($order_id, $fileName)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.order.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
|
||||
|
||||
$html = $this->renderRaw(
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
||||
@@ -61,10 +62,10 @@ class ProductController extends AbstractCrudController
|
||||
'manual',
|
||||
'product_order',
|
||||
|
||||
'admin.products.default',
|
||||
'admin.products.create',
|
||||
'admin.products.update',
|
||||
'admin.products.delete',
|
||||
AdminResources::PRODUCT_VIEW,
|
||||
AdminResources::PRODUCT_CREATE,
|
||||
AdminResources::PRODUCT_UPDATE,
|
||||
AdminResources::PRODUCT_DELETE,
|
||||
|
||||
TheliaEvents::PRODUCT_CREATE,
|
||||
TheliaEvents::PRODUCT_UPDATE,
|
||||
@@ -280,7 +281,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$event = new ProductToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -356,7 +357,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -382,7 +383,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -434,7 +435,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -459,7 +460,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -515,7 +516,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setProductTemplateAction($productId)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth('admin.products.update')) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$product = ProductQuery::create()->findPk($productId);
|
||||
|
||||
@@ -612,7 +613,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->request->get('additional_category_id'));
|
||||
|
||||
@@ -637,7 +638,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->get('additional_category_id'));
|
||||
|
||||
@@ -734,7 +735,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$event = new ProductCreateCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -759,7 +760,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$event = new ProductDeleteCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Profile\ProfileEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\ProfileCreationForm;
|
||||
@@ -39,10 +40,10 @@ class ProfileController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.profile.view',
|
||||
'admin.configuration.profile.create',
|
||||
'admin.configuration.profile.update',
|
||||
'admin.configuration.profile.delete',
|
||||
AdminResources::PRODUCT_VIEW,
|
||||
AdminResources::PRODUCT_CREATE,
|
||||
AdminResources::PRODUCT_UPDATE,
|
||||
AdminResources::PRODUCT_DELETE,
|
||||
|
||||
TheliaEvents::PROFILE_CREATE,
|
||||
TheliaEvents::PROFILE_UPDATE,
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\ShippingZone\ShippingZoneAddAreaEvent;
|
||||
use Thelia\Core\Event\ShippingZone\ShippingZoneRemoveAreaEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -40,13 +41,13 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.shipping-zones.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_VIEW)) return $response;
|
||||
return $this->render("shipping-zones", array("display_shipping_zone" => 20));
|
||||
}
|
||||
|
||||
public function updateAction($shipping_zones_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.shipping-zones.view")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_VIEW)) return $response;
|
||||
return $this->render("shipping-zones-edit", array(
|
||||
"shipping_zones_id" => $shipping_zones_id
|
||||
));
|
||||
@@ -57,7 +58,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
*/
|
||||
public function addArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.shipping-zones.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneAddArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
@@ -92,7 +93,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function removeArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.shipping-zones.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneRemoveArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Tax\TaxEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\TaxCreationForm;
|
||||
@@ -39,10 +40,10 @@ class TaxController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.tax.view',
|
||||
'admin.configuration.tax.create',
|
||||
'admin.configuration.tax.update',
|
||||
'admin.configuration.tax.delete',
|
||||
AdminResources::TAX_VIEW,
|
||||
AdminResources::TAX_CREATE,
|
||||
AdminResources::TAX_UPDATE,
|
||||
AdminResources::TAX_DELETE,
|
||||
|
||||
TheliaEvents::TAX_CREATE,
|
||||
TheliaEvents::TAX_UPDATE,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Tax\TaxRuleEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\TaxRuleCreationForm;
|
||||
@@ -40,10 +41,10 @@ class TaxRuleController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.taxrule.view',
|
||||
'admin.configuration.taxrule.create',
|
||||
'admin.configuration.taxrule.update',
|
||||
'admin.configuration.taxrule.delete',
|
||||
AdminResources::TAX_VIEW,
|
||||
AdminResources::TAX_CREATE,
|
||||
AdminResources::TAX_UPDATE,
|
||||
AdminResources::TAX_DELETE,
|
||||
|
||||
TheliaEvents::TAX_RULE_CREATE,
|
||||
TheliaEvents::TAX_RULE_UPDATE,
|
||||
@@ -256,7 +257,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
public function processUpdateTaxesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth('admin.configuration.taxrule.update')) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Template\TemplateUpdateEvent;
|
||||
@@ -51,10 +52,10 @@ class TemplateController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
'admin.configuration.templates.view',
|
||||
'admin.configuration.templates.create',
|
||||
'admin.configuration.templates.update',
|
||||
'admin.configuration.templates.delete',
|
||||
AdminResources::TEMPLATE_VIEW,
|
||||
AdminResources::TEMPLATE_CREATE,
|
||||
AdminResources::TEMPLATE_UPDATE,
|
||||
AdminResources::TEMPLATE_DELETE,
|
||||
|
||||
TheliaEvents::TEMPLATE_CREATE,
|
||||
TheliaEvents::TEMPLATE_UPDATE,
|
||||
@@ -212,7 +213,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.add")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
|
||||
$attribute_id = intval($this->getRequest()->get('attribute_id'));
|
||||
|
||||
@@ -236,7 +237,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.delete")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteAttributeEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -271,7 +272,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.feature.add")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
|
||||
$feature_id = intval($this->getRequest()->get('feature_id'));
|
||||
|
||||
@@ -295,7 +296,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.template.feature.delete")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteFeatureEvent(
|
||||
$this->getExistingObject(),
|
||||
|
||||
@@ -21,19 +21,19 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
namespace Thelia\Core\Security\Exception;
|
||||
|
||||
/**
|
||||
* Class AdminProfileController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AdminProfileController extends BaseAdminController
|
||||
class ResourceException extends \RuntimeException
|
||||
{
|
||||
public function defaultAction()
|
||||
const UNKNOWN_EXCEPTION = 0;
|
||||
|
||||
const RESOURCE_NOT_FOUND = 404;
|
||||
|
||||
public function __construct($message, $code = null, $previous = null)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.admin-profile.view")) return $response;
|
||||
return $this->render("admin-profiles", array("display_admin_profile" => 20));
|
||||
if ($code === null) {
|
||||
$code = self::UNKNOWN_EXCEPTION;
|
||||
}
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
167
core/lib/Thelia/Core/Security/Resource/AdminResources.php
Normal file
167
core/lib/Thelia/Core/Security/Resource/AdminResources.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Core\Security\Exception\ResourceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class contains all Thelia admin resources
|
||||
*
|
||||
* @author Etienne roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
final class AdminResources
|
||||
{
|
||||
static private $selfReflection = null;
|
||||
|
||||
static public function retrieve($name, $action)
|
||||
{
|
||||
$contantName = strtoupper($name . '_' . $action);
|
||||
|
||||
if(null === self::$selfReflection) {
|
||||
self::$selfReflection = new \ReflectionClass(__CLASS__);
|
||||
}
|
||||
|
||||
if(self::$selfReflection->hasConstant($contantName)) {
|
||||
return self::$selfReflection->getConstant($contantName);
|
||||
} else {
|
||||
throw new ResourceException(sprintf('Resource `%s` not found', $contantName), ResourceException::RESOURCE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
const ADDRESS_VIEW = "admin.address.view";
|
||||
const ADDRESS_CREATE = "admin.address.create";
|
||||
const ADDRESS_UPDATE = "admin.address.update";
|
||||
const ADDRESS_DELETE = "admin.address.delete";
|
||||
|
||||
const ADMIN_VIEW = "admin.configuration.admin.view";
|
||||
const ADMIN_CREATE = "admin.configuration.admin.create";
|
||||
const ADMIN_UPDATE = "admin.configuration.admin.update";
|
||||
const ADMIN_DELETE = "admin.configuration.admin.delete";
|
||||
|
||||
const AREA_VIEW = "admin.configuration.area.view";
|
||||
const AREA_CREATE = "admin.configuration.area.create";
|
||||
const AREA_UPDATE = "admin.configuration.area.update";
|
||||
const AREA_DELETE = "admin.configuration.area.delete";
|
||||
|
||||
const ATTRIBUTE_VIEW = "admin.configuration.attribute.view";
|
||||
const ATTRIBUTE_CREATE = "admin.configuration.attribute.create";
|
||||
const ATTRIBUTE_UPDATE = "admin.configuration.attribute.update";
|
||||
const ATTRIBUTE_DELETE = "admin.configuration.attribute.delete";
|
||||
|
||||
const CATEGORY_VIEW = "admin.category.view";
|
||||
const CATEGORY_CREATE = "admin.category.create";
|
||||
const CATEGORY_UPDATE = "admin.category.update";
|
||||
const CATEGORY_DELETE = "admin.category.delete";
|
||||
|
||||
const CONFIG_VIEW = "admin.configuration.view";
|
||||
const CONFIG_CREATE = "admin.configuration.create";
|
||||
const CONFIG_UPDATE = "admin.configuration.update";
|
||||
const CONFIG_DELETE = "admin.configuration.delete";
|
||||
|
||||
const CONTENT_VIEW = "admin.content.view";
|
||||
const CONTENT_CREATE = "admin.content.create";
|
||||
const CONTENT_UPDATE = "admin.content.update";
|
||||
const CONTENT_DELETE = "admin.content.delete";
|
||||
|
||||
const COUNTRY_VIEW = "admin.configuration.country.view";
|
||||
const COUNTRY_CREATE = "admin.configuration.country.create";
|
||||
const COUNTRY_UPDATE = "admin.configuration.country.update";
|
||||
const COUNTRY_DELETE = "admin.configuration.country.delete";
|
||||
|
||||
const COUPON_VIEW = "admin.coupon.view";
|
||||
const COUPON_CREATE = "admin.coupon.create";
|
||||
const COUPON_UPDATE = "admin.coupon.update";
|
||||
const COUPON_DELETE = "admin.coupon.delete";
|
||||
|
||||
const CURRENCY_VIEW = "admin.configuration.currency.view";
|
||||
const CURRENCY_CREATE = "admin.configuration.currency.create";
|
||||
const CURRENCY_UPDATE = "admin.configuration.currency.update";
|
||||
const CURRENCY_DELETE = "admin.configuration.currency.delete";
|
||||
|
||||
const CUSTOMER_VIEW = "admin.customer.view";
|
||||
const CUSTOMER_CREATE = "admin.customer.create";
|
||||
const CUSTOMER_UPDATE = "admin.customer.update";
|
||||
const CUSTOMER_DELETE = "admin.customer.delete";
|
||||
|
||||
const FEATURE_VIEW = "admin.configuration.feature.view";
|
||||
const FEATURE_CREATE = "admin.configuration.feature.create";
|
||||
const FEATURE_UPDATE = "admin.configuration.feature.update";
|
||||
const FEATURE_DELETE = "admin.configuration.feature.delete";
|
||||
|
||||
const FOLDER_VIEW = "admin.folder.view";
|
||||
const FOLDER_CREATE = "admin.folder.create";
|
||||
const FOLDER_UPDATE = "admin.folder.update";
|
||||
const FOLDER_DELETE = "admin.folder.delete";
|
||||
|
||||
const LANGUAGE_VIEW = "admin.configuration.language.view";
|
||||
const LANGUAGE_CREATE = "admin.configuration.language.create";
|
||||
const LANGUAGE_UPDATE = "admin.configuration.language.update";
|
||||
const LANGUAGE_DELETE = "admin.configuration.language.delete";
|
||||
|
||||
const MAILING_SYSTEM_VIEW = "admin.configuration.mailing-system.view";
|
||||
const MAILING_SYSTEM_CREATE = "admin.configuration.mailing-system.create";
|
||||
const MAILING_SYSTEM_UPDATE = "admin.configuration.mailing-system.update";
|
||||
const MAILING_SYSTEM_DELETE = "admin.configuration.mailing-system.delete";
|
||||
|
||||
const MESSAGE_VIEW = "admin.configuration.message.view";
|
||||
const MESSAGE_CREATE = "admin.configuration.message.create";
|
||||
const MESSAGE_UPDATE = "admin.configuration.message.update";
|
||||
const MESSAGE_DELETE = "admin.configuration.message.delete";
|
||||
|
||||
const MODULE_VIEW = "admin.configuration.module.view";
|
||||
const MODULE_CREATE = "admin.configuration.module.create";
|
||||
const MODULE_UPDATE = "admin.configuration.module.update";
|
||||
const MODULE_DELETE = "admin.configuration.module.delete";
|
||||
|
||||
const ORDER_VIEW = "admin.order.view";
|
||||
const ORDER_CREATE = "admin.order.create";
|
||||
const ORDER_UPDATE = "admin.order.update";
|
||||
const ORDER_DELETE = "admin.order.delete";
|
||||
|
||||
const PRODUCT_VIEW = "admin.product.view";
|
||||
const PRODUCT_CREATE = "admin.product.create";
|
||||
const PRODUCT_UPDATE = "admin.product.update";
|
||||
const PRODUCT_DELETE = "admin.product.delete";
|
||||
|
||||
const PROFILE_VIEW = "admin.configuration.profile.view";
|
||||
const PROFILE_CREATE = "admin.configuration.profile.create";
|
||||
const PROFILE_UPDATE = "admin.configuration.profile.update";
|
||||
const PROFILE_DELETE = "admin.configuration.profile.delete";
|
||||
|
||||
const SHIPPING_ZONE_VIEW = "admin.configuration.shipping-zone.view";
|
||||
const SHIPPING_ZONE_CREATE = "admin.configuration.shipping-zone.create";
|
||||
const SHIPPING_ZONE_UPDATE = "admin.configuration.shipping-zone.update";
|
||||
const SHIPPING_ZONE_DELETE = "admin.configuration.shipping-zone.delete";
|
||||
|
||||
const TAX_VIEW = "admin.configuration.tax.view";
|
||||
const TAX_CREATE = "admin.configuration.tax.create";
|
||||
const TAX_UPDATE = "admin.configuration.tax.update";
|
||||
const TAX_DELETE = "admin.configuration.tax.delete";
|
||||
|
||||
const TEMPLATE_VIEW = "admin.configuration.template.view";
|
||||
const TEMPLATE_CREATE = "admin.configuration.template.create";
|
||||
const TEMPLATE_UPDATE = "admin.configuration.template.update";
|
||||
const TEMPLATE_DELETE = "admin.configuration.template.delete";
|
||||
}
|
||||
104
core/lib/Thelia/Core/Template/Loop/Admin.php
Executable file
104
core/lib/Thelia/Core/Template/Loop/Admin.php
Executable file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\AdminQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Admin loop
|
||||
*
|
||||
*
|
||||
* Class Admin
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Admin extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('profile')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = AdminQuery::create();
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
if (null !== $id) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$profile = $this->getProfile();
|
||||
|
||||
if (null !== $profile) {
|
||||
$search->filterByProfileId($profile, Criteria::IN);
|
||||
}
|
||||
|
||||
$search->orderByFirstname(Criteria::ASC);
|
||||
|
||||
/* perform search */
|
||||
$features = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($features);
|
||||
|
||||
foreach ($features as $feature) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $feature->getId())
|
||||
->set("PROFILE",$feature->getProfileId())
|
||||
->set("FIRSTNAME",$feature->getFirstname())
|
||||
->set("LASTNAME",$feature->getLastname())
|
||||
->set("LOGIN",$feature->getLogin())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ProfileQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AdminProfile as BaseAdminProfile;
|
||||
|
||||
class AdminProfile extends BaseAdminProfile
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AdminProfileQuery as BaseAdminProfileQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'admin_profile' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class AdminProfileQuery extends BaseAdminProfileQuery
|
||||
{
|
||||
|
||||
} // AdminProfileQuery
|
||||
@@ -10,7 +10,6 @@ use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\BadMethodCallException;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
@@ -18,8 +17,6 @@ use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Admin as ChildAdmin;
|
||||
use Thelia\Model\AdminProfile as ChildAdminProfile;
|
||||
use Thelia\Model\AdminProfileQuery as ChildAdminProfileQuery;
|
||||
use Thelia\Model\AdminQuery as ChildAdminQuery;
|
||||
use Thelia\Model\Profile as ChildProfile;
|
||||
use Thelia\Model\ProfileQuery as ChildProfileQuery;
|
||||
@@ -65,6 +62,12 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the profile_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $profile_id;
|
||||
|
||||
/**
|
||||
* The value for the firstname field.
|
||||
* @var string
|
||||
@@ -126,15 +129,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAdminProfile[] Collection to store aggregation of ChildAdminProfile objects.
|
||||
* @var Profile
|
||||
*/
|
||||
protected $collAdminProfiles;
|
||||
protected $collAdminProfilesPartial;
|
||||
|
||||
/**
|
||||
* @var ChildProfile[] Collection to store aggregation of ChildProfile objects.
|
||||
*/
|
||||
protected $collProfiles;
|
||||
protected $aProfile;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -144,18 +141,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $profilesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $adminProfilesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Admin object.
|
||||
*/
|
||||
@@ -425,6 +410,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [profile_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getProfileId()
|
||||
{
|
||||
|
||||
return $this->profile_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [firstname] column value.
|
||||
*
|
||||
@@ -574,6 +570,31 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [profile_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function setProfileId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->profile_id !== $v) {
|
||||
$this->profile_id = $v;
|
||||
$this->modifiedColumns[] = AdminTableMap::PROFILE_ID;
|
||||
}
|
||||
|
||||
if ($this->aProfile !== null && $this->aProfile->getId() !== $v) {
|
||||
$this->aProfile = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setProfileId()
|
||||
|
||||
/**
|
||||
* Set the value of [firstname] column.
|
||||
*
|
||||
@@ -824,37 +845,40 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AdminTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AdminTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AdminTableMap::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->profile_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AdminTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->firstname = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AdminTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AdminTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->lastname = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AdminTableMap::translateFieldName('Login', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AdminTableMap::translateFieldName('Login', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->login = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AdminTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AdminTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->password = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->algo = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->salt = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_token = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -867,7 +891,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 11; // 11 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 12; // 12 = AdminTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
|
||||
@@ -889,6 +913,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
public function ensureConsistency()
|
||||
{
|
||||
if ($this->aProfile !== null && $this->profile_id !== $this->aProfile->getId()) {
|
||||
$this->aProfile = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -928,9 +955,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collAdminProfiles = null;
|
||||
|
||||
$this->collProfiles = null;
|
||||
$this->aProfile = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -1053,6 +1078,18 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
// We call the save method on the following object(s) if they
|
||||
// were passed to this object by their corresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->aProfile !== null) {
|
||||
if ($this->aProfile->isModified() || $this->aProfile->isNew()) {
|
||||
$affectedRows += $this->aProfile->save($con);
|
||||
}
|
||||
$this->setProfile($this->aProfile);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -1064,50 +1101,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->profilesScheduledForDeletion !== null) {
|
||||
if (!$this->profilesScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->profilesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
}
|
||||
|
||||
AdminProfileQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->profilesScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getProfiles() as $profile) {
|
||||
if ($profile->isModified()) {
|
||||
$profile->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collProfiles) {
|
||||
foreach ($this->collProfiles as $profile) {
|
||||
if ($profile->isModified()) {
|
||||
$profile->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adminProfilesScheduledForDeletion !== null) {
|
||||
if (!$this->adminProfilesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AdminProfileQuery::create()
|
||||
->filterByPrimaryKeys($this->adminProfilesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->adminProfilesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAdminProfiles !== null) {
|
||||
foreach ($this->collAdminProfiles as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -1137,6 +1130,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AdminTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::PROFILE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PROFILE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(AdminTableMap::FIRSTNAME)) {
|
||||
$modifiedColumns[':p' . $index++] = 'FIRSTNAME';
|
||||
}
|
||||
@@ -1181,6 +1177,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'PROFILE_ID':
|
||||
$stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'FIRSTNAME':
|
||||
$stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1277,33 +1276,36 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getFirstname();
|
||||
return $this->getProfileId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getLastname();
|
||||
return $this->getFirstname();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getLogin();
|
||||
return $this->getLastname();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getPassword();
|
||||
return $this->getLogin();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getAlgo();
|
||||
return $this->getPassword();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getSalt();
|
||||
return $this->getAlgo();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getRememberMeToken();
|
||||
return $this->getSalt();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getRememberMeSerial();
|
||||
return $this->getRememberMeToken();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getRememberMeSerial();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1336,16 +1338,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys = AdminTableMap::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getFirstname(),
|
||||
$keys[2] => $this->getLastname(),
|
||||
$keys[3] => $this->getLogin(),
|
||||
$keys[4] => $this->getPassword(),
|
||||
$keys[5] => $this->getAlgo(),
|
||||
$keys[6] => $this->getSalt(),
|
||||
$keys[7] => $this->getRememberMeToken(),
|
||||
$keys[8] => $this->getRememberMeSerial(),
|
||||
$keys[9] => $this->getCreatedAt(),
|
||||
$keys[10] => $this->getUpdatedAt(),
|
||||
$keys[1] => $this->getProfileId(),
|
||||
$keys[2] => $this->getFirstname(),
|
||||
$keys[3] => $this->getLastname(),
|
||||
$keys[4] => $this->getLogin(),
|
||||
$keys[5] => $this->getPassword(),
|
||||
$keys[6] => $this->getAlgo(),
|
||||
$keys[7] => $this->getSalt(),
|
||||
$keys[8] => $this->getRememberMeToken(),
|
||||
$keys[9] => $this->getRememberMeSerial(),
|
||||
$keys[10] => $this->getCreatedAt(),
|
||||
$keys[11] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1353,8 +1356,8 @@ abstract class Admin implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->collAdminProfiles) {
|
||||
$result['AdminProfiles'] = $this->collAdminProfiles->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->aProfile) {
|
||||
$result['Profile'] = $this->aProfile->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1394,33 +1397,36 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setFirstname($value);
|
||||
$this->setProfileId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setLastname($value);
|
||||
$this->setFirstname($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setLogin($value);
|
||||
$this->setLastname($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setPassword($value);
|
||||
$this->setLogin($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setAlgo($value);
|
||||
$this->setPassword($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setSalt($value);
|
||||
$this->setAlgo($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setRememberMeToken($value);
|
||||
$this->setSalt($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setRememberMeSerial($value);
|
||||
$this->setRememberMeToken($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setRememberMeSerial($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1448,16 +1454,17 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$keys = AdminTableMap::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setFirstname($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setLastname($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLogin($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPassword($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setAlgo($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setRememberMeToken($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeSerial($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setProfileId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setFirstname($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setLogin($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setPassword($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setAlgo($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setSalt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setRememberMeToken($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setRememberMeSerial($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1470,6 +1477,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$criteria = new Criteria(AdminTableMap::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AdminTableMap::ID)) $criteria->add(AdminTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(AdminTableMap::PROFILE_ID)) $criteria->add(AdminTableMap::PROFILE_ID, $this->profile_id);
|
||||
if ($this->isColumnModified(AdminTableMap::FIRSTNAME)) $criteria->add(AdminTableMap::FIRSTNAME, $this->firstname);
|
||||
if ($this->isColumnModified(AdminTableMap::LASTNAME)) $criteria->add(AdminTableMap::LASTNAME, $this->lastname);
|
||||
if ($this->isColumnModified(AdminTableMap::LOGIN)) $criteria->add(AdminTableMap::LOGIN, $this->login);
|
||||
@@ -1543,6 +1551,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setProfileId($this->getProfileId());
|
||||
$copyObj->setFirstname($this->getFirstname());
|
||||
$copyObj->setLastname($this->getLastname());
|
||||
$copyObj->setLogin($this->getLogin());
|
||||
@@ -1553,20 +1562,6 @@ abstract class Admin implements ActiveRecordInterface
|
||||
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach ($this->getAdminProfiles() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addAdminProfile($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
} // if ($deepCopy)
|
||||
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
@@ -1595,449 +1590,55 @@ abstract class Admin implements ActiveRecordInterface
|
||||
return $copyObj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a ChildProfile object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('AdminProfile' == $relationName) {
|
||||
return $this->initAdminProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAdminProfiles collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addAdminProfiles()
|
||||
*/
|
||||
public function clearAdminProfiles()
|
||||
{
|
||||
$this->collAdminProfiles = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collAdminProfiles collection loaded partially.
|
||||
*/
|
||||
public function resetPartialAdminProfiles($v = true)
|
||||
{
|
||||
$this->collAdminProfilesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAdminProfiles collection.
|
||||
*
|
||||
* By default this just sets the collAdminProfiles collection to an empty array (like clearcollAdminProfiles());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAdminProfiles($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAdminProfiles && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAdminProfiles = new ObjectCollection();
|
||||
$this->collAdminProfiles->setModel('\Thelia\Model\AdminProfile');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildAdminProfile objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildAdmin is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
|
||||
* @param ChildProfile $v
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdminProfiles($criteria = null, ConnectionInterface $con = null)
|
||||
public function setProfile(ChildProfile $v = null)
|
||||
{
|
||||
$partial = $this->collAdminProfilesPartial && !$this->isNew();
|
||||
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminProfiles) {
|
||||
// return empty collection
|
||||
$this->initAdminProfiles();
|
||||
} else {
|
||||
$collAdminProfiles = ChildAdminProfileQuery::create(null, $criteria)
|
||||
->filterByAdmin($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAdminProfilesPartial && count($collAdminProfiles)) {
|
||||
$this->initAdminProfiles(false);
|
||||
|
||||
foreach ($collAdminProfiles as $obj) {
|
||||
if (false == $this->collAdminProfiles->contains($obj)) {
|
||||
$this->collAdminProfiles->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminProfilesPartial = true;
|
||||
}
|
||||
|
||||
$collAdminProfiles->getInternalIterator()->rewind();
|
||||
|
||||
return $collAdminProfiles;
|
||||
}
|
||||
|
||||
if ($partial && $this->collAdminProfiles) {
|
||||
foreach ($this->collAdminProfiles as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collAdminProfiles[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = $collAdminProfiles;
|
||||
$this->collAdminProfilesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAdminProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AdminProfile objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $adminProfiles A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function setAdminProfiles(Collection $adminProfiles, ConnectionInterface $con = null)
|
||||
{
|
||||
$adminProfilesToDelete = $this->getAdminProfiles(new Criteria(), $con)->diff($adminProfiles);
|
||||
|
||||
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->adminProfilesScheduledForDeletion = clone $adminProfilesToDelete;
|
||||
|
||||
foreach ($adminProfilesToDelete as $adminProfileRemoved) {
|
||||
$adminProfileRemoved->setAdmin(null);
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = null;
|
||||
foreach ($adminProfiles as $adminProfile) {
|
||||
$this->addAdminProfile($adminProfile);
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = $adminProfiles;
|
||||
$this->collAdminProfilesPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AdminProfile objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related AdminProfile objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAdminProfiles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAdminProfilesPartial && !$this->isNew();
|
||||
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminProfiles) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getAdminProfiles());
|
||||
}
|
||||
|
||||
$query = ChildAdminProfileQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAdmin($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collAdminProfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildAdminProfile object to this object
|
||||
* through the ChildAdminProfile foreign key attribute.
|
||||
*
|
||||
* @param ChildAdminProfile $l ChildAdminProfile
|
||||
* @return \Thelia\Model\Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function addAdminProfile(ChildAdminProfile $l)
|
||||
{
|
||||
if ($this->collAdminProfiles === null) {
|
||||
$this->initAdminProfiles();
|
||||
$this->collAdminProfilesPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collAdminProfiles->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdminProfile($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminProfile $adminProfile The adminProfile object to add.
|
||||
*/
|
||||
protected function doAddAdminProfile($adminProfile)
|
||||
{
|
||||
$this->collAdminProfiles[]= $adminProfile;
|
||||
$adminProfile->setAdmin($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminProfile $adminProfile The adminProfile object to remove.
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAdminProfile($adminProfile)
|
||||
{
|
||||
if ($this->getAdminProfiles()->contains($adminProfile)) {
|
||||
$this->collAdminProfiles->remove($this->collAdminProfiles->search($adminProfile));
|
||||
if (null === $this->adminProfilesScheduledForDeletion) {
|
||||
$this->adminProfilesScheduledForDeletion = clone $this->collAdminProfiles;
|
||||
$this->adminProfilesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->adminProfilesScheduledForDeletion[]= clone $adminProfile;
|
||||
$adminProfile->setAdmin(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Admin is new, it will return
|
||||
* an empty collection; or if this Admin has previously
|
||||
* been saved, it will retrieve related AdminProfiles from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Admin.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
|
||||
*/
|
||||
public function getAdminProfilesJoinProfile($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAdminProfileQuery::create(null, $criteria);
|
||||
$query->joinWith('Profile', $joinBehavior);
|
||||
|
||||
return $this->getAdminProfiles($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collProfiles collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addProfiles()
|
||||
*/
|
||||
public function clearProfiles()
|
||||
{
|
||||
$this->collProfiles = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collProfilesPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collProfiles collection.
|
||||
*
|
||||
* By default this just sets the collProfiles collection to an empty collection (like clearProfiles());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initProfiles()
|
||||
{
|
||||
$this->collProfiles = new ObjectCollection();
|
||||
$this->collProfiles->setModel('\Thelia\Model\Profile');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildProfile objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildAdmin is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildProfile[] List of ChildProfile objects
|
||||
*/
|
||||
public function getProfiles($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collProfiles || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collProfiles) {
|
||||
// return empty collection
|
||||
$this->initProfiles();
|
||||
} else {
|
||||
$collProfiles = ChildProfileQuery::create(null, $criteria)
|
||||
->filterByAdmin($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collProfiles;
|
||||
}
|
||||
$this->collProfiles = $collProfiles;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Profile objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $profiles A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function setProfiles(Collection $profiles, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearProfiles();
|
||||
$currentProfiles = $this->getProfiles();
|
||||
|
||||
$this->profilesScheduledForDeletion = $currentProfiles->diff($profiles);
|
||||
|
||||
foreach ($profiles as $profile) {
|
||||
if (!$currentProfiles->contains($profile)) {
|
||||
$this->doAddProfile($profile);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collProfiles = $profiles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildProfile objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildProfile objects
|
||||
*/
|
||||
public function countProfiles($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collProfiles || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collProfiles) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildProfileQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAdmin($this)
|
||||
->count($con);
|
||||
}
|
||||
if ($v === null) {
|
||||
$this->setProfileId(NULL);
|
||||
} else {
|
||||
return count($this->collProfiles);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildProfile object to this object
|
||||
* through the admin_profile cross reference table.
|
||||
*
|
||||
* @param ChildProfile $profile The ChildAdminProfile object to relate
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
*/
|
||||
public function addProfile(ChildProfile $profile)
|
||||
{
|
||||
if ($this->collProfiles === null) {
|
||||
$this->initProfiles();
|
||||
$this->setProfileId($v->getId());
|
||||
}
|
||||
|
||||
if (!$this->collProfiles->contains($profile)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddProfile($profile);
|
||||
$this->collProfiles[] = $profile;
|
||||
$this->aProfile = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the ChildProfile object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAdmin($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Profile $profile The profile object to add.
|
||||
*/
|
||||
protected function doAddProfile($profile)
|
||||
{
|
||||
$adminProfile = new ChildAdminProfile();
|
||||
$adminProfile->setProfile($profile);
|
||||
$this->addAdminProfile($adminProfile);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$profile->getAdmins()->contains($this)) {
|
||||
$foreignCollection = $profile->getAdmins();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildProfile object to this object
|
||||
* through the admin_profile cross reference table.
|
||||
* Get the associated ChildProfile object
|
||||
*
|
||||
* @param ChildProfile $profile The ChildAdminProfile object to relate
|
||||
* @return ChildAdmin The current object (for fluent API support)
|
||||
* @param ConnectionInterface $con Optional Connection object.
|
||||
* @return ChildProfile The associated ChildProfile object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function removeProfile(ChildProfile $profile)
|
||||
public function getProfile(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->getProfiles()->contains($profile)) {
|
||||
$this->collProfiles->remove($this->collProfiles->search($profile));
|
||||
|
||||
if (null === $this->profilesScheduledForDeletion) {
|
||||
$this->profilesScheduledForDeletion = clone $this->collProfiles;
|
||||
$this->profilesScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->profilesScheduledForDeletion[] = $profile;
|
||||
if ($this->aProfile === null && ($this->profile_id !== null)) {
|
||||
$this->aProfile = ChildProfileQuery::create()->findPk($this->profile_id, $con);
|
||||
/* The following can be used additionally to
|
||||
guarantee the related object contains a reference
|
||||
to this object. This level of coupling may, however, be
|
||||
undesirable since it could result in an only partially populated collection
|
||||
in the referenced object.
|
||||
$this->aProfile->addAdmins($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this;
|
||||
return $this->aProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2046,6 +1647,7 @@ abstract class Admin implements ActiveRecordInterface
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->profile_id = null;
|
||||
$this->firstname = null;
|
||||
$this->lastname = null;
|
||||
$this->login = null;
|
||||
@@ -2075,26 +1677,9 @@ abstract class Admin implements ActiveRecordInterface
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collAdminProfiles) {
|
||||
foreach ($this->collAdminProfiles as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collProfiles) {
|
||||
foreach ($this->collProfiles as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->collAdminProfiles instanceof Collection) {
|
||||
$this->collAdminProfiles->clearIterator();
|
||||
}
|
||||
$this->collAdminProfiles = null;
|
||||
if ($this->collProfiles instanceof Collection) {
|
||||
$this->collProfiles->clearIterator();
|
||||
}
|
||||
$this->collProfiles = null;
|
||||
$this->aProfile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,778 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\AdminProfile as ChildAdminProfile;
|
||||
use Thelia\Model\AdminProfileQuery as ChildAdminProfileQuery;
|
||||
use Thelia\Model\Map\AdminProfileTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'admin_profile' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildAdminProfileQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAdminProfileQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
|
||||
* @method ChildAdminProfileQuery orderByAdminId($order = Criteria::ASC) Order by the admin_id column
|
||||
* @method ChildAdminProfileQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildAdminProfileQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAdminProfileQuery groupById() Group by the id column
|
||||
* @method ChildAdminProfileQuery groupByProfileId() Group by the profile_id column
|
||||
* @method ChildAdminProfileQuery groupByAdminId() Group by the admin_id column
|
||||
* @method ChildAdminProfileQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildAdminProfileQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildAdminProfileQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildAdminProfileQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildAdminProfileQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildAdminProfileQuery leftJoinProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminProfileQuery rightJoinProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminProfileQuery innerJoinProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @method ChildAdminProfileQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
|
||||
* @method ChildAdminProfileQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
|
||||
* @method ChildAdminProfileQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @method ChildAdminProfile findOne(ConnectionInterface $con = null) Return the first ChildAdminProfile matching the query
|
||||
* @method ChildAdminProfile findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAdminProfile matching the query, or a new ChildAdminProfile object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAdminProfile findOneById(int $id) Return the first ChildAdminProfile filtered by the id column
|
||||
* @method ChildAdminProfile findOneByProfileId(int $profile_id) Return the first ChildAdminProfile filtered by the profile_id column
|
||||
* @method ChildAdminProfile findOneByAdminId(int $admin_id) Return the first ChildAdminProfile filtered by the admin_id column
|
||||
* @method ChildAdminProfile findOneByCreatedAt(string $created_at) Return the first ChildAdminProfile filtered by the created_at column
|
||||
* @method ChildAdminProfile findOneByUpdatedAt(string $updated_at) Return the first ChildAdminProfile filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAdminProfile objects filtered by the id column
|
||||
* @method array findByProfileId(int $profile_id) Return ChildAdminProfile objects filtered by the profile_id column
|
||||
* @method array findByAdminId(int $admin_id) Return ChildAdminProfile objects filtered by the admin_id column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildAdminProfile objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildAdminProfile objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class AdminProfileQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\AdminProfileQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AdminProfile', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildAdminProfileQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildAdminProfileQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\AdminProfileQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\AdminProfileQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(array(12, 34, 56), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param array[$id, $profile_id, $admin_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildAdminProfile|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = AdminProfileTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(AdminProfileTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildAdminProfile A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PROFILE_ID, ADMIN_ID, CREATED_AT, UPDATED_AT FROM admin_profile WHERE ID = :p0 AND PROFILE_ID = :p1 AND ADMIN_ID = :p2';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildAdminProfile();
|
||||
$obj->hydrate($row);
|
||||
AdminProfileTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildAdminProfile|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(AdminProfileTableMap::ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $key[1], Criteria::EQUAL);
|
||||
$this->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $key[2], Criteria::EQUAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(AdminProfileTableMap::ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(AdminProfileTableMap::PROFILE_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$cton2 = $this->getNewCriterion(AdminProfileTableMap::ADMIN_ID, $key[2], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton2);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminProfileTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the profile_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByProfileId(1234); // WHERE profile_id = 1234
|
||||
* $query->filterByProfileId(array(12, 34)); // WHERE profile_id IN (12, 34)
|
||||
* $query->filterByProfileId(array('min' => 12)); // WHERE profile_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByProfile()
|
||||
*
|
||||
* @param mixed $profileId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProfileId($profileId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($profileId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($profileId['min'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $profileId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($profileId['max'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $profileId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $profileId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the admin_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAdminId(1234); // WHERE admin_id = 1234
|
||||
* $query->filterByAdminId(array(12, 34)); // WHERE admin_id IN (12, 34)
|
||||
* $query->filterByAdminId(array('min' => 12)); // WHERE admin_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAdmin()
|
||||
*
|
||||
* @param mixed $adminId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdminId($adminId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($adminId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($adminId['min'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $adminId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($adminId['max'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $adminId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $adminId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminProfileTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(AdminProfileTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminProfileTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Profile object
|
||||
*
|
||||
* @param \Thelia\Model\Profile|ObjectCollection $profile The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProfile($profile, $comparison = null)
|
||||
{
|
||||
if ($profile instanceof \Thelia\Model\Profile) {
|
||||
return $this
|
||||
->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $profile->getId(), $comparison);
|
||||
} elseif ($profile instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AdminProfileTableMap::PROFILE_ID, $profile->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByProfile() only accepts arguments of type \Thelia\Model\Profile or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProfile($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Profile');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Profile');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Profile relation Profile object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\ProfileQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProfileQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProfile($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Profile', '\Thelia\Model\ProfileQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Admin object
|
||||
*
|
||||
* @param \Thelia\Model\Admin|ObjectCollection $admin The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdmin($admin, $comparison = null)
|
||||
{
|
||||
if ($admin instanceof \Thelia\Model\Admin) {
|
||||
return $this
|
||||
->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $admin->getId(), $comparison);
|
||||
} elseif ($admin instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AdminProfileTableMap::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAdmin() only accepts arguments of type \Thelia\Model\Admin or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdmin($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Admin');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Admin');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Admin relation Admin object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AdminQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdmin($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildAdminProfile $adminProfile Object to remove from the list of results
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($adminProfile = null)
|
||||
{
|
||||
if ($adminProfile) {
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(AdminProfileTableMap::ID), $adminProfile->getId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(AdminProfileTableMap::PROFILE_ID), $adminProfile->getProfileId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond2', $this->getAliasedColName(AdminProfileTableMap::ADMIN_ID), $adminProfile->getAdminId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the admin_profile table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AdminProfileTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
AdminProfileTableMap::clearInstancePool();
|
||||
AdminProfileTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildAdminProfile or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildAdminProfile object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AdminProfileTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminProfileTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
AdminProfileTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
AdminProfileTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(AdminProfileTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(AdminProfileTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(AdminProfileTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(AdminProfileTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(AdminProfileTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildAdminProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(AdminProfileTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // AdminProfileQuery
|
||||
@@ -22,6 +22,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
*
|
||||
*
|
||||
* @method ChildAdminQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAdminQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
|
||||
* @method ChildAdminQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildAdminQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildAdminQuery orderByLogin($order = Criteria::ASC) Order by the login column
|
||||
@@ -34,6 +35,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAdminQuery groupById() Group by the id column
|
||||
* @method ChildAdminQuery groupByProfileId() Group by the profile_id column
|
||||
* @method ChildAdminQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildAdminQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildAdminQuery groupByLogin() Group by the login column
|
||||
@@ -49,14 +51,15 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdminQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildAdminQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildAdminQuery leftJoinAdminProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildAdminQuery rightJoinAdminProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildAdminQuery innerJoinAdminProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildAdminQuery leftJoinProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminQuery rightJoinProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Profile relation
|
||||
* @method ChildAdminQuery innerJoinProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @method ChildAdmin findOne(ConnectionInterface $con = null) Return the first ChildAdmin matching the query
|
||||
* @method ChildAdmin findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAdmin matching the query, or a new ChildAdmin object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAdmin findOneById(int $id) Return the first ChildAdmin filtered by the id column
|
||||
* @method ChildAdmin findOneByProfileId(int $profile_id) Return the first ChildAdmin filtered by the profile_id column
|
||||
* @method ChildAdmin findOneByFirstname(string $firstname) Return the first ChildAdmin filtered by the firstname column
|
||||
* @method ChildAdmin findOneByLastname(string $lastname) Return the first ChildAdmin filtered by the lastname column
|
||||
* @method ChildAdmin findOneByLogin(string $login) Return the first ChildAdmin filtered by the login column
|
||||
@@ -69,6 +72,7 @@ use Thelia\Model\Map\AdminTableMap;
|
||||
* @method ChildAdmin findOneByUpdatedAt(string $updated_at) Return the first ChildAdmin filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAdmin objects filtered by the id column
|
||||
* @method array findByProfileId(int $profile_id) Return ChildAdmin objects filtered by the profile_id column
|
||||
* @method array findByFirstname(string $firstname) Return ChildAdmin objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildAdmin objects filtered by the lastname column
|
||||
* @method array findByLogin(string $login) Return ChildAdmin objects filtered by the login column
|
||||
@@ -167,7 +171,7 @@ abstract class AdminQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, PROFILE_ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -297,6 +301,49 @@ abstract class AdminQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AdminTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the profile_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByProfileId(1234); // WHERE profile_id = 1234
|
||||
* $query->filterByProfileId(array(12, 34)); // WHERE profile_id IN (12, 34)
|
||||
* $query->filterByProfileId(array('min' => 12)); // WHERE profile_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByProfile()
|
||||
*
|
||||
* @param mixed $profileId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProfileId($profileId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($profileId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($profileId['min'])) {
|
||||
$this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($profileId['max'])) {
|
||||
$this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AdminTableMap::PROFILE_ID, $profileId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the firstname column
|
||||
*
|
||||
@@ -616,40 +663,42 @@ abstract class AdminQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AdminProfile object
|
||||
* Filter the query by a related \Thelia\Model\Profile object
|
||||
*
|
||||
* @param \Thelia\Model\AdminProfile|ObjectCollection $adminProfile the related object to use as filter
|
||||
* @param \Thelia\Model\Profile|ObjectCollection $profile The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdminProfile($adminProfile, $comparison = null)
|
||||
public function filterByProfile($profile, $comparison = null)
|
||||
{
|
||||
if ($adminProfile instanceof \Thelia\Model\AdminProfile) {
|
||||
if ($profile instanceof \Thelia\Model\Profile) {
|
||||
return $this
|
||||
->addUsingAlias(AdminTableMap::ID, $adminProfile->getAdminId(), $comparison);
|
||||
} elseif ($adminProfile instanceof ObjectCollection) {
|
||||
->addUsingAlias(AdminTableMap::PROFILE_ID, $profile->getId(), $comparison);
|
||||
} elseif ($profile instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useAdminProfileQuery()
|
||||
->filterByPrimaryKeys($adminProfile->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AdminTableMap::PROFILE_ID, $profile->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAdminProfile() only accepts arguments of type \Thelia\Model\AdminProfile or Collection');
|
||||
throw new PropelException('filterByProfile() only accepts arguments of type \Thelia\Model\Profile or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AdminProfile relation
|
||||
* Adds a JOIN clause to the query using the Profile relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdminProfile($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProfile($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AdminProfile');
|
||||
$relationMap = $tableMap->getRelation('Profile');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -664,14 +713,14 @@ abstract class AdminQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AdminProfile');
|
||||
$this->addJoinObject($join, 'Profile');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AdminProfile relation AdminProfile object
|
||||
* Use the Profile relation Profile object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -679,30 +728,13 @@ abstract class AdminQuery extends ModelCriteria
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AdminProfileQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\ProfileQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminProfileQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProfileQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdminProfile($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AdminProfile', '\Thelia\Model\AdminProfileQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Profile object
|
||||
* using the admin_profile table as cross reference
|
||||
*
|
||||
* @param Profile $profile the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByProfile($profile, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAdminProfileQuery()
|
||||
->filterByProfile($profile, $comparison)
|
||||
->endUse();
|
||||
->joinProfile($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Profile', '\Thelia\Model\ProfileQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,6 @@ use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Admin as ChildAdmin;
|
||||
use Thelia\Model\AdminProfile as ChildAdminProfile;
|
||||
use Thelia\Model\AdminProfileQuery as ChildAdminProfileQuery;
|
||||
use Thelia\Model\AdminQuery as ChildAdminQuery;
|
||||
use Thelia\Model\Profile as ChildProfile;
|
||||
use Thelia\Model\ProfileI18n as ChildProfileI18n;
|
||||
@@ -92,10 +90,10 @@ abstract class Profile implements ActiveRecordInterface
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildAdminProfile[] Collection to store aggregation of ChildAdminProfile objects.
|
||||
* @var ObjectCollection|ChildAdmin[] Collection to store aggregation of ChildAdmin objects.
|
||||
*/
|
||||
protected $collAdminProfiles;
|
||||
protected $collAdminProfilesPartial;
|
||||
protected $collAdmins;
|
||||
protected $collAdminsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildProfileResource[] Collection to store aggregation of ChildProfileResource objects.
|
||||
@@ -115,11 +113,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
protected $collProfileI18ns;
|
||||
protected $collProfileI18nsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildAdmin[] Collection to store aggregation of ChildAdmin objects.
|
||||
*/
|
||||
protected $collAdmins;
|
||||
|
||||
/**
|
||||
* @var ChildResource[] Collection to store aggregation of ChildResource objects.
|
||||
*/
|
||||
@@ -147,12 +140,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
*/
|
||||
protected $currentTranslations;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $adminsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -163,7 +150,7 @@ abstract class Profile implements ActiveRecordInterface
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $adminProfilesScheduledForDeletion = null;
|
||||
protected $adminsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
@@ -710,7 +697,7 @@ abstract class Profile implements ActiveRecordInterface
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collAdminProfiles = null;
|
||||
$this->collAdmins = null;
|
||||
|
||||
$this->collProfileResources = null;
|
||||
|
||||
@@ -718,7 +705,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
|
||||
$this->collProfileI18ns = null;
|
||||
|
||||
$this->collAdmins = null;
|
||||
$this->collResources = null;
|
||||
} // if (deep)
|
||||
}
|
||||
@@ -853,33 +839,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->adminsScheduledForDeletion !== null) {
|
||||
if (!$this->adminsScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->adminsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($pk, $remotePk);
|
||||
}
|
||||
|
||||
AdminProfileQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->adminsScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getAdmins() as $admin) {
|
||||
if ($admin->isModified()) {
|
||||
$admin->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collAdmins) {
|
||||
foreach ($this->collAdmins as $admin) {
|
||||
if ($admin->isModified()) {
|
||||
$admin->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->resourcesScheduledForDeletion !== null) {
|
||||
if (!$this->resourcesScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
@@ -907,17 +866,18 @@ abstract class Profile implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adminProfilesScheduledForDeletion !== null) {
|
||||
if (!$this->adminProfilesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AdminProfileQuery::create()
|
||||
->filterByPrimaryKeys($this->adminProfilesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->adminProfilesScheduledForDeletion = null;
|
||||
if ($this->adminsScheduledForDeletion !== null) {
|
||||
if (!$this->adminsScheduledForDeletion->isEmpty()) {
|
||||
foreach ($this->adminsScheduledForDeletion as $admin) {
|
||||
// need to save related object because we set the relation to null
|
||||
$admin->save($con);
|
||||
}
|
||||
$this->adminsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAdminProfiles !== null) {
|
||||
foreach ($this->collAdminProfiles as $referrerFK) {
|
||||
if ($this->collAdmins !== null) {
|
||||
foreach ($this->collAdmins as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
@@ -1150,8 +1110,8 @@ abstract class Profile implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->collAdminProfiles) {
|
||||
$result['AdminProfiles'] = $this->collAdminProfiles->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
if (null !== $this->collAdmins) {
|
||||
$result['Admins'] = $this->collAdmins->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collProfileResources) {
|
||||
$result['ProfileResources'] = $this->collProfileResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
@@ -1323,9 +1283,9 @@ abstract class Profile implements ActiveRecordInterface
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach ($this->getAdminProfiles() as $relObj) {
|
||||
foreach ($this->getAdmins() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addAdminProfile($relObj->copy($deepCopy));
|
||||
$copyObj->addAdmin($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,8 +1348,8 @@ abstract class Profile implements ActiveRecordInterface
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('AdminProfile' == $relationName) {
|
||||
return $this->initAdminProfiles();
|
||||
if ('Admin' == $relationName) {
|
||||
return $this->initAdmins();
|
||||
}
|
||||
if ('ProfileResource' == $relationName) {
|
||||
return $this->initProfileResources();
|
||||
@@ -1403,31 +1363,31 @@ abstract class Profile implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAdminProfiles collection
|
||||
* Clears out the collAdmins collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addAdminProfiles()
|
||||
* @see addAdmins()
|
||||
*/
|
||||
public function clearAdminProfiles()
|
||||
public function clearAdmins()
|
||||
{
|
||||
$this->collAdminProfiles = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collAdmins = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collAdminProfiles collection loaded partially.
|
||||
* Reset is the collAdmins collection loaded partially.
|
||||
*/
|
||||
public function resetPartialAdminProfiles($v = true)
|
||||
public function resetPartialAdmins($v = true)
|
||||
{
|
||||
$this->collAdminProfilesPartial = $v;
|
||||
$this->collAdminsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAdminProfiles collection.
|
||||
* Initializes the collAdmins collection.
|
||||
*
|
||||
* By default this just sets the collAdminProfiles collection to an empty array (like clearcollAdminProfiles());
|
||||
* By default this just sets the collAdmins collection to an empty array (like clearcollAdmins());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
@@ -1436,17 +1396,17 @@ abstract class Profile implements ActiveRecordInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAdminProfiles($overrideExisting = true)
|
||||
public function initAdmins($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAdminProfiles && !$overrideExisting) {
|
||||
if (null !== $this->collAdmins && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAdminProfiles = new ObjectCollection();
|
||||
$this->collAdminProfiles->setModel('\Thelia\Model\AdminProfile');
|
||||
$this->collAdmins = new ObjectCollection();
|
||||
$this->collAdmins->setModel('\Thelia\Model\Admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildAdminProfile objects which contain a foreign key that references this object.
|
||||
* Gets an array of ChildAdmin objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
@@ -1456,112 +1416,109 @@ abstract class Profile implements ActiveRecordInterface
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
|
||||
* @return Collection|ChildAdmin[] List of ChildAdmin objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdminProfiles($criteria = null, ConnectionInterface $con = null)
|
||||
public function getAdmins($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAdminProfilesPartial && !$this->isNew();
|
||||
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminProfiles) {
|
||||
$partial = $this->collAdminsPartial && !$this->isNew();
|
||||
if (null === $this->collAdmins || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdmins) {
|
||||
// return empty collection
|
||||
$this->initAdminProfiles();
|
||||
$this->initAdmins();
|
||||
} else {
|
||||
$collAdminProfiles = ChildAdminProfileQuery::create(null, $criteria)
|
||||
$collAdmins = ChildAdminQuery::create(null, $criteria)
|
||||
->filterByProfile($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAdminProfilesPartial && count($collAdminProfiles)) {
|
||||
$this->initAdminProfiles(false);
|
||||
if (false !== $this->collAdminsPartial && count($collAdmins)) {
|
||||
$this->initAdmins(false);
|
||||
|
||||
foreach ($collAdminProfiles as $obj) {
|
||||
if (false == $this->collAdminProfiles->contains($obj)) {
|
||||
$this->collAdminProfiles->append($obj);
|
||||
foreach ($collAdmins as $obj) {
|
||||
if (false == $this->collAdmins->contains($obj)) {
|
||||
$this->collAdmins->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminProfilesPartial = true;
|
||||
$this->collAdminsPartial = true;
|
||||
}
|
||||
|
||||
$collAdminProfiles->getInternalIterator()->rewind();
|
||||
$collAdmins->getInternalIterator()->rewind();
|
||||
|
||||
return $collAdminProfiles;
|
||||
return $collAdmins;
|
||||
}
|
||||
|
||||
if ($partial && $this->collAdminProfiles) {
|
||||
foreach ($this->collAdminProfiles as $obj) {
|
||||
if ($partial && $this->collAdmins) {
|
||||
foreach ($this->collAdmins as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collAdminProfiles[] = $obj;
|
||||
$collAdmins[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = $collAdminProfiles;
|
||||
$this->collAdminProfilesPartial = false;
|
||||
$this->collAdmins = $collAdmins;
|
||||
$this->collAdminsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAdminProfiles;
|
||||
return $this->collAdmins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AdminProfile objects related by a one-to-many relationship
|
||||
* Sets a collection of Admin objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $adminProfiles A Propel collection.
|
||||
* @param Collection $admins A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildProfile The current object (for fluent API support)
|
||||
*/
|
||||
public function setAdminProfiles(Collection $adminProfiles, ConnectionInterface $con = null)
|
||||
public function setAdmins(Collection $admins, ConnectionInterface $con = null)
|
||||
{
|
||||
$adminProfilesToDelete = $this->getAdminProfiles(new Criteria(), $con)->diff($adminProfiles);
|
||||
$adminsToDelete = $this->getAdmins(new Criteria(), $con)->diff($admins);
|
||||
|
||||
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->adminProfilesScheduledForDeletion = clone $adminProfilesToDelete;
|
||||
$this->adminsScheduledForDeletion = $adminsToDelete;
|
||||
|
||||
foreach ($adminProfilesToDelete as $adminProfileRemoved) {
|
||||
$adminProfileRemoved->setProfile(null);
|
||||
foreach ($adminsToDelete as $adminRemoved) {
|
||||
$adminRemoved->setProfile(null);
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = null;
|
||||
foreach ($adminProfiles as $adminProfile) {
|
||||
$this->addAdminProfile($adminProfile);
|
||||
$this->collAdmins = null;
|
||||
foreach ($admins as $admin) {
|
||||
$this->addAdmin($admin);
|
||||
}
|
||||
|
||||
$this->collAdminProfiles = $adminProfiles;
|
||||
$this->collAdminProfilesPartial = false;
|
||||
$this->collAdmins = $admins;
|
||||
$this->collAdminsPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AdminProfile objects.
|
||||
* Returns the number of related Admin objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related AdminProfile objects.
|
||||
* @return int Count of related Admin objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAdminProfiles(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
public function countAdmins(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collAdminProfilesPartial && !$this->isNew();
|
||||
if (null === $this->collAdminProfiles || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminProfiles) {
|
||||
$partial = $this->collAdminsPartial && !$this->isNew();
|
||||
if (null === $this->collAdmins || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdmins) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getAdminProfiles());
|
||||
return count($this->getAdmins());
|
||||
}
|
||||
|
||||
$query = ChildAdminProfileQuery::create(null, $criteria);
|
||||
$query = ChildAdminQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
@@ -1571,83 +1528,58 @@ abstract class Profile implements ActiveRecordInterface
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collAdminProfiles);
|
||||
return count($this->collAdmins);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildAdminProfile object to this object
|
||||
* through the ChildAdminProfile foreign key attribute.
|
||||
* Method called to associate a ChildAdmin object to this object
|
||||
* through the ChildAdmin foreign key attribute.
|
||||
*
|
||||
* @param ChildAdminProfile $l ChildAdminProfile
|
||||
* @param ChildAdmin $l ChildAdmin
|
||||
* @return \Thelia\Model\Profile The current object (for fluent API support)
|
||||
*/
|
||||
public function addAdminProfile(ChildAdminProfile $l)
|
||||
public function addAdmin(ChildAdmin $l)
|
||||
{
|
||||
if ($this->collAdminProfiles === null) {
|
||||
$this->initAdminProfiles();
|
||||
$this->collAdminProfilesPartial = true;
|
||||
if ($this->collAdmins === null) {
|
||||
$this->initAdmins();
|
||||
$this->collAdminsPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collAdminProfiles->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdminProfile($l);
|
||||
if (!in_array($l, $this->collAdmins->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdmin($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminProfile $adminProfile The adminProfile object to add.
|
||||
* @param Admin $admin The admin object to add.
|
||||
*/
|
||||
protected function doAddAdminProfile($adminProfile)
|
||||
protected function doAddAdmin($admin)
|
||||
{
|
||||
$this->collAdminProfiles[]= $adminProfile;
|
||||
$adminProfile->setProfile($this);
|
||||
$this->collAdmins[]= $admin;
|
||||
$admin->setProfile($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminProfile $adminProfile The adminProfile object to remove.
|
||||
* @param Admin $admin The admin object to remove.
|
||||
* @return ChildProfile The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAdminProfile($adminProfile)
|
||||
public function removeAdmin($admin)
|
||||
{
|
||||
if ($this->getAdminProfiles()->contains($adminProfile)) {
|
||||
$this->collAdminProfiles->remove($this->collAdminProfiles->search($adminProfile));
|
||||
if (null === $this->adminProfilesScheduledForDeletion) {
|
||||
$this->adminProfilesScheduledForDeletion = clone $this->collAdminProfiles;
|
||||
$this->adminProfilesScheduledForDeletion->clear();
|
||||
if ($this->getAdmins()->contains($admin)) {
|
||||
$this->collAdmins->remove($this->collAdmins->search($admin));
|
||||
if (null === $this->adminsScheduledForDeletion) {
|
||||
$this->adminsScheduledForDeletion = clone $this->collAdmins;
|
||||
$this->adminsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->adminProfilesScheduledForDeletion[]= clone $adminProfile;
|
||||
$adminProfile->setProfile(null);
|
||||
$this->adminsScheduledForDeletion[]= $admin;
|
||||
$admin->setProfile(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Profile is new, it will return
|
||||
* an empty collection; or if this Profile has previously
|
||||
* been saved, it will retrieve related AdminProfiles from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Profile.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildAdminProfile[] List of ChildAdminProfile objects
|
||||
*/
|
||||
public function getAdminProfilesJoinAdmin($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildAdminProfileQuery::create(null, $criteria);
|
||||
$query->joinWith('Admin', $joinBehavior);
|
||||
|
||||
return $this->getAdminProfiles($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collProfileResources collection
|
||||
*
|
||||
@@ -2362,189 +2294,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAdmins collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addAdmins()
|
||||
*/
|
||||
public function clearAdmins()
|
||||
{
|
||||
$this->collAdmins = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collAdminsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAdmins collection.
|
||||
*
|
||||
* By default this just sets the collAdmins collection to an empty collection (like clearAdmins());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAdmins()
|
||||
{
|
||||
$this->collAdmins = new ObjectCollection();
|
||||
$this->collAdmins->setModel('\Thelia\Model\Admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildAdmin objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildProfile is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildAdmin[] List of ChildAdmin objects
|
||||
*/
|
||||
public function getAdmins($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collAdmins || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collAdmins) {
|
||||
// return empty collection
|
||||
$this->initAdmins();
|
||||
} else {
|
||||
$collAdmins = ChildAdminQuery::create(null, $criteria)
|
||||
->filterByProfile($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collAdmins;
|
||||
}
|
||||
$this->collAdmins = $collAdmins;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAdmins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Admin objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $admins A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildProfile The current object (for fluent API support)
|
||||
*/
|
||||
public function setAdmins(Collection $admins, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearAdmins();
|
||||
$currentAdmins = $this->getAdmins();
|
||||
|
||||
$this->adminsScheduledForDeletion = $currentAdmins->diff($admins);
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
if (!$currentAdmins->contains($admin)) {
|
||||
$this->doAddAdmin($admin);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdmins = $admins;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildAdmin objects related by a many-to-many relationship
|
||||
* to the current object by way of the admin_profile cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildAdmin objects
|
||||
*/
|
||||
public function countAdmins($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collAdmins || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collAdmins) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildAdminQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByProfile($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collAdmins);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildAdmin object to this object
|
||||
* through the admin_profile cross reference table.
|
||||
*
|
||||
* @param ChildAdmin $admin The ChildAdminProfile object to relate
|
||||
* @return ChildProfile The current object (for fluent API support)
|
||||
*/
|
||||
public function addAdmin(ChildAdmin $admin)
|
||||
{
|
||||
if ($this->collAdmins === null) {
|
||||
$this->initAdmins();
|
||||
}
|
||||
|
||||
if (!$this->collAdmins->contains($admin)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdmin($admin);
|
||||
$this->collAdmins[] = $admin;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Admin $admin The admin object to add.
|
||||
*/
|
||||
protected function doAddAdmin($admin)
|
||||
{
|
||||
$adminProfile = new ChildAdminProfile();
|
||||
$adminProfile->setAdmin($admin);
|
||||
$this->addAdminProfile($adminProfile);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$admin->getProfiles()->contains($this)) {
|
||||
$foreignCollection = $admin->getProfiles();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildAdmin object to this object
|
||||
* through the admin_profile cross reference table.
|
||||
*
|
||||
* @param ChildAdmin $admin The ChildAdminProfile object to relate
|
||||
* @return ChildProfile The current object (for fluent API support)
|
||||
*/
|
||||
public function removeAdmin(ChildAdmin $admin)
|
||||
{
|
||||
if ($this->getAdmins()->contains($admin)) {
|
||||
$this->collAdmins->remove($this->collAdmins->search($admin));
|
||||
|
||||
if (null === $this->adminsScheduledForDeletion) {
|
||||
$this->adminsScheduledForDeletion = clone $this->collAdmins;
|
||||
$this->adminsScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->adminsScheduledForDeletion[] = $admin;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collResources collection
|
||||
*
|
||||
@@ -2756,8 +2505,8 @@ abstract class Profile implements ActiveRecordInterface
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collAdminProfiles) {
|
||||
foreach ($this->collAdminProfiles as $o) {
|
||||
if ($this->collAdmins) {
|
||||
foreach ($this->collAdmins as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
@@ -2776,11 +2525,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collAdmins) {
|
||||
foreach ($this->collAdmins as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collResources) {
|
||||
foreach ($this->collResources as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
@@ -2792,10 +2536,10 @@ abstract class Profile implements ActiveRecordInterface
|
||||
$this->currentLocale = 'en_US';
|
||||
$this->currentTranslations = null;
|
||||
|
||||
if ($this->collAdminProfiles instanceof Collection) {
|
||||
$this->collAdminProfiles->clearIterator();
|
||||
if ($this->collAdmins instanceof Collection) {
|
||||
$this->collAdmins->clearIterator();
|
||||
}
|
||||
$this->collAdminProfiles = null;
|
||||
$this->collAdmins = null;
|
||||
if ($this->collProfileResources instanceof Collection) {
|
||||
$this->collProfileResources->clearIterator();
|
||||
}
|
||||
@@ -2808,10 +2552,6 @@ abstract class Profile implements ActiveRecordInterface
|
||||
$this->collProfileI18ns->clearIterator();
|
||||
}
|
||||
$this->collProfileI18ns = null;
|
||||
if ($this->collAdmins instanceof Collection) {
|
||||
$this->collAdmins->clearIterator();
|
||||
}
|
||||
$this->collAdmins = null;
|
||||
if ($this->collResources instanceof Collection) {
|
||||
$this->collResources->clearIterator();
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ use Thelia\Model\Map\ProfileTableMap;
|
||||
* @method ChildProfileQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildProfileQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildProfileQuery leftJoinAdminProfile($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildProfileQuery rightJoinAdminProfile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildProfileQuery innerJoinAdminProfile($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminProfile relation
|
||||
* @method ChildProfileQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
|
||||
* @method ChildProfileQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
|
||||
* @method ChildProfileQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @method ChildProfileQuery leftJoinProfileResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProfileResource relation
|
||||
* @method ChildProfileQuery rightJoinProfileResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProfileResource relation
|
||||
@@ -398,40 +398,40 @@ abstract class ProfileQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\AdminProfile object
|
||||
* Filter the query by a related \Thelia\Model\Admin object
|
||||
*
|
||||
* @param \Thelia\Model\AdminProfile|ObjectCollection $adminProfile the related object to use as filter
|
||||
* @param \Thelia\Model\Admin|ObjectCollection $admin the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdminProfile($adminProfile, $comparison = null)
|
||||
public function filterByAdmin($admin, $comparison = null)
|
||||
{
|
||||
if ($adminProfile instanceof \Thelia\Model\AdminProfile) {
|
||||
if ($admin instanceof \Thelia\Model\Admin) {
|
||||
return $this
|
||||
->addUsingAlias(ProfileTableMap::ID, $adminProfile->getProfileId(), $comparison);
|
||||
} elseif ($adminProfile instanceof ObjectCollection) {
|
||||
->addUsingAlias(ProfileTableMap::ID, $admin->getProfileId(), $comparison);
|
||||
} elseif ($admin instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useAdminProfileQuery()
|
||||
->filterByPrimaryKeys($adminProfile->getPrimaryKeys())
|
||||
->useAdminQuery()
|
||||
->filterByPrimaryKeys($admin->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAdminProfile() only accepts arguments of type \Thelia\Model\AdminProfile or Collection');
|
||||
throw new PropelException('filterByAdmin() only accepts arguments of type \Thelia\Model\Admin or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the AdminProfile relation
|
||||
* Adds a JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdminProfile($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AdminProfile');
|
||||
$relationMap = $tableMap->getRelation('Admin');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -446,14 +446,14 @@ abstract class ProfileQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'AdminProfile');
|
||||
$this->addJoinObject($join, 'Admin');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the AdminProfile relation AdminProfile object
|
||||
* Use the Admin relation Admin object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -461,13 +461,13 @@ abstract class ProfileQuery extends ModelCriteria
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AdminProfileQuery A secondary query class using the current class as primary query
|
||||
* @return \Thelia\Model\AdminQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminProfileQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdminProfile($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'AdminProfile', '\Thelia\Model\AdminProfileQuery');
|
||||
->joinAdmin($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -689,23 +689,6 @@ abstract class ProfileQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProfileI18n', '\Thelia\Model\ProfileI18nQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Admin object
|
||||
* using the admin_profile table as cross reference
|
||||
*
|
||||
* @param Admin $admin the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProfileQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAdmin($admin, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useAdminProfileQuery()
|
||||
->filterByAdmin($admin, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Resource object
|
||||
* using the profile_resource table as cross reference
|
||||
|
||||
@@ -1,509 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\AdminProfile;
|
||||
use Thelia\Model\AdminProfileQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'admin_profile' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class AdminProfileTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.AdminProfileTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'admin_profile';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\AdminProfile';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.AdminProfile';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'admin_profile.ID';
|
||||
|
||||
/**
|
||||
* the column name for the PROFILE_ID field
|
||||
*/
|
||||
const PROFILE_ID = 'admin_profile.PROFILE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the ADMIN_ID field
|
||||
*/
|
||||
const ADMIN_ID = 'admin_profile.ADMIN_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'admin_profile.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'admin_profile.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'AdminId', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'adminId', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminProfileTableMap::ID, AdminProfileTableMap::PROFILE_ID, AdminProfileTableMap::ADMIN_ID, AdminProfileTableMap::CREATED_AT, AdminProfileTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'ADMIN_ID', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'admin_id', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'AdminId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'adminId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
|
||||
self::TYPE_COLNAME => array(AdminProfileTableMap::ID => 0, AdminProfileTableMap::PROFILE_ID => 1, AdminProfileTableMap::ADMIN_ID => 2, AdminProfileTableMap::CREATED_AT => 3, AdminProfileTableMap::UPDATED_AT => 4, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'ADMIN_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'admin_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('admin_profile');
|
||||
$this->setPhpName('AdminProfile');
|
||||
$this->setClassName('\\Thelia\\Model\\AdminProfile');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setIsCrossRef(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignPrimaryKey('PROFILE_ID', 'ProfileId', 'INTEGER' , 'profile', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ADMIN_ID', 'AdminId', 'INTEGER' , 'admin', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Profile', '\\Thelia\\Model\\Profile', RelationMap::MANY_TO_ONE, array('profile_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Admin', '\\Thelia\\Model\\Admin', RelationMap::MANY_TO_ONE, array('admin_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\AdminProfile $obj A \Thelia\Model\AdminProfile object.
|
||||
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||
*/
|
||||
public static function addInstanceToPool($obj, $key = null)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled()) {
|
||||
if (null === $key) {
|
||||
$key = serialize(array((string) $obj->getId(), (string) $obj->getProfileId(), (string) $obj->getAdminId()));
|
||||
} // if key === null
|
||||
self::$instances[$key] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an object from the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases -- especially when you override doDelete
|
||||
* methods in your stub classes -- you may need to explicitly remove objects
|
||||
* from the cache in order to prevent returning objects that no longer exist.
|
||||
*
|
||||
* @param mixed $value A \Thelia\Model\AdminProfile object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\AdminProfile) {
|
||||
$key = serialize(array((string) $value->getId(), (string) $value->getProfileId(), (string) $value->getAdminId()));
|
||||
|
||||
} elseif (is_array($value) && count($value) === 3) {
|
||||
// assume we've been passed a primary key";
|
||||
$key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2]));
|
||||
} elseif ($value instanceof Criteria) {
|
||||
self::$instances = [];
|
||||
|
||||
return;
|
||||
} else {
|
||||
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\AdminProfile object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('AdminId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProfileId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('AdminId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? AdminProfileTableMap::CLASS_DEFAULT : AdminProfileTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (AdminProfile object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = AdminProfileTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = AdminProfileTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + AdminProfileTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = AdminProfileTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
AdminProfileTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = AdminProfileTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = AdminProfileTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
AdminProfileTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(AdminProfileTableMap::ID);
|
||||
$criteria->addSelectColumn(AdminProfileTableMap::PROFILE_ID);
|
||||
$criteria->addSelectColumn(AdminProfileTableMap::ADMIN_ID);
|
||||
$criteria->addSelectColumn(AdminProfileTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(AdminProfileTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PROFILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.ADMIN_ID');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(AdminProfileTableMap::DATABASE_NAME)->getTable(AdminProfileTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(AdminProfileTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(AdminProfileTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new AdminProfileTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a AdminProfile or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminProfile object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AdminProfileTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\AdminProfile) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(AdminProfileTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(AdminProfileTableMap::ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(AdminProfileTableMap::PROFILE_ID, $value[1]));
|
||||
$criterion->addAnd($criteria->getNewCriterion(AdminProfileTableMap::ADMIN_ID, $value[2]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = AdminProfileQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { AdminProfileTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { AdminProfileTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the admin_profile table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return AdminProfileQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a AdminProfile or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or AdminProfile object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(AdminProfileTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from AdminProfile object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(AdminProfileTableMap::ID) && $criteria->keyContainsValue(AdminProfileTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AdminProfileTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = AdminProfileQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // AdminProfileTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
AdminProfileTableMap::buildTableMap();
|
||||
@@ -57,7 +57,7 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 11;
|
||||
const NUM_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,13 +67,18 @@ class AdminTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 11;
|
||||
const NUM_HYDRATE_COLUMNS = 12;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'admin.ID';
|
||||
|
||||
/**
|
||||
* the column name for the PROFILE_ID field
|
||||
*/
|
||||
const PROFILE_ID = 'admin.PROFILE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the FIRSTNAME field
|
||||
*/
|
||||
@@ -136,12 +141,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::PROFILE_ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -151,12 +156,12 @@ class AdminTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'RememberMeToken' => 7, 'RememberMeSerial' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'rememberMeToken' => 7, 'rememberMeSerial' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::REMEMBER_ME_TOKEN => 7, AdminTableMap::REMEMBER_ME_SERIAL => 8, AdminTableMap::CREATED_AT => 9, AdminTableMap::UPDATED_AT => 10, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'REMEMBER_ME_TOKEN' => 7, 'REMEMBER_ME_SERIAL' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'remember_me_token' => 7, 'remember_me_serial' => 8, 'created_at' => 9, 'updated_at' => 10, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Login' => 4, 'Password' => 5, 'Algo' => 6, 'Salt' => 7, 'RememberMeToken' => 8, 'RememberMeSerial' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'rememberMeToken' => 8, 'rememberMeSerial' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
|
||||
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::PROFILE_ID => 1, AdminTableMap::FIRSTNAME => 2, AdminTableMap::LASTNAME => 3, AdminTableMap::LOGIN => 4, AdminTableMap::PASSWORD => 5, AdminTableMap::ALGO => 6, AdminTableMap::SALT => 7, AdminTableMap::REMEMBER_ME_TOKEN => 8, AdminTableMap::REMEMBER_ME_SERIAL => 9, AdminTableMap::CREATED_AT => 10, AdminTableMap::UPDATED_AT => 11, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOGIN' => 4, 'PASSWORD' => 5, 'ALGO' => 6, 'SALT' => 7, 'REMEMBER_ME_TOKEN' => 8, 'REMEMBER_ME_SERIAL' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'firstname' => 2, 'lastname' => 3, 'login' => 4, 'password' => 5, 'algo' => 6, 'salt' => 7, 'remember_me_token' => 8, 'remember_me_serial' => 9, 'created_at' => 10, 'updated_at' => 11, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -176,6 +181,7 @@ class AdminTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PROFILE_ID', 'ProfileId', 'INTEGER', 'profile', 'ID', false, null, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LOGIN', 'Login', 'VARCHAR', true, 100, null);
|
||||
@@ -193,8 +199,7 @@ class AdminTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AdminProfile', '\\Thelia\\Model\\AdminProfile', RelationMap::ONE_TO_MANY, array('id' => 'admin_id', ), 'CASCADE', 'RESTRICT', 'AdminProfiles');
|
||||
$this->addRelation('Profile', '\\Thelia\\Model\\Profile', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Profiles');
|
||||
$this->addRelation('Profile', '\\Thelia\\Model\\Profile', RelationMap::MANY_TO_ONE, array('profile_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -209,15 +214,6 @@ class AdminTableMap extends TableMap
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
/**
|
||||
* Method to invalidate the instance pool of all tables related to admin * by a foreign key with ON DELETE CASCADE
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AdminProfileTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
@@ -358,6 +354,7 @@ class AdminTableMap extends TableMap
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(AdminTableMap::ID);
|
||||
$criteria->addSelectColumn(AdminTableMap::PROFILE_ID);
|
||||
$criteria->addSelectColumn(AdminTableMap::FIRSTNAME);
|
||||
$criteria->addSelectColumn(AdminTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(AdminTableMap::LOGIN);
|
||||
@@ -370,6 +367,7 @@ class AdminTableMap extends TableMap
|
||||
$criteria->addSelectColumn(AdminTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PROFILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LOGIN');
|
||||
|
||||
@@ -202,7 +202,7 @@ class ProductTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
|
||||
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
|
||||
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
|
||||
|
||||
@@ -160,11 +160,10 @@ class ProfileTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AdminProfile', '\\Thelia\\Model\\AdminProfile', RelationMap::ONE_TO_MANY, array('id' => 'profile_id', ), 'CASCADE', 'RESTRICT', 'AdminProfiles');
|
||||
$this->addRelation('Admin', '\\Thelia\\Model\\Admin', RelationMap::ONE_TO_MANY, array('id' => 'profile_id', ), 'RESTRICT', 'RESTRICT', 'Admins');
|
||||
$this->addRelation('ProfileResource', '\\Thelia\\Model\\ProfileResource', RelationMap::ONE_TO_MANY, array('id' => 'profile_id', ), 'CASCADE', 'RESTRICT', 'ProfileResources');
|
||||
$this->addRelation('ProfileModule', '\\Thelia\\Model\\ProfileModule', RelationMap::ONE_TO_MANY, array('id' => 'profile_id', ), 'CASCADE', 'CASCADE', 'ProfileModules');
|
||||
$this->addRelation('ProfileI18n', '\\Thelia\\Model\\ProfileI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProfileI18ns');
|
||||
$this->addRelation('Admin', '\\Thelia\\Model\\Admin', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Admins');
|
||||
$this->addRelation('Resource', '\\Thelia\\Model\\Resource', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Resources');
|
||||
} // buildRelations()
|
||||
|
||||
@@ -188,7 +187,6 @@ class ProfileTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AdminProfileTableMap::clearInstancePool();
|
||||
ProfileResourceTableMap::clearInstancePool();
|
||||
ProfileModuleTableMap::clearInstancePool();
|
||||
ProfileI18nTableMap::clearInstancePool();
|
||||
|
||||
@@ -160,7 +160,7 @@ class TaxRuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'SET NULL', 'RESTRICT', 'Products');
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'RESTRICT', 'RESTRICT', 'Products');
|
||||
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
|
||||
$this->addRelation('TaxRuleI18n', '\\Thelia\\Model\\TaxRuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxRuleI18ns');
|
||||
} // buildRelations()
|
||||
@@ -185,7 +185,6 @@ class TaxRuleTableMap extends TableMap
|
||||
{
|
||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
ProductTableMap::clearInstancePool();
|
||||
TaxRuleCountryTableMap::clearInstancePool();
|
||||
TaxRuleI18nTableMap::clearInstancePool();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ CREATE TABLE `product`
|
||||
FOREIGN KEY (`tax_rule_id`)
|
||||
REFERENCES `tax_rule` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL,
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_product_template`
|
||||
FOREIGN KEY (`template_id`)
|
||||
REFERENCES `template` (`id`)
|
||||
@@ -971,6 +971,7 @@ DROP TABLE IF EXISTS `admin`;
|
||||
CREATE TABLE `admin`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`profile_id` INTEGER,
|
||||
`firstname` VARCHAR(100) NOT NULL,
|
||||
`lastname` VARCHAR(100) NOT NULL,
|
||||
`login` VARCHAR(100) NOT NULL,
|
||||
@@ -981,35 +982,13 @@ CREATE TABLE `admin`
|
||||
`remember_me_serial` VARCHAR(255),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- admin_profile
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `admin_profile`;
|
||||
|
||||
CREATE TABLE `admin_profile`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`profile_id` INTEGER NOT NULL,
|
||||
`admin_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`,`profile_id`,`admin_id`),
|
||||
INDEX `idx_admin_profile_profile_id` (`profile_id`),
|
||||
INDEX `idx_admin_profile_admin_id` (`admin_id`),
|
||||
CONSTRAINT `fk_admin_profile_profile_id`
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_admin_profile_id` (`profile_id`),
|
||||
CONSTRAINT `fk_admin_profile_id`
|
||||
FOREIGN KEY (`profile_id`)
|
||||
REFERENCES `profile` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_admin_profile_admin_id`
|
||||
FOREIGN KEY (`admin_id`)
|
||||
REFERENCES `admin` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
@@ -755,6 +755,7 @@
|
||||
</table>
|
||||
<table name="admin" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="profile_id" type="INTEGER" />
|
||||
<column name="firstname" required="true" size="100" type="VARCHAR" />
|
||||
<column name="lastname" required="true" size="100" type="VARCHAR" />
|
||||
<column name="login" required="true" size="100" type="VARCHAR" />
|
||||
@@ -763,12 +764,11 @@
|
||||
<column name="salt" size="128" type="VARCHAR" />
|
||||
<column name="remember_me_token" size="255" type="VARCHAR" />
|
||||
<column name="remember_me_serial" size="255" type="VARCHAR" />
|
||||
<column name="profile_id" size="45" type="VARCHAR" />
|
||||
<foreign-key foreignTable="profile" name="fk_admin_profile_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="id" />
|
||||
<reference foreign="id" local="profile_id" />
|
||||
</foreign-key>
|
||||
<index name="fk_admin_profile_id">
|
||||
<index-column name="id" />
|
||||
<index-column name="profile_id" />
|
||||
</index>
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
34
templates/admin/default/includes/generic-warning-dialog.html
Executable file
34
templates/admin/default/includes/generic-warning-dialog.html
Executable file
@@ -0,0 +1,34 @@
|
||||
{*
|
||||
|
||||
A generic modal creation dialog template. Parameters
|
||||
|
||||
dialog_id = the dialog id attribute
|
||||
dialog_title = the dialog title
|
||||
dialog_body = the dialog body. In most cases, this is a creation form
|
||||
|
||||
dialog_ok_label = The OK button label. Default OK
|
||||
|
||||
ok_button_id (optionnal) = the id of the OK button
|
||||
*}
|
||||
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{$dialog_title nofilter}</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal-body">
|
||||
{$dialog_body nofilter}
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button {if ! empty($ok_button_id)}id="{$ok_button_id}"{/if} type="button" data-dismiss="modal" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l='OK'}}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,6 +25,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator clearfix">
|
||||
|
||||
<div class="lead clearfix">
|
||||
<span class='label label-default pull-left'>{$CODE}</span>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs clearfix">
|
||||
<li {if $oder_tab == 'data'}class="active"{/if}><a href="#data" data-tab-name="cart" data-toggle="tab"><span class="glyphicon glyphicon-shopping-cart"></span> {intl l="Description"}</a></li>
|
||||
<li {if $oder_tab == 'permissions'}class="active"{/if}><a href="#permissions" data-tab-name="bill" data-toggle="tab"><span class="glyphicon glyphicon-list-alt"></span> {intl l="Permissions"}</a></li>
|
||||
|
||||
@@ -53,8 +53,10 @@
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this profile'}" href="{url path="/admin/configuration/profiles/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{assign linkedAdminCount {count name="linked-admin" type="admin" profile=$ID}}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.profile.change"}
|
||||
<a class="btn btn-default btn-xs js-delete-profile" title="{intl l='Delete this profile'}" href="#profile_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a class="btn btn-default btn-xs js-delete-profile" title="{intl l='Delete this profile'}" href="#{if $linkedAdminCount > 0}profile_cannot_delete_dialog{else}profile_delete_dialog{/if}" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
@@ -171,6 +173,15 @@
|
||||
form_action = {url path='/admin/configuration/profiles/delete'}
|
||||
form_content = {$smarty.capture.profile_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "profile_cannot_delete_dialog"
|
||||
dialog_title = {intl l="You can't delete this profile"}
|
||||
dialog_body = {intl l="They are some administrator which are linked to this profile. Please edit/remove them before deleting this profile."}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
Reference in New Issue
Block a user